Matrix input file format

Barry Smith bsmith at mcs.anl.gov
Wed May 31 08:01:53 CDT 2006


   Evrim,

    From the manual page for MatLoad()
http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatLoad.html


Most users should not need to know the details of the binary storage format, since MatLoad() and MatView() completely hide these details. But for anyone who's interested, the standard binary matrix storage format is

    int    MAT_FILE_COOKIE
    int    number of rows
    int    number of columns
    int    total number of nonzeros
    int    *number nonzeros in each row
    int    *column indices of all nonzeros (starting index is zero)
    PetscScalar *values of all nonzeros

Mat_file_cookie is 1211216

BTW: we never recommend saving a matrix to a file and then loading with a PETSc 
program to solve the system; this is not parallel programming.

   Barry


On Wed, 31 May 2006, Evrim Dizemen wrote:

> Dear all,
>
> I'm using Petsc 2.3.1 for my master thesis. I want to solve a linear problem 
> Ax=b in parallel programming using MPICH with complex variables. I can get 
> the A matrix from my fortran code but i can not find in which format i must 
> write it for reading by Petsc. I'm really not familiar with c programming  so 
> I'll be happy for a solution in fortran.
>
> THANKS,
>
> Evrim
>
>




More information about the petsc-users mailing list