Preallocating Matrix

Andreas Grassl Andreas.Grassl at student.uibk.ac.at
Mon Apr 27 13:08:14 CDT 2009


Satish Balay schrieb:
> Not sure what you mean by "numbers of zero per row"

I actually meant "number of nonzeros per row", but providing the nnz[]-array to
MatSeqAIJSetPreallocation brought only very little speed-up, by the same factor
as preallocating just with nz.

I suppose that I have to provide already the assembled sparse matrix to the
PETSc-routines instead of calculating it element by element, as long as I don't
distribute this calculation over many cpu's.

cheers,

ando

> 
> 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[]
> 
> Satish
> 
> 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
>>


-- 
 /"\                               Grassl Andreas
 \ /    ASCII Ribbon Campaign      Uni Innsbruck Institut f. Mathematik
  X      against HTML email        Technikerstr. 13 Zi 709
 / \                               +43 (0)512 507 6091


More information about the petsc-users mailing list