MatView#

display information about a matrix in a variety ways

Synopsis#

#include "petscmat.h" 
PetscErrorCode MatView(Mat mat, PetscViewer viewer)

Collective

Input Parameters#

  • mat - the matrix

  • viewer - visualization context

Notes#

The available visualization contexts include

The user can open alternative visualization contexts with

The user can call PetscViewerPushFormat() to specify the output format of ASCII printed objects (when using PETSC_VIEWER_STDOUT_SELF, PETSC_VIEWER_STDOUT_WORLD and PetscViewerASCIIOpen()). Available formats include

Options Database Keys#

  • -mat_view ::ascii_info - Prints info on matrix at conclusion of MatAssemblyEnd()

  • -mat_view ::ascii_info_detail - Prints more detailed info

  • -mat_view - Prints matrix in ASCII format

  • -mat_view ::ascii_matlab - Prints matrix in Matlab format

  • -mat_view draw - PetscDraws nonzero structure of matrix, using MatView() and PetscDrawOpenX().

  • -display - Sets display name (default is host)

  • -draw_pause - Sets number of seconds to pause after display

  • -mat_view socket - Sends matrix to socket, can be accessed from Matlab (see Users-Manual: ch_matlab for details)

  • -viewer_socket_machine -

  • -viewer_socket_port -

  • -mat_view binary - save matrix to file in binary format

  • -viewer_binary_filename -

Notes#

The ASCII viewers are only recommended for small matrices on at most a moderate number of processes, the program will seemingly hang and take hours for larger matrices, for larger matrices one should use the binary format.

In the debugger you can do “call MatView(mat,0)” to display the matrix. (The same holds for any PETSc object viewer).

See the manual page for MatLoad() for the exact format of the binary file when the binary viewer is used.

See share/petsc/matlab/PetscBinaryRead.m for a Matlab code that can read in the binary file when the binary viewer is used and lib/petsc/bin/PetscBinaryIO.py for loading them into Python.

One can use ‘-mat_view draw -draw_pause -1’ to pause the graphical display of matrix nonzero structure, and then use the following mouse functions.

  left mouse: zoom in
  middle mouse: zoom out
  right mouse: continue with the simulation

See Also#

PetscViewerPushFormat(), PetscViewerASCIIOpen(), PetscViewerDrawOpen(), PetscViewer, Mat, PetscViewerSocketOpen(), PetscViewerBinaryOpen(), MatLoad(), MatViewFromOptions()

Level#

beginner

Location#

src/mat/interface/matrix.c

Examples#

src/vec/vec/tutorials/ex6.c.html
src/mat/tutorials/ex11.c.html
src/mat/tutorials/ex12.c.html
src/mat/tutorials/ex16.c.html
src/mat/tutorials/ex17.c.html
src/mat/tutorials/ex17f.F90.html
src/mat/tutorials/ex18.c.html
src/mat/tutorials/ex4.c.html
src/mat/tutorials/ex4f.F90.html
src/mat/tutorials/ex8.c.html
src/dm/tutorials/ex14.c.html

Implementations#

MatView_MPIAdj in src/mat/impls/adj/mpi/mpiadj.c
MatView_SparseElemental in src/mat/impls/aij/mpi/clique/clique.cxx
MatView_MPIAIJ in src/mat/impls/aij/mpi/mpiaij.c
MatView_MUMPS in src/mat/impls/aij/mpi/mumps/mumps.c
MatView_PaStiX in src/mat/impls/aij/mpi/pastix/pastix.c
MatView_STRUMPACK in src/mat/impls/aij/mpi/strumpack/strumpack.c
MatView_SeqAIJ in src/mat/impls/aij/seq/aij.c
MatView_KLU in src/mat/impls/aij/seq/klu/klu.c
MatView_Matlab in src/mat/impls/aij/seq/matlab/aijmatlab.c
MatView_SuperLU in src/mat/impls/aij/seq/superlu/superlu.c
MatView_UMFPACK in src/mat/impls/aij/seq/umfpack/umfpack.c
MatView_MPIBAIJ in src/mat/impls/baij/mpi/mpibaij.c
MatView_SeqBAIJ in src/mat/impls/baij/seq/baij.c
MatView_BlockMat in src/mat/impls/blockmat/seq/blockmat.c
MatView_ConstantDiagonal in src/mat/impls/cdiagonal/cdiagonal.c
MatView_MPIDense in src/mat/impls/dense/mpi/mpidense.c
MatView_SeqDense in src/mat/impls/dense/seq/dense.c
MatView_Elemental in src/mat/impls/elemental/matelem.cxx
MatView_H2OPUS in src/mat/impls/h2opus/cuda/math2opus.cu
MatView_Htool in src/mat/impls/htool/htool.cxx
MatView_HYPRE in src/mat/impls/hypre/mhypre.c
MatView_IS in src/mat/impls/is/matis.c
MatView_KAIJ in src/mat/impls/kaij/kaij.c
MatView_SeqMAIJ in src/mat/impls/maij/maij.c
MatView_MPIMAIJ in src/mat/impls/maij/maij.c
MatView_MFFD in src/mat/impls/mffd/mffd.c
MatView_Nest in src/mat/impls/nest/matnest.c
MatView_Preallocator in src/mat/impls/preallocator/matpreallocator.c
MatView_MPISBAIJ in src/mat/impls/sbaij/mpi/mpisbaij.c
MatView_CHOLMOD in src/mat/impls/sbaij/seq/cholmod/sbaijcholmod.c
MatView_SeqSBAIJ in src/mat/impls/sbaij/seq/sbaij.c
MatView_ScaLAPACK in src/mat/impls/scalapack/matscalapack.c
MatView_MPISELL in src/mat/impls/sell/mpi/mpisell.c
MatView_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