Hi, I have a text file containing the non-zero entries of a sparse matrix of dimension 2683x1274, stored in the form (row, column, element) i.e. [i, j, element] format.
That is ALL the information I have regarding the matrix. However when pre-allocating memory with MatSeqAIJSetPreallocation(Mat B,PetscInt nz,const PetscInt nnz[]), the parameters nz and nnz need to be known, nz=number of nonzeros per row (same for all rows) nnz=array containing the number of nonzeros in the various rows (possibly different for each row) or PETSC_NULL<http://www.mcs.anl.gov/petsc/petsc-2/snapshots/petsc-dev/docs/manualpages/Sys/PETSC_NULL.html#PETSC_NULL> which i do not know for my matrix, ( unless I resort to using MATLAB. ). Does that mean I have to set nz= 1274 (the length of a row) and nnz=PETSC_NULL ? Though, I guess this setting would consume a lot of memory for higher order matrices. How then, should I go about memory pre-allocation more efficiently? Thanks, Gaurish Telang There is a code in the PETSc folder (/src/mat/examples/tests/ex78.c ) which reads in a matrix of this format. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110213/72d7080a/attachment.htm>
