KSPSetReusePreconditioner — PETSc 3.25.1 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

## Notes

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

Reusing the preconditioner reduces the time needed to form new preconditioners but may (significantly) increase the number of iterations needed for future solves depending on how much the matrix entries have changed.

## 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
src/ksp/ksp/tutorials/ex56.c

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