Skip to main content
`Ctrl`+`K`

# PCFactorSetMatSolverType

sets the solver package that is used to perform the factorization

## Synopsis

    #include "petscpc.h"
    PetscErrorCode PCFactorSetMatSolverType(PC pc, MatSolverType stype)

Logically Collective

## 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

The default type is set by searching for available types based on the order of the calls to `MatSolverTypeRegister()` in `MatInitializePackage()`. Since different PETSc configurations may have different external solvers, seemingly identical runs with different PETSc configurations may use a different solver. For example if one configuration had –download-mumps while a different one had –download-superlu_dist.

## See Also

KSP: Linear System Solvers, `PCLU`, `PCCHOLESKY`, `MatGetFactor()`, `MatSolverType`, `PCFactorGetMatSolverType()`, `MatSolverTypeRegister()`, `MatInitializePackage()`, `MATSOLVERSUPERLU`, `MATSOLVERSUPERLU_DIST`, `MATSOLVERMUMPS`, `MatSolverTypeGet()`

## Level

intermediate

## Location

src/ksp/pc/impls/factor/factor.c

## Examples

src/tao/constrained/tutorials/ex1.c
src/ksp/ksp/tutorials/ex57f.F90
src/tao/constrained/tutorials/maros.c
src/dm/impls/stag/tutorials/ex4.c
src/ksp/ksp/tutorials/ex53.c
src/ksp/ksp/tutorials/ex52.c
src/ksp/ksp/tutorials/ex52f.F90

## Implementations

PCFactorSetMatSolverType_Factor() in src/ksp/pc/impls/factor/factimpl.c

Index of all PC routines
Table of Contents for all manual pages
Index of all manual pages