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

# MatView

Visualizes a matrix object.

### Synopsis

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

Collective on Mat Many br

### Input Parameters

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

### Notes

The available visualization contexts include Many br

| PETSC_VIEWER_STDOUT_SELF | - for sequential matrices Many br
| PETSC_VIEWER_STDOUT_WORLD | - for parallel matrices created on PETSC_COMM_WORLD Many br
| PETSC_VIEWER_STDOUT_(comm) | - for matrices created on MPI communicator comm Many br
| PETSC_VIEWER_DRAW_WORLD | - graphical display of nonzero structure Many br

The user can open alternative visualization contexts with Many br

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

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

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

### Options Database Keys

| -mat_view ::ascii_info | - Prints info on matrix at conclusion of MatEndAssembly() Many br
| -mat_view ::ascii_info_detail | - Prints more detailed info Many br
| -mat_view | - Prints matrix in ASCII format Many br
| -mat_view ::ascii_matlab | - Prints matrix in Matlab format Many br
| -mat_view draw | - PetscDraws nonzero structure of matrix, using MatView() and PetscDrawOpenX(). Many br
| -display <name> | - Sets display name (default is host) Many br
| -draw_pause <sec> | - Sets number of seconds to pause after display Many br
| -mat_view socket | - Sends matrix to socket, can be accessed from Matlab (see Users-Manual: Chapter 11 Using MATLAB with PETSc for details) Many br
| -viewer_socket_machine <machine> | - Many br
| -viewer_socket_port <port> | - Many br
| -mat_view binary | - save matrix to file in binary format Many br
| -viewer_binary_filename <name> | - Many br Many br

Notes: see the manual page for MatLoad() for the exact format of the binary file when the binary Many brviewer is used. Many br

See share/petsc/matlab/PetscBinaryRead.m for a Matlab code that can read in the binary file when the binary Many brviewer is used. Many br

One can use '-mat_view draw -draw_pause -1' to pause the graphical display of matrix nonzero structure. Many br

### And then use the following mouse functions

left mouse: zoom in Many brmiddle mouse: zoom out Many brright mouse: continue with the simulation Many br

### See Also

PetscViewerPushFormat(), PetscViewerASCIIOpen(), PetscViewerDrawOpen(),
PetscViewerSocketOpen(), PetscViewerBinaryOpen(), MatLoad() Many br

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/vec/vec/examples/tutorials/ex6.c.html
src/mat/examples/tutorials/ex8.c.html
src/mat/examples/tutorials/ex11.c.html
src/mat/examples/tutorials/ex12.c.html
src/mat/examples/tutorials/ex16.c.html
src/mat/examples/tutorials/ex17.c.html
src/ksp/pc/examples/tutorials/ex2.c.html
src/ksp/ksp/examples/tutorials/ex4.c.html
src/ksp/ksp/examples/tutorials/ex10.c.html
src/ksp/ksp/examples/tutorials/ex28.c.html
src/ksp/ksp/examples/tutorials/ex54.c.html