: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
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/ksp/pcksp.c.html#PCKSPSetKSP">src/ksp/pc/impls/ksp/pcksp.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/ksp/pcksp.c.html#PCKSPSetKSP_KSP">PCKSPSetKSP_KSP in src/ksp/pc/impls/ksp/pcksp.c</A><BR>


---
[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)  
