Skip to main content
`Ctrl`+`K`

# PCKSPGetKSP

Gets the `KSP` context for a `PCKSP`.

## Synopsis

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

Not Collective but ksp returned is parallel if pc was parallel

## Input Parameter

- pc - the preconditioner context

## Output Parameter

- ksp - the `KSP` solver

## Note

If the `PC` is not a `PCKSP` object it raises an error

## See Also

KSP: Linear System Solvers, `PCKSP`, `PCKSPSetKSP()`

## Level

advanced

## Location

src/ksp/pc/impls/ksp/pcksp.c

## Examples

src/ksp/ksp/tutorials/ex71.c

## Implementations

PCKSPGetKSP_KSP() in src/ksp/pc/impls/ksp/pcksp.c

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