:orphan:
# Mat
Abstract PETSc matrix object used to manage all linear operators in PETSc, even those without an explicit sparse representation (such as matrix-free operators)
## Synopsis
```
typedef struct _p_Mat *Mat;
```
## Note
See [](doc_matrix), [](ch_matrices) and `MatType` for available matrix types
## See Also
[](doc_matrix), [](ch_matrices), `MatCreate()`, `MatType`, `MatSetType()`, `MatDestroy()`
## Level
beginner
## Location
include/petscmat.h
## Examples
src/dm/impls/stag/tutorials/ex2.c
src/dm/impls/stag/tutorials/ex3.c
src/dm/impls/stag/tutorials/ex4.c
src/ksp/ksp/tutorials/bench_kspsolve.c
src/ksp/ksp/tutorials/ex100.c
src/ksp/ksp/tutorials/ex15.c
src/ksp/ksp/tutorials/ex25.c
src/ksp/ksp/tutorials/ex28.c
src/ksp/ksp/tutorials/ex29.c
src/ksp/ksp/tutorials/ex32.c
src/ksp/ksp/tutorials/ex34.c
## Implementations
Mat in src/mat/impls/hypre/mhypre.c
_p_Mat in include/petsc/private/matimpl.h
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petscmat.h)
[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)