:orphan: # DMSetMatType Sets the type of matrix created with `DMCreateMatrix()` ## Synopsis ``` #include "petscdm.h" #include "petscdmlabel.h" #include "petscds.h" PetscErrorCode DMSetMatType(DM dm, MatType ctype) ``` Logically Collective ## Input Parameters - ***dm -*** the `DM` context - ***ctype -*** the matrix type, for example `MATMPIAIJ` ## Options Database Key - ***-dm_mat_type ctype -*** the type of the matrix to create, for example mpiaij ## See Also [](ch_dmbase), `DM`, `MatType`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMSetMatrixPreallocateOnly()`, `MatType`, `DMGetMatType()`, `DMSetMatType()`, `DMGetMatType()`, `DMCreateGlobalVector()`, `DMCreateLocalVector()` ## Level intermediate ## Location src/dm/interface/dm.c ## Examples src/dm/tutorials/ex14.c
src/ksp/ksp/tutorials/ex42.c
src/ksp/ksp/tutorials/ex43.c
src/ksp/ksp/tutorials/ex44f.F90
src/ksp/ksp/tutorials/ex49.c
src/ksp/ksp/tutorials/ex70.c
src/ksp/ksp/tutorials/ex71.c
src/snes/tutorials/ex14.c
src/snes/tutorials/ex35.c
src/snes/tutorials/ex48.c
src/snes/tutorials/ex58.c
--- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/interface/dm.c) [Index of all DM routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)