PCShellSetMatApplyRichardson#

Sets routine to use as preconditioner in Richardson iteration on a block of vectors stored as a MATDENSE.

Synopsis#

#include "petscpc.h" 
PetscErrorCode PCShellSetMatApplyRichardson(PC pc, PetscErrorCode (*matapply)(PC pc, Mat B, Mat X, Mat W, PetscReal rtol, PetscReal abstol, PetscReal dtol, PetscInt maxits, PetscBool zeroinitialguess, PetscInt *its, PCRichardsonConvergedReason *reason))

Logically Collective

Input Parameters#

  • pc - the preconditioner context

  • matapply - the application-provided preconditioning routine

Calling sequence of matapply#

  • pc - the preconditioner

  • B - block of right-hand sides

  • X - block of current iterates

  • W - block of work vectors, may be NULL

  • rtol - relative tolerance of residual norm to stop at

  • abstol - absolute tolerance of residual norm to stop at

  • dtol - if residual norm increases by this factor then return

  • maxits - number of iterations to run

  • zeroinitialguess - PETSC_TRUE if X is known to be initially zero

  • its - returns the number of iterations used

  • reason - returns the reason the iteration has converged

Notes#

You can get the PCSHELL context set with PCShellSetContext() using PCShellGetContext() if needed by matapply.

This is the block analog of PCShellSetApplyRichardson() and is used by KSPMatSolve() with KSPRICHARDSON to run Richardson’s method on the whole block of right-hand sides at once instead of one right-hand side at a time. KSPRICHARDSON passes NULL for W, so matapply must allocate any scratch space it needs itself. Setting this callback without also setting PCShellSetApplyRichardson() makes KSPMatSolve() delegate to matapply while KSPSolve() runs the generic Richardson iteration with the plain apply callback, so the two can compute different solutions unless the callbacks are consistent.

See Also#

KSP: Linear System Solvers, PCSHELL, PCShellSetApplyRichardson(), PCShellSetMatApply(), PCShellSetContext(), PCRichardsonConvergedReason(), PCShellGetContext(), KSPRICHARDSON, KSPMatSolve()

Level#

advanced

Location#

src/ksp/pc/impls/shell/shellpc.c

Implementations#

PCShellSetMatApplyRichardson_Shell(PC pc, PetscErrorCode (*matapplyrich)() in src/ksp/pc/impls/shell/shellpc.c


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