Skip to main content
`Ctrl`+`K`

# KSPReset

Removes any allocated `Vec` and `Mat` from the `KSP` data structures.

## Synopsis

    #include "petscksp.h"
    #include "petscmat.h"
    PetscErrorCode KSPReset(KSP ksp)

Collective

## Input Parameter

- ksp - iterative solver obtained from `KSPCreate()`

## Notes

Any options set in the `KSP`, including those set with `KSPSetFromOptions()` remain.

Call `KSPReset()` only before you call `KSPSetOperators()` with a different sized matrix than the previous matrix used with the `KSP`.

## See Also

KSP: Linear System Solvers, `KSPCreate()`, `KSPSetUp()`, `KSPSolve()`, `KSP`

## Level

intermediate

## Location

src/ksp/ksp/interface/itfunc.c

## Examples

src/ksp/ksp/tutorials/ex75f.F90
src/ksp/ksp/tutorials/ex75.c

## Implementations

KSPReset_BCGS() in src/ksp/ksp/impls/bcgs/bcgs.c
KSPReset_BCGSL() in src/ksp/ksp/impls/bcgsl/bcgsl.c
KSPReset_PIPELCG() in src/ksp/ksp/impls/cg/pipelcg/pipelcg.c
KSPReset_Chebyshev() in src/ksp/ksp/impls/cheby/cheby.c
KSPReset_FCG() in src/ksp/ksp/impls/fcg/fcg.c
KSPReset_FETIDP() in src/ksp/ksp/impls/fetidp/fetidp.c
KSPReset_GCR() in src/ksp/ksp/impls/gcr/gcr.c
KSPReset_PIPEGCR() in src/ksp/ksp/impls/gcr/pipegcr/pipegcr.c
KSPReset_FGMRES() in src/ksp/ksp/impls/gmres/fgmres/fgmres.c
KSPReset_GMRES() in src/ksp/ksp/impls/gmres/gmres.c
KSPReset_PGMRES() in src/ksp/ksp/impls/gmres/pgmres/pgmres.c
KSPReset_PIPEFGMRES() in src/ksp/ksp/impls/gmres/pipefgmres/pipefgmres.c
KSPReset_HPDDM() in src/ksp/ksp/impls/hpddm/hpddm.cxx
KSPReset_LCD() in src/ksp/ksp/impls/lcd/lcd.c

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