[petsc-users] Outputting matrix for viewing in matlab
baikadi pranay
pranayreddy865 at gmail.com
Sat Nov 30 14:30:51 CST 2019
Thank you all for the suggestions. I have it working now.
Regards,
Pranay.
On Fri, Nov 29, 2019 at 10:39 AM Smith, Barry F. <bsmith at mcs.anl.gov> wrote:
>
>
> > On Nov 28, 2019, at 7:07 PM, baikadi pranay <pranayreddy865 at gmail.com>
> wrote:
> >
> > Hello PETSc users,
> >
> > I have a sparse matrix built and I want to output the matrix for viewing
> in matlab. However i'm having difficulty outputting the matrix. I am
> writing my program in Fortran90 and I've included the following lines to
> output the matrix.
> >
> > call
> PetscViewerBinaryOpen(PETSC_COMM_SELF,'matrix',FILE_MODE_WRITE,view,ierr)
>
> Normally on would use to save the matrix and then use the scripts
> Patrick mentioned to read the matrix into Matlab or Python.
>
> call MatView(matrix, view,ierr)
> call PetscViewerDestroy(view,ierr)
>
>
>
> > call PetscViewerBinaryGetDescriptor(view,fd,ierr)
> > call PetscBinaryWrite(fd,ham,1,PETSC_SCALAR,PETSC_FALSE,ierr)
> >
> > These lines do create a matrix but matlab says its not a binary file.
> Could you please provide me some inputs on where I'm going wrong and how to
> proceed with this problem. I can provide any further information that you
> might need to help me solve this problem.
> >
> >
> > Thank you.
> >
> > Sincerely,
> > Pranay.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20191130/94be3de8/attachment.html>
More information about the petsc-users
mailing list