On Monday April 4 2011 11:58:30 Anders Logg wrote: > On Mon, Apr 04, 2011 at 11:51:12AM -0700, 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? > > Not from me. There was recently a question about this on the mailing > list (on creating an identity matrix).
That should be easy to do with the set_diagonal method on a zeroed Matrix. > A related question is whether its possible to speedup ident_zeros. > It's quite slow at the moment. Is there a version of MatDiagonalSet > which takes an index set? I have just briefly looked at the PETSc Mat man page but could realy not find something that would work. I am pretty sure the set method set the whole diagonal using a dense vector. Johan > -- > Anders > > > 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