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

Michael Povolotskyi mpovolot at purdue.edu
Tue Jun 25 10:22:20 CDT 2013


On 06/24/2013 06:07 PM, Jed Brown wrote:
> 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);
What is the difference (if any) between  MatDenseGetArray and MatGetArray?

-- 
Michael Povolotskyi, PhD
Research Assistant Professor
Network for Computational Nanotechnology
207 S Martin Jischke Drive
Purdue University, DLR, room 441-10
West Lafayette, Indiana 47907

phone: +1-765-494-9396
fax: +1-765-496-6026



More information about the petsc-users mailing list