KSPSetPreSolve#

Sets a function that is called at the beginning of each KSPSolve(). Used in conjunction with KSPSetPostSolve().

Synopsis#

#include "petscksp.h" 
PetscErrorCode KSPSetPreSolve(KSP ksp, PetscErrorCode (*presolve)(KSP ksp, Vec rhs, Vec x, void *ctx), void *ctx)

Logically Collective

Input Parameters#

  • ksp - the solver object

  • presolve - the function to call before the solve

  • ctx - an optional context needed by the function

Calling sequence of presolve#

  • ksp - the KSP context

  • rhs - the right-hand side vector

  • x - the solution vector

  • ctx - optional user-provided context

Notes#

The function provided here presolve is used to modify the right hand side, and possibly the matrix, of the linear system to be solved. The function provided with KSPSetPostSolve() then modifies the resulting solution of that linear system to obtain the correct solution to the initial linear system.

The functions PCPreSolve() and PCPostSolve() provide a similar functionality and are used, for example with PCEISENSTAT.

See Also#

KSP: Linear System Solvers, KSPSetUp(), KSPSolve(), KSPDestroy(), KSP, KSPSetPostSolve(), PCEISENSTAT, PCPreSolve(), PCPostSolve()

Level#

developer

Location#

src/ksp/ksp/interface/itcreate.c


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