# MatView

Visualizes a matrix object.

### Synopsis

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

Collective on Mat

### Input Parameters

| mat | - the matrix
| viewer | - visualization context

### Notes

The available visualization contexts include

| PETSC_VIEWER_STDOUT_SELF | - standard output (default)
| PETSC_VIEWER_STDOUT_WORLD | - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print.
| PETSC_VIEWER_DRAW_WORLD | - graphical display of nonzero structure

The user can open alternative visualization contexts with

| PetscViewerASCIIOpen() | - Outputs matrix to a specified file
| PetscViewerBinaryOpen() | - Outputs matrix in binary to a specified file; corresponding input uses MatLoad()
| PetscViewerDrawOpen() | - Outputs nonzero matrix structure to an X window display
| PetscViewerSocketOpen() | - Outputs matrix to Socket viewer. Currently only the sequential dense and AIJ matrix types support the Socket viewer.

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

| PETSC_VIEWER_ASCII_DEFAULT | - default, prints matrix contents
| PETSC_VIEWER_ASCII_MATLAB | - prints matrix contents in Matlab format
| PETSC_VIEWER_ASCII_DENSE | - prints entire matrix including zeros
| PETSC_VIEWER_ASCII_COMMON | - prints matrix contents, using a sparse format common among all matrix types
| PETSC_VIEWER_ASCII_IMPL | - prints matrix contents, using an implementation-specific format (which is in many cases the same as the default)
| PETSC_VIEWER_ASCII_INFO | - prints basic information about the matrix size and structure (not the matrix entries)
| PETSC_VIEWER_ASCII_INFO_DETAIL | - prints more detailed information about the matrix structure

### Options Database Keys

| -mat_view_info | - Prints info on matrix at conclusion of MatEndAssembly()
| -mat_view_info_detailed | - Prints more detailed info
| -mat_view | - Prints matrix in ASCII format
| -mat_view_matlab | - Prints matrix in Matlab format
| -mat_view_draw | - PetscDraws nonzero structure of matrix, using MatView() and PetscDrawOpenX().
| -display <name> | - Sets display name (default is host)
| -draw_pause <sec> | - Sets number of seconds to pause after display
| -mat_view_socket | - Sends matrix to socket, can be accessed from Matlab (see users manual)
| -viewer_socket_machine <machine> | - . -viewer_socket_port <port>
| -mat_view_binary | - save matrix to file in binary format
| -viewer_binary_filename <name> | -

### See Also

PetscViewerSetFormat(), PetscViewerASCIIOpen(), PetscViewerDrawOpen(),
PetscViewerSocketOpen(), PetscViewerBinaryOpen(), MatLoad()

Level:beginner
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/ksp/pc/examples/tutorials/ex1.c.html
src/ksp/pc/examples/tutorials/ex2.c.html
src/ksp/ksp/examples/tutorials/ex28.c.html
src/snes/examples/tutorials/ex29.c.html
src/snes/examples/tutorials/ex33f.F.html