# MatGetType
Gets the matrix type as a string from the matrix object. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatGetType(Mat mat, MatType *type)
```
Not Collective


## Input Parameter

- ***mat -*** the matrix



## Output Parameter

- ***name -*** name of matrix type





## See Also
 `MatType`, `MatSetType()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/interface/matreg.c.html#MatGetType">src/mat/interface/matreg.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex29.c.html">src/ksp/ksp/tutorials/ex29.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex34.c.html">src/ksp/ksp/tutorials/ex34.c.html</A><BR>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
