:orphan:
# PCKSPSetKSP
Sets the `KSP` context for a `PCKSP`.
## Synopsis
```
#include "petscksp.h"
PetscErrorCode PCKSPSetKSP(PC pc, KSP ksp)
```
Collective
## Input Parameters
- ***pc -*** the preconditioner context
- ***ksp -*** the `KSP` solver
## Notes
The `PC` and the `KSP` must have the same communicator
This would rarely be used, the standard usage is to call `PCKSPGetKSP()` and then change options on that `KSP`
## See Also
`PCKSP`, `PCKSPGetKSP()`
## Level
advanced
## Location
src/ksp/pc/impls/ksp/pcksp.c
## Implementations
PCKSPSetKSP_KSP in src/ksp/pc/impls/ksp/pcksp.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/pc/impls/ksp/pcksp.c)
[Index of all PC routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)