KSPSetReusePreconditioner — PETSc 3.22.5 documentation

Skip to main content
`Ctrl`+`K`

# KSPSetReusePreconditioner

reuse the current preconditioner for future `KSPSolve()`, do not construct a new preconditioner even if the `Mat` operator in the `KSP` has different values

## Synopsis

    #include "petscksp.h"
    #include "petscmat.h"
    PetscErrorCode KSPSetReusePreconditioner(KSP ksp, PetscBool flag)

Collective

## Input Parameters

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

- flag - `PETSC_TRUE` to reuse the current preconditioner, or `PETSC_FALSE` to construct a new preconditioner

## Options Database Key

- -ksp_reuse_preconditioner <true,false> - reuse the previously computed preconditioner

## Note

When using `SNES` one can use `SNESSetLagPreconditioner()` to determine when preconditioners are reused.

## See Also

KSP: Linear System Solvers, `KSPCreate()`, `KSPSolve()`, `KSPDestroy()`, `KSP`, `KSPGetReusePreconditioner()`, `SNESSetLagPreconditioner()`, `SNES`

## Level

intermediate

## Location

src/ksp/ksp/interface/itfunc.c

## Examples

src/ksp/ksp/tutorials/ex6f.F90

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