#include "petscmat.h" int MatLoad(PetscViewer viewer,MatType outtype,Mat *newmat)Collective on PetscViewer
viewer | - binary file viewer, created with PetscViewerBinaryOpen() | |
outtype | - type of matrix desired, for example MATSEQAIJ, MATMPIROWBS, etc. See types in petsc/include/petscmat.h. |
-matload_type seqaij | - AIJ type | |
-matload_type mpiaij | - parallel AIJ type | |
-matload_type seqbaij | - block AIJ type | |
-matload_type mpibaij | - parallel block AIJ type | |
-matload_type seqsbaij | - block symmetric AIJ type | |
-matload_type mpisbaij | - parallel block symmetric AIJ type | |
-matload_type seqbdiag | - block diagonal type | |
-matload_type mpibdiag | - parallel block diagonal type | |
-matload_type mpirowbs | - parallel rowbs type | |
-matload_type seqdense | - dense type | |
-matload_type mpidense | - parallel dense type | |
-matload_symmetric | - matrix in file is symmetric |
In parallel, each processor can load a subset of rows (or the entire matrix). This routine is especially useful when a large matrix is stored on disk and only part of it existsis desired on each processor. For example, a parallel solver may access only some of the rows from each processor. The algorithm used here reads relatively small blocks of data rather than reading the entire matrix and then subsetting it.
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
Note for Cray users, the int's stored in the binary file are 32 bit integers; not 64 as they are represented in the memory, so if you write your own routines to read/write these binary files from the Cray you need to adjust the integer sizes that you read in, see PetscReadBinary() and PetscWriteBinary() to see how this may be done.
In addition, PETSc automatically does the byte swapping for machines that store the bytes reversed, e.g. DEC alpha, freebsd, linux, nt and the paragon; thus if you write your own binary read/write routines you have to swap the bytes; see PetscReadBinary() and PetscWriteBinary() to see how this may be done.
Level:beginner
Location:src/mat/utils/matio.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages