:orphan: # MatSetType Builds matrix object for a particular matrix type ## Synopsis ``` #include "petscmat.h" PetscErrorCode MatSetType(Mat mat, MatType matype) ``` Collective ## Input Parameters - ***mat -*** the matrix object - ***matype -*** matrix type ## Options Database Key - ***-mat_type -*** Sets the type; see `MatType` ## Note See `MatType` for possible values ## See Also [](ch_matrices), `Mat`, `PCSetType()`, `VecSetType()`, `MatCreate()`, `MatType`, `Mat` ## Level intermediate ## Location src/mat/interface/matreg.c ## Examples src/ksp/ksp/tutorials/ex100.c
src/ksp/ksp/tutorials/ex100f.F90
src/ksp/ksp/tutorials/ex15f.F90
src/ksp/ksp/tutorials/ex27.c
src/ksp/ksp/tutorials/ex52f.F90
src/ksp/ksp/tutorials/ex54.c
src/ksp/ksp/tutorials/ex54f.F90
src/ksp/ksp/tutorials/ex55.c
src/ksp/ksp/tutorials/ex56.c
src/ksp/ksp/tutorials/ex59.c
src/ksp/ksp/tutorials/ex73.c
--- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/interface/matreg.c) [Index of all Mat routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)