MatGetInfo#

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

Synopsis#

#include "petscmat.h" 
PetscErrorCode MatGetInfo(Mat mat, MatInfoType flag, MatInfo *info)

Collective if MAT_GLOBAL_MAX or MAT_GLOBAL_SUM is used as the flag

Input Parameters#

  • mat - the matrix

  • 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)

Output Parameter#

  • info - matrix information context

Options Database Key#

  • -mat_view ::ascii_info - print matrix info to PETSC_STDOUT

Notes#

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.).

Example#

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;

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

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/petsc/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#

The Fortran interface is not autogenerated as the interface definition cannot be generated correctly [due to MatInfo argument]

See Also#

Matrices, Mat, MatInfo, MatStashGetInfo()

Level#

intermediate

Location#

src/mat/interface/matrix.c

Examples#

src/mat/tutorials/ex16.c

Implementations#

MatGetInfo_MPIAIJ in src/mat/impls/aij/mpi/mpiaij.c
MatGetInfo_MUMPS in src/mat/impls/aij/mpi/mumps/mumps.c
MatGetInfo_PaStiX in src/mat/impls/aij/mpi/pastix/pastix.c
MatGetInfo_SeqAIJ in src/mat/impls/aij/seq/aij.c
MatGetInfo_MPIBAIJ in src/mat/impls/baij/mpi/mpibaij.c
MatGetInfo_SeqBAIJ in src/mat/impls/baij/seq/baij2.c
MatGetInfo_ConstantDiagonal in src/mat/impls/cdiagonal/cdiagonal.c
MatGetInfo_MPIDense in src/mat/impls/dense/mpi/mpidense.c
MatGetInfo_SeqDense in src/mat/impls/dense/seq/dense.c
MatGetInfo_Elemental in src/mat/impls/elemental/matelem.cxx
MatGetInfo_IS in src/mat/impls/is/matis.c
MatGetInfo_MPISBAIJ in src/mat/impls/sbaij/mpi/mpisbaij.c
MatGetInfo_CHOLMOD in src/mat/impls/sbaij/seq/cholmod/sbaijcholmod.c
MatGetInfo_SeqSBAIJ in src/mat/impls/sbaij/seq/sbaij2.c
MatGetInfo_ScaLAPACK in src/mat/impls/scalapack/matscalapack.c
MatGetInfo_MPISELL in src/mat/impls/sell/mpi/mpisell.c
MatGetInfo_SeqSELL in src/mat/impls/sell/seq/sell.c


Edit on GitLab

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