petsc-3.3-p7 2013-05-11


Returns information about matrix storage (number of nonzeros, memory, etc.).


#include "petscmat.h" 
PetscErrorCode  MatGetInfo(Mat mat,MatInfoType flag,MatInfo *info)
Collective on Mat if MAT_GLOBAL_MAX or MAT_GLOBAL_SUM is used as the flag

Input Parameters

mat -the matrix

Output Parameters

flag - flag indicating the type of parameters to be returned (MAT_LOCAL - local matrix, MAT_GLOBAL_MAX - maximum over all processors, MAT_GLOBAL_SUM - sum over all processors)
info - matrix information context


The MatInfo context contains a variety of matrix data, including number of nonzeros allocated and used, number of mallocs during matrix assembly, etc. Additional information for factored matrices is provided (such as the fill ratio, number of mallocs during factorization, etc.). Much of this info is printed to PETSC_STDOUT when using the runtime options
      -info -mat_view_info

Example for C/C++ Users

See the file ${PETSC_DIR}/include/petscmat.h for a complete list of data within the MatInfo context. For example,
      MatInfo info;
      Mat     A;
      double  mal, nz_a, nz_u;

      mal  = info.mallocs;
      nz_a = info.nz_allocated;

Example for Fortran Users

Fortran users should declare info as a double precision array of dimension MAT_INFO_SIZE, and then extract the parameters of interest. See the file ${PETSC_DIR}/include/finclude/petscmat.h a complete list of parameter names.
      double  precision info(MAT_INFO_SIZE)
      double  precision mal, nz_a
      Mat     A
      integer ierr

      call MatGetInfo(A,MAT_LOCAL,info,ierr)
      mal = info(MAT_INFO_MALLOCS)
      nz_a = info(MAT_INFO_NZ_ALLOCATED)

Developer Note: fortran interface is not autogenerated as the f90 interface defintion cannot be generated correctly [due to MatInfo]

See Also


Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages