Skip to main content
`Ctrl`+`K`

# PCPreSolve

Optional pre-solve phase, intended for any preconditioner-specific actions that must be performed before the iterative solve itself. Used in conjunction with `PCPostSolve()`

## Synopsis

    #include "petscksp.h"
    PetscErrorCode PCPreSolve(PC pc, KSP ksp)

Collective

## Input Parameters

- pc - the `PC` preconditioner context

- ksp - the Krylov subspace context

## Notes

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

Certain preconditioners, such as the `PCType` of `PCEISENSTAT`, change the formulation of the linear system to be solved iteratively. This function performs that transformation. `PCPostSolve()` then transforms the system back to its original form after the solve. `PCPostSolve()` also transforms the resulting solution of the transformed system to the solution of the original problem.

`KSPSetPreSolve()` and `KSPSetPostSolve()` provide an alternative way to provide such transformations.

## See Also

KSP: Linear System Solvers, `PC`, `PCPostSolve()`, `KSP`, `PCSetPreSolve()`, `KSPSetPreSolve()`, `KSPSetPostSolve()`

## Level

developer

## Location

src/ksp/pc/interface/precon.c

## Implementations

PCPreSolve_BDDC() in src/ksp/pc/impls/bddc/bddc.c
PCPreSolve_BJKOKKOS() in src/ksp/pc/impls/bjacobi/bjkokkos/bjkokkos.kokkos.cxx
PCPreSolve_Deflation() in src/ksp/pc/impls/deflation/deflation.c
PCPreSolve_Eisenstat() in src/ksp/pc/impls/eisens/eisen.c
PCPreSolve_HPDDM() in src/ksp/pc/impls/hpddm/pchpddm.cxx
PCPreSolve_LMVM() in src/ksp/pc/impls/lmvm/lmvmpc.c
PCPreSolve_Shell() in src/ksp/pc/impls/shell/shellpc.c
PCPreSolve_PDIPM() in src/tao/constrained/impls/ipm/pdipm.c

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