:orphan:
# KSPSetUp
Sets up the internal data structures for the later use of an iterative solver.
## Synopsis
```
#include "petscksp.h"
#include "petscmat.h"
PetscErrorCode KSPSetUp(KSP ksp)
```
Collective
## Input Parameter
- ***ksp -*** iterative context obtained from `KSPCreate()`
## See Also
[](ch_ksp), `KSPCreate()`, `KSPSolve()`, `KSPDestroy()`, `KSP`
## Level
developer
## Location
src/ksp/ksp/interface/itfunc.c
## Examples
src/dm/impls/stag/tutorials/ex4.c
src/ksp/ksp/tutorials/ex10.c
src/ksp/ksp/tutorials/ex27.c
src/ksp/ksp/tutorials/ex28.c
src/ksp/ksp/tutorials/ex29.c
src/ksp/ksp/tutorials/ex41.c
src/ksp/ksp/tutorials/ex43.c
src/ksp/ksp/tutorials/ex45f.F90
src/ksp/ksp/tutorials/ex5.c
src/ksp/ksp/tutorials/ex52.c
src/ksp/ksp/tutorials/ex52f.F90
## Implementations
KSPSetUp_BCGS in src/ksp/ksp/impls/bcgs/bcgs.c
KSPSetUp_FBCGS in src/ksp/ksp/impls/bcgs/fbcgs/fbcgs.c
KSPSetUp_FBCGSR in src/ksp/ksp/impls/bcgs/fbcgsr/fbcgsr.c
KSPSetUp_PIPEBCGS in src/ksp/ksp/impls/bcgs/pipebcgs/pipebcgs.c
KSPSetUp_QMRCGS in src/ksp/ksp/impls/bcgs/qmrcgs/qmrcgs.c
KSPSetUp_BCGSL in src/ksp/ksp/impls/bcgsl/bcgsl.c
KSPSetUp_BiCG in src/ksp/ksp/impls/bicg/bicg.c
KSPSetUp_CG in src/ksp/ksp/impls/cg/cg.c
KSPSetUp_CGLS in src/ksp/ksp/impls/cg/cgls.c
KSPSetUp_CGNE in src/ksp/ksp/impls/cg/cgne/cgne.c
KSPSetUp_GROPPCG in src/ksp/ksp/impls/cg/groppcg/groppcg.c
KSPSetUp_PIPECG in src/ksp/ksp/impls/cg/pipecg/pipecg.c
KSPSetUp_PIPECG2 in src/ksp/ksp/impls/cg/pipecg2/pipecg2.c
KSPSetUp_PIPECGRR in src/ksp/ksp/impls/cg/pipecgrr/pipecgrr.c
KSPSetUp_PIPELCG in src/ksp/ksp/impls/cg/pipelcg/pipelcg.c
KSPSetUp_PIPEPRCG in src/ksp/ksp/impls/cg/pipeprcg/pipeprcg.c
KSPSetUp_CGS in src/ksp/ksp/impls/cgs/cgs.c
KSPSetUp_Chebyshev in src/ksp/ksp/impls/cheby/cheby.c
KSPSetUp_CR in src/ksp/ksp/impls/cr/cr.c
KSPSetUp_PIPECR in src/ksp/ksp/impls/cr/pipecr/pipecr.c
KSPSetUp_FCG in src/ksp/ksp/impls/fcg/fcg.c
KSPSetUp_PIPEFCG in src/ksp/ksp/impls/fcg/pipefcg/pipefcg.c
KSPSetUp_FETIDP in src/ksp/ksp/impls/fetidp/fetidp.c
KSPSetUp_GCR in src/ksp/ksp/impls/gcr/gcr.c
KSPSetUp_PIPEGCR in src/ksp/ksp/impls/gcr/pipegcr/pipegcr.c
KSPSetUp_AGMRES in src/ksp/ksp/impls/gmres/agmres/agmres.c
KSPSetUp_DGMRES in src/ksp/ksp/impls/gmres/dgmres/dgmres.c
KSPSetUp_FGMRES in src/ksp/ksp/impls/gmres/fgmres/fgmres.c
KSPSetUp_GMRES in src/ksp/ksp/impls/gmres/gmres.c
KSPSetUp_LGMRES in src/ksp/ksp/impls/gmres/lgmres/lgmres.c
KSPSetUp_PGMRES in src/ksp/ksp/impls/gmres/pgmres/pgmres.c
KSPSetUp_PIPEFGMRES in src/ksp/ksp/impls/gmres/pipefgmres/pipefgmres.c
KSPSetUp_HPDDM in src/ksp/ksp/impls/hpddm/hpddm.cxx
KSPSetUp_IBCGS in src/ksp/ksp/impls/ibcgs/ibcgs.c
KSPSetUp_LCD in src/ksp/ksp/impls/lcd/lcd.c
KSPSetUp_LSQR in src/ksp/ksp/impls/lsqr/lsqr.c
KSPSetUp_MINRES in src/ksp/ksp/impls/minres/minres.c
KSPSetUp_PREONLY in src/ksp/ksp/impls/preonly/preonly.c
KSPSetUp_QCG in src/ksp/ksp/impls/qcg/qcg.c
KSPSetUp_Richardson in src/ksp/ksp/impls/rich/rich.c
KSPSetUp_SYMMLQ in src/ksp/ksp/impls/symmlq/symmlq.c
KSPSetUp_TCQMR in src/ksp/ksp/impls/tcqmr/tcqmr.c
KSPSetUp_TFQMR in src/ksp/ksp/impls/tfqmr/tfqmr.c
KSPSetUp_TSIRM in src/ksp/ksp/impls/tsirm/tsirm.c
---
[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)