← Back to team overview

dolfin team mailing list archive

Identity matrix

 

Hi,

Does anyone have an example of using the ident() function in PETScMatrix. I cannot get it 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);

and it kills me/my computer.

Kind regards, Jesper


Follow ups