Thread Previous • Date Previous • Date Next • Thread Next |
jesperc wrote:
Hi,Does anyone have an example of using the ident() function in PETScMatrix. I cannot get it to work
Matrix::ident(. . . ) is not meant to do this, so it is unlikely to work. and using a for loop with set() to
create an identity matrix is painfully slow... This is how I do it now: Matrix A; A.init(n,n,1); for (int i=0; i<n; ++i) A.set(i,i,1);
You shouldn't set Matrix values element-wise (Matrix::set(int,int,real) has been removed from the Matrix interface to stop users doing this). If you really want to access matrix entries element-wise, use a uBlasMatrix, otherwise set values in large blocks using
Matrix::set(const real* block, uint m, const uint* rows, uint n, const uint* cols)
Garth
and it kills me/my computer. Kind regards, Jesper _______________________________________________ DOLFIN-dev mailing list DOLFIN-dev@xxxxxxxxxx http://www.fenics.org/mailman/listinfo/dolfin-dev
Thread Previous • Date Previous • Date Next • Thread Next |