PETSc version 3.15.5
Fix/Edit manual page

# MatSetUp

Sets up the internal matrix data structures for later use.

### Synopsis

    #include "petscmat.h"
    PetscErrorCode MatSetUp(Mat A)

Collective on Mat

### Input Parameters

| A | - the Mat context

### Notes

If the user has not set preallocation for this matrix then a default preallocation that is likely to be inefficient is used.

If a suitable preallocation routine is used, this function does not need to be called.

See the Performance chapter of the PETSc users manual for how to preallocate matrices

### See Also

MatCreate(), MatDestroy()

### Level

beginner

### Location

src/mat/interface/matrix.c

### Examples

src/mat/tutorials/ex4.c.html
src/mat/tutorials/ex8.c.html
src/mat/tutorials/ex4f.F90.html
src/ksp/pc/tutorials/ex3.c.html
src/ksp/ksp/tutorials/ex1.c.html
src/ksp/ksp/tutorials/ex5.c.html
src/ksp/ksp/tutorials/ex6.c.html
src/ksp/ksp/tutorials/ex8.c.html
src/ksp/ksp/tutorials/ex9.c.html
src/ksp/ksp/tutorials/ex11.c.html
src/ksp/ksp/tutorials/ex12.c.html

### Implementations

MatSetUp_HYPREStruct in src/dm/impls/da/hypre/mhyp.c
MatSetUp_HYPRESStruct in src/dm/impls/da/hypre/mhyp.c
MatSetUp_MPIAIJ in src/mat/impls/aij/mpi/mpiaij.c
MatSetUp_SeqAIJ in src/mat/impls/aij/seq/aij.c
MatSetUp_MPIBAIJ in src/mat/impls/baij/mpi/mpibaij.c
MatSetUp_SeqBAIJ in src/mat/impls/baij/seq/baij.c
MatSetUp_MPIDense in src/mat/impls/dense/mpi/mpidense.c
MatSetUp_SeqDense in src/mat/impls/dense/seq/dense.c
MatSetUp_Elemental in src/mat/impls/elemental/matelem.cxx
MatSetUp_HYPRE in src/mat/impls/hypre/mhypre.c
MatSetUp_KAIJ in src/mat/impls/kaij/kaij.c
MatSetUp_MAIJ in src/mat/impls/maij/maij.c
MatSetUp_Preallocator in src/mat/impls/preallocator/matpreallocator.c
MatSetUp_MPISBAIJ in src/mat/impls/sbaij/mpi/mpisbaij.c
MatSetUp_SeqSBAIJ in src/mat/impls/sbaij/seq/sbaij.c
MatSetUp_ScaLAPACK in src/mat/impls/scalapack/matscalapack.c
MatSetUp_MPISELL in src/mat/impls/sell/mpi/mpisell.c
MatSetUp_SeqSELL in src/mat/impls/sell/seq/sell.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages