KSPCheckMatSolve#

Checks whether an inner matrix solve failed and flags its solution and the outer preconditioner

Synopsis#

#include "petscksp.h" 
PetscErrorCode KSPCheckMatSolve(KSP ksp, PC pc, Mat mat)

Logically Collective

Input Parameters#

  • ksp - the inner linear solver context

  • pc - the outer preconditioner context

  • mat - the MATDENSE solution matrix to flag

Notes#

This is the matrix counterpart of KSPCheckSolve(), for use after KSPMatSolve() or KSPMatSolveTranspose() within a PCMatApply() or PCMatApplyTranspose() implementation.

If the inner preconditioner reports a failure, or ksp has a negative convergence reason other than KSP_DIVERGED_ITS, the local portion of mat is set to infinity with MatFlag() and the outer pc is marked with PC_SUBPC_ERROR. If the outer pc is configured to raise an error on failure, this routine raises the error after flagging mat.

Without a failure, the entries of mat are unchanged. Its object state is increased in either case.

If mat is NULL, it must be NULL on all calling processes.

This may be called by a subset of the processes in the PC.

Example Usage#

  PetscCall(KSPMatSolve(ksp, B, X));
  PetscCall(KSPCheckMatSolve(ksp, pc, X));

See Also#

KSP: Linear System Solvers, KSP, PC, KSPCheckSolve(), KSPMatSolve(), KSPMatSolveTranspose(), MatFlag(), PCGetFailedReason(), PCSetErrorIfFailure()

Level#

developer

Location#

src/ksp/ksp/interface/iterativ.c


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