# MatSetOptionsPrefix
Sets the prefix used for searching for all `Mat` options in the database. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatSetOptionsPrefix(Mat A, const char prefix[])
```
Logically Collective


## Input Parameters

- ***A -*** the matrix
- ***prefix -*** the prefix to prepend to all option names





## Notes
A hyphen (-) must NOT be given at the beginning of the prefix name.
The first character of all runtime options is AUTOMATICALLY the hyphen.

This is NOT used for options for the factorization of the matrix. Normally the
prefix is automatically passed in from the PC calling the factorization. To set
it directly use  `MatSetOptionsPrefixFactor()`


## See Also
 `Mat`, `MatSetFromOptions()`, `MatSetOptionsPrefixFactor()`

## Level
advanced

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/tutorials/ex10.c.html">src/mat/tutorials/ex10.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/tutorials/ex16.c.html">src/mat/tutorials/ex16.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex59.c.html">src/ksp/ksp/tutorials/ex59.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex70.c.html">src/snes/tutorials/ex70.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex14.c.html">src/ts/tutorials/ex14.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/interface/matrix.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)  
