[petsc-users] question about extracting numbers from a matrix

Jed Brown jedbrown at mcs.anl.gov
Mon Jun 24 17:07:57 CDT 2013


Michael Povolotskyi <mpovolot at purdue.edu> writes:

> Hello everybody,
> I have a sparse matrix defined on 1 MPI process.
> I want to extract all entries from it (including zeros) and put them 
> into an array to use as an argument for some lapack functions.
> What is the most optimal way of doing this?

Mat A_dense;
PetscScalar a;
MatConvert(A,MATDENSE,MAT_INITIAL_MATRIX,&A_dense);
MatDenseGetArray(A_dense,&a);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130624/bbe8cd08/attachment.pgp>


More information about the petsc-users mailing list