Preallocating Matrix

Satish Balay balay at
Thu Apr 23 10:52:31 CDT 2009

Not sure what you mean by "numbers of zero per row"

Do you mean "number of zeros per row" or "column indices of zeros for
each row"?. Either way - you should be able to write a single loop
over this thingy - to compute the required nnz[]


On Thu, 23 Apr 2009, Andreas Grassl wrote:

> Hello,
> I'm assembling large matrices giving just the numbers of zero per row and
> wondering if it is possible to extract the nonzero-structure in array-format it
> can be fed again into
> MatSeqAIJSetPreallocation(Mat B,PetscInt nz,const PetscInt nnz[])
> to detect the bottleneck?
> cheers
> ando

More information about the petsc-users mailing list