petsc-3.7.1 2016-05-15
Report Typos and Errors

MatGetInfo

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

Synopsis

#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 Many br

Input Parameters

mat -the matrix Many br

Output Parameters

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

Notes

The MatInfo context contains a variety of matrix data, including Many brnumber of nonzeros allocated and used, number of mallocs during Many brmatrix assembly, etc. Additional information for factored matrices Many bris provided (such as the fill ratio, number of mallocs during Many brfactorization, etc.). Much of this info is printed to PETSC_STDOUT Many brwhen using the runtime options Many br
      -info -mat_view ::ascii_info

Example for C/C++ Users

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

      MatGetInfo(A,MAT_LOCAL,&info);
      mal  = info.mallocs;
      nz_a = info.nz_allocated;
Many br

Example for Fortran Users

Fortran users should declare info as a double precision Many brarray of dimension MAT_INFO_SIZE, and then extract the parameters Many brof interest. See the file ${PETSC_DIR}/include/petsc/finclude/petscmat.h Many bra complete list of parameter names. Many br
      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)
Many br

Many br

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

See Also

MatStashGetInfo()

Level:intermediate
Location:
src/mat/interface/matrix.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mat/examples/tutorials/ex16.c.html