[petsc-users] To store the matrix.

Vijay S. Mahadevan vijay.m at gmail.com
Thu Jul 14 13:39:46 CDT 2011


Jed,

I think the format is useful to serialize a matrix into MATLAB format.
Typically, you could do something like

nnz = 1 ;
index = zeros(nnz,3);
index = [
1 1  1.0
];
A = spconvert(index);

I am unsure if PETSC_VIEWER_MATLAB already provides this functionality
for matrices. The document for the viewer specifies that currently
only vectors are stored in .mat files and PetscBinaryRead needs to be
used for matrices. This will definitely be faster to load for larger
matrices.

Vijay

On Thu, Jul 14, 2011 at 1:28 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> On Thu, Jul 14, 2011 at 13:18, Xuefei (Rebecca) Yuan <xyuan at lbl.gov> wrote:
>>
>> I would like to store this sparse MXN matrix A in the following form:
>> ....................................................
>>
>> line1:  M       N       numberofnonzeros
>> line2:  i       j       value
>> line3:  i       j       value
>
> This "COO" format is not an efficient representation. Why do you want to
> store it this way?
> (You can produce this by getting the AIJ structure, allocating a new array
> for the row indices, and filling it redundantly from the AIJ structure.


More information about the petsc-users mailing list