Skip to main content
`Ctrl`+`K`

# MatAssemblyEnd

Completes assembling the matrix. This routine should be called after `MatAssemblyBegin()`.

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatAssemblyEnd(Mat mat, MatAssemblyType type)

Collective

## Input Parameters

- mat - the matrix

- type - type of assembly, either `MAT_FLUSH_ASSEMBLY` or `MAT_FINAL_ASSEMBLY`

## 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 - draws 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 Using MATLAB with PETSc)

- -viewer_socket_machine <machine> - Machine to use for socket

- -viewer_socket_port <port> - Port number to use for socket

- -mat_view binary:filename[:append] - Save matrix to file in binary format

## See Also

Matrices, `Mat`, `MatAssemblyBegin()`, `MatSetValues()`, `PetscDrawOpenX()`, `PetscDrawCreate()`, `MatView()`, `MatAssembled()`, `PetscViewerSocketOpen()`

## Level

beginner

## Location

src/mat/interface/matrix.c

## Examples

src/dm/impls/stag/tutorials/ex1.c
src/dm/impls/stag/tutorials/ex3.c
src/ksp/ksp/tutorials/ex12.c
src/dm/impls/stag/tutorials/ex4.c
src/ksp/ksp/tutorials/ex15.c
src/dm/impls/stag/tutorials/ex8.c
src/ksp/ksp/tutorials/ex13.c
src/dm/impls/stag/tutorials/ex2.c
src/ksp/ksp/tutorials/ex11.c
src/ksp/ksp/tutorials/ex1.c

## Implementations

MatAssemblyEnd_HYPREStruct() in src/dm/impls/da/hypre/mhyp.c
MatAssemblyEnd_HYPRESStruct() in src/dm/impls/da/hypre/mhyp.c
MatAssemblyEnd_MPIAdj() in src/mat/impls/adj/mpi/mpiadj.c
MatAssemblyEnd_MPIAIJCRL() in src/mat/impls/aij/mpi/crl/mcrl.c
MatAssemblyEnd_MPIAIJKokkos() in src/mat/impls/aij/mpi/kokkos/mpiaijkok.kokkos.cxx
MatAssemblyEnd_MPIAIJ() in src/mat/impls/aij/mpi/mpiaij.c
MatAssemblyEnd_MPIAIJCUSPARSE() in src/mat/impls/aij/mpi/mpicusparse/mpiaijcusparse.cu
MatAssemblyEnd_MPIAIJHIPSPARSE() in src/mat/impls/aij/mpi/mpihipsparse/mpiaijhipsparse.hip.c
MatAssemblyEnd_MPIAIJViennaCL() in src/mat/impls/aij/mpi/mpiviennacl/mpiaijviennacl.cxx
MatAssemblyEnd_SeqAIJ() in src/mat/impls/aij/seq/aij.c
MatAssemblyEnd_SeqAIJMKL() in src/mat/impls/aij/seq/aijmkl/aijmkl.c
MatAssemblyEnd_SeqAIJPERM() in src/mat/impls/aij/seq/aijperm/aijperm.c
MatAssemblyEnd_SeqAIJSELL() in src/mat/impls/aij/seq/aijsell/aijsell.c
MatAssemblyEnd_SeqAIJCRL() in src/mat/impls/aij/seq/crl/crl.c
MatAssemblyEnd_SeqAIJKokkos() in src/mat/impls/aij/seq/kokkos/aijkok.kokkos.cxx
MatAssemblyEnd_SeqAIJCUSPARSE() in src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu
MatAssemblyEnd_SeqAIJHIPSPARSE() in src/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.c
MatAssemblyEnd_SeqAIJViennaCL() in src/mat/impls/aij/seq/seqviennacl/aijviennacl.cxx
MatAssemblyEnd_MPIBAIJ() in src/mat/impls/baij/mpi/mpibaij.c
MatAssemblyEnd_SeqBAIJ() in src/mat/impls/baij/seq/baij.c
MatAssemblyEnd_SeqBAIJMKL() in src/mat/impls/baij/seq/baijmkl/baijmkl.c
MatAssemblyEnd_BlockMat() in src/mat/impls/blockmat/seq/blockmat.c
MatAssemblyEnd_Composite() in src/mat/impls/composite/mcomposite.c
MatAssemblyEnd_MPIDense() in src/mat/impls/dense/mpi/mpidense.c
MatAssemblyEnd_Elemental() in src/mat/impls/elemental/matelem.cxx
MatAssemblyEnd_H2OPUS() in src/mat/impls/h2opus/cuda/math2opus.cu
MatAssemblyEnd_Htool() in src/mat/impls/htool/htool.cxx
MatAssemblyEnd_HYPRE() in src/mat/impls/hypre/mhypre.c
MatAssemblyEnd_IS() in src/mat/impls/is/matis.c
MatAssemblyEnd_Nest() in src/mat/impls/nest/matnest.c
MatAssemblyEnd_Preallocator() in src/mat/impls/preallocator/matpreallocator.c
MatAssemblyEnd_MPISBAIJ() in src/mat/impls/sbaij/mpi/mpisbaij.c
MatAssemblyEnd_SeqSBAIJ() in src/mat/impls/sbaij/seq/sbaij.c
MatAssemblyEnd_ScaLAPACK() in src/mat/impls/scalapack/matscalapack.c
MatAssemblyEnd_MPISELLCUDA() in src/mat/impls/sell/mpi/mpicuda/mpisellcuda.cu
MatAssemblyEnd_MPISELLHIP() in src/mat/impls/sell/mpi/mpihip/mpisellhip.hip.c
MatAssemblyEnd_MPISELL() in src/mat/impls/sell/mpi/mpisell.c
MatAssemblyEnd_SeqSELL() in src/mat/impls/sell/seq/sell.c
MatAssemblyEnd_SeqSELLCUDA() in src/mat/impls/sell/seq/seqcuda/sellcuda.cu
MatAssemblyEnd_SeqSELLHIP() in src/mat/impls/sell/seq/seqhip/sellhip.hip.c
MatAssemblyEnd_Shell() in src/mat/impls/shell/shell.c

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