[petsc-users] Writing PETSc matrices

Umut Tabak u.tabak at tudelft.nl
Mon Dec 13 11:20:40 CST 2010


On 12/13/2010 06:10 PM, Nunion wrote:
> What files should one use to convert vectors from Matlab to PETSc 
> (PetscBinaryWrite is for square matrices)?  I have attempted to write 
> directly to binary from Matlab a matrix + vector, and only a vector 
> (using save command with the -mat option), then read the binary file 
> into PETSc (using ex34.c in ...src/mat/tests), however the format is 
> not recognized.
>
> Thanks,
> Tom
>
Trying to read mat files in Petsc? This is not possible AFAIK.
Use the provided Matlab interface to write objects in Petsc Binary 
format. You should be sure that the matrices are in sparse format. Also 
for vectors I guess, I am not sure you should check.
Then you can use these binary files generated in MATLAB in PETSc without 
problems.
HTH,
U.



More information about the petsc-users mailing list