:orphan:
# 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
 [](ch_matrices), `Mat`, `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</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex34.c.html">src/ksp/ksp/tutorials/ex34.c</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](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
