:orphan:
# KSPSetPC
Sets the preconditioner to be used to calculate the application of the preconditioner on a vector. 
## Synopsis
```
#include "petscksp.h" 
#include "petscmat.h" 
PetscErrorCode KSPSetPC(KSP ksp, PC pc)
```
Collective


## Input Parameters

- ***ksp -*** iterative context obtained from `KSPCreate()`
- ***pc   -*** the preconditioner object (can be `NULL`)





## Note
Use `KSPGetPC()` to retrieve the preconditioner context.


## See Also
 [](ch_ksp), `KSPGetPC()`, `KSP`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/interface/itfunc.c.html#KSPSetPC">src/ksp/ksp/interface/itfunc.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex59.c.html">src/ksp/ksp/tutorials/ex59.c</A><BR>


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


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