[petsc-users] Import Matlab matrix
Barry Smith
bsmith at petsc.dev
Fri Jul 29 11:11:01 CDT 2022
If you already have Matlab matrices that were saved with, for example,
save example.mat A
It may be possible to use MatLoad() directly on them using the PETSCVIEWERHDF5 viewer type (and not need to use the PetscBinaryWrite()). Please read the full manual page https://petsc.org/release/docs/manualpages/Mat/MatLoad.html <https://petsc.org/release/docs/manualpages/Mat/MatLoad.html> for details and caveats.
> On Jul 29, 2022, at 12:00 PM, Jed Brown <jed at jedbrown.org> wrote:
>
> You can use share/petsc/matlab/PetscBinaryWrite.m.
>
> matlab> PetscBinaryWrite('matrix.petsc', sparse(A))
>
> Then load it with MatLoad in PETSc.
>
> Ahmed Mansur <ahmedlp9 at gmail.com> writes:
>
>> How to import a sparse matrix from Matlab using C++ and PETSC , if anyone
>> has any example code, thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220729/283cf0e0/attachment.html>
More information about the petsc-users
mailing list