[petsc-users] PETSc Matrix to MatLab

Emmanuel Ayala juaneah at gmail.com
Fri May 17 10:19:55 CDT 2019


Hello,

I am a newby with PETSc. I want to check some matrices generated in PETSc,
using MatLab.

I created a matrix A (MATMPIAIJ), the partition is defined by PETSc and I
defined the global size.

Then, I used the next code to save in binary format the matrix from PETSc:

PetscViewer    viewer;
PetscViewerBinaryOpen(PETSC_COMM_WORLD, "matrix", FILE_MODE_WRITE, &viewer);

After that (I think) MatView writes in the viewer:

MatView(A,viewer);

Then I laod the matrix in MatLab with PetscBinaryRead().

For one process everything is Ok, I can see the full pattern of the sparse
matrix (spy(A)). But when I generate the matrix A with more than one
process, the resultant matrix only contains the data from the process 0.

What is the mistake in my procedure?

1. I just want to export the PETSc matrix to MatLab, for any number of
process.

Regards.
Thanks in advance, for your time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190517/ed1b836b/attachment.html>


More information about the petsc-users mailing list