Reuse matrix and vector

Jed Brown jed at
Tue Nov 10 06:08:45 CST 2009

jarunan at wrote:

> The code is compiled with the optimized version of PETSc. The row
> indices and column indices for each row are sorted. Well, they are not
> sorted for diagonal or off-diagonal part.

I recommend using a debug version for all testing and only the optimized
for production/scalability.  You should use
MatCreateMPIAIJWithSplitArrays() if you have these available separately.
But it sounds like you have one big array where each row has the
diagonal part followed by the off-diagonal part?  This format can't be
used directly by PETSc, just preallocate with
MatMPIAIJSetPreallocation() and use MatSetValues().


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the petsc-users mailing list