# PCPreSolve
Optional pre-solve phase, intended for any preconditioner-specific actions that must be performed before the iterative solve itself. 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode PCPreSolve(PC pc, KSP ksp)
```
Collective


## Input Parameters

- ***pc -*** the preconditioner context
- ***ksp -*** the Krylov subspace context





## Sample of Usage
```none
    PCPreSolve(pc,ksp);
    KSPSolve(ksp,b,x);
    PCPostSolve(pc,ksp);
```



## Notes
The pre-solve phase is distinct from the `PCSetUp()` phase.

`KSPSolve()` calls this directly, so is rarely called by the user.


## See Also
 `PC`, `PCPostSolve()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/interface/precon.c.html#PCPreSolve">src/ksp/pc/interface/precon.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/bddc/bddc.c.html#PCPreSolve_BDDC">PCPreSolve_BDDC in src/ksp/pc/impls/bddc/bddc.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/deflation/deflation.c.html#PCPreSolve_Deflation">PCPreSolve_Deflation in src/ksp/pc/impls/deflation/deflation.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/eisens/eisen.c.html#PCPreSolve_Eisenstat">PCPreSolve_Eisenstat in src/ksp/pc/impls/eisens/eisen.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/hpddm/pchpddm.cxx.html#PCPreSolve_HPDDM">PCPreSolve_HPDDM in src/ksp/pc/impls/hpddm/pchpddm.cxx</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/shell/shellpc.c.html#PCPreSolve_Shell">PCPreSolve_Shell in src/ksp/pc/impls/shell/shellpc.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/constrained/impls/ipm/pdipm.c.html#PCPreSolve_PDIPM">PCPreSolve_PDIPM in src/tao/constrained/impls/ipm/pdipm.c</A><BR>


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