On Mon, Apr 04, 2011 at 08:46:48PM +0100, Garth N. Wells wrote: > > > On 04/04/11 20:20, Johan Hake wrote: > > On Monday April 4 2011 12:13:22 Anders Logg wrote: > >> On Mon, Apr 04, 2011 at 08:10:22PM +0100, Garth N. Wells wrote: > >>> On 04/04/11 20:00, Johan Hake wrote: > >>>> On Monday April 4 2011 11:55:05 Garth N. Wells wrote: > >>>>> On 04/04/11 19:51, Johan Hake wrote: > >>>>>> Hello! > >>>>>> > >>>>>> I would very much like to have something like: > >>>>>> // Set the diagonal of a matrix > >>>>>> GenericMatrix::set_diagonal(const GenericVector& vec); > >>>>>> > >>>>>> // Scale Matrix with a diagonal matrix (represented as a Vector) > >>>>>> GenericMatrix::scale(const GenericVector& vec); > >>>>>> (maybe use operator*=) > >>>>>> > >>>>>> added to the GenericMatrix interface. > >>>>>> > >>>>>> The corresponding backend specific methods would be: > >>>>>> // PETSc > >>>>>> MatDiagonalSet > >>>>>> MatDiagonalScale > >>>>>> > >>>>>> // Epetra > >>>>>> ReplaceDiagonalValues > >>>>>> RightScale > >>>>>> > >>>>>> // MTL4/uBLAS find out later... > >>>>>> > >>>>>> which should ensure the methods works in parallel too. > >>>>>> > >>>>>> Any objections or advices in respect to implement these? > >>>>> > >>>>> Fine with me, but could GenericMatrix::scale have a better name? It's > >>>>> not clear to me what it would do. Scale the diagonal, or scale the > >>>>> rows or the columns? > >>>> > >>>> It basically doing: > >>>> A*=D > >>>> > >>>> where D is a diagonal matrix given by the a vector. And I guess this > >>>> would then correspond to a column scale. > >>> > >>> OK. It might get complicated, but we could have a > >>> > >>> (Generic)DiagonalMatrix > >>> > >>> class? > > > > Hmm, letting it inherit GenericVector? This path would open up a box of > > things > > we have to consider... Maye fire up a Blueprint and add other thoughts on > > that. > > > >>> Otherwise, GenericMatrix::right_scale is probably an OK name. > > > > Ok. > > > >> I think scale_columns is more informative, if that is what it actually > >> does. > >> > >> (Is it implied by A *= D that it corresponds to A = A * D or can it be > >> A = D * A?) > > > > Yes, no. > > > > The first one is called RightScale and the second (I guess) is called > > LeftScale in Epetra. In PETSc it is put into the same function. > > > > I could add right_scale and left_scale, or row_scale and column_scale. No > > big > > deal from me. > > > > 'left' and 'right' is consistent with preconditioner terminology, and > with the Trilinos and PETSc naming.
Yes perhaps, but I still thing scale_rows / scale_columns are more informative. -- Anders > Garth > > > Johan > > > >> > >>> Garth > >>> > >>>> Johan > >>>> > >>>>> Garth > >>>>> > >>>>>> Best regards, > >>>>>> > >>>>>> Johan > >>>>>> > >>>>>> _______________________________________________ > >>>>>> Mailing list: https://launchpad.net/~dolfin > >>>>>> Post to : dolfin@lists.launchpad.net > >>>>>> Unsubscribe : https://launchpad.net/~dolfin > >>>>>> More help : https://help.launchpad.net/ListHelp > >>>>> > >>>>> _______________________________________________ > >>>>> Mailing list: https://launchpad.net/~dolfin > >>>>> Post to : dolfin@lists.launchpad.net > >>>>> Unsubscribe : https://launchpad.net/~dolfin > >>>>> More help : https://help.launchpad.net/ListHelp > >>> > >>> _______________________________________________ > >>> Mailing list: https://launchpad.net/~dolfin > >>> Post to : dolfin@lists.launchpad.net > >>> Unsubscribe : https://launchpad.net/~dolfin > >>> More help : https://help.launchpad.net/ListHelp _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : dolfin@lists.launchpad.net Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp