[petsc-users] creating csr matrix from 3 arrays

Dürrwang, Jürgen Juergen.Duerrwang at iosb.fraunhofer.de
Fri May 20 06:23:09 CDT 2011


Hi I am trying to generate a matrix(nxn) from 3 arrays(1D) which I have read from 3 single textfiles:

PetscInt pcol[] (dimension of nz): points to the integer array of length nz that holds the column indices of the corresponding elements in pval
PetscInt prow[] (dimesion of n)
PetscScalar pval[] (dimension of nz)

I tried this:
MatSetValues(A,n,prow,nz,pcol,pval,INSERT_VALUES);
MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

Can I insert the hole data into matrix A or should I loop over it?

Thanks Jürgen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110520/23908dab/attachment-0001.htm>


More information about the petsc-users mailing list