# PCFactorSetMatSolverType
sets the solver package that is used to perform the factorization 
## Synopsis
```
#include "petscpc.h" 
PetscErrorCode PCFactorSetMatSolverType(PC pc, MatSolverType stype)
```
Logically Collective on pc


## Input Parameters

- ***pc -*** the preconditioner context
- ***stype -*** for example, `MATSOLVERSUPERLU`, `MATSOLVERSUPERLU_DIST`, `MATSOLVERMUMPS`



## Options Database Key

- ***-pc_factor_mat_solver_type <stype> -*** petsc, superlu, superlu_dist, mumps, cusparse





## Note
By default this will use the PETSc factorization if it exists


## See Also
 `PCLU`, `PCCHOLESKY`, `MatGetFactor()`, `MatSolverType`, `PCFactorGetMatSolverType()`, `MatSolverType`,
`MATSOLVERSUPERLU`, `MATSOLVERSUPERLU_DIST`, `MATSOLVERMUMPS`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/factor/factor.c.html#PCFactorSetMatSolverType">src/ksp/pc/impls/factor/factor.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/stag/tutorials/ex4.c.html">src/dm/impls/stag/tutorials/ex4.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex52.c.html">src/ksp/ksp/tutorials/ex52.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex52f.F90.html">src/ksp/ksp/tutorials/ex52f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex53.c.html">src/ksp/ksp/tutorials/ex53.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex57f.F90.html">src/ksp/ksp/tutorials/ex57f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/constrained/tutorials/ex1.c.html">src/tao/constrained/tutorials/ex1.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/constrained/tutorials/maros.c.html">src/tao/constrained/tutorials/maros.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/factor/factimpl.c.html#PCFactorSetMatSolverType_Factor">PCFactorSetMatSolverType_Factor in src/ksp/pc/impls/factor/factimpl.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/pc/impls/factor/factor.c)


[Index of all PC routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
