KSPMatSolve#
Solves a linear system with multiple right-hand sides stored as a MATDENSE.
Synopsis#
#include "petscksp.h"
#include "petscmat.h"
PetscErrorCode KSPMatSolve(KSP ksp, Mat B, Mat X)
Input Parameters#
ksp - iterative solver
B - block of right-hand sides
Output Parameter#
X - block of solutions
Notes#
This is a stripped-down version of KSPSolve(), which only handles -ksp_view, -ksp_converged_reason, -ksp_converged_rate, and -ksp_view_final_residual.
Unlike with KSPSolve(), B and X must be different matrices.
The columns of B are solved in batches of at most the size set with KSPSetMatSolveBatchSize(), which defaults to the whole block, and the KSPType
implementation is called once per batch.
As KSPSolve() does, this resets the residual and error history lists at the start of the solve, and at the start of each batch when KSPSetMatSolveBatchSize() is
used, unless KSPSetResidualHistory() or KSPSetErrorHistory() was called with reset set to PETSC_FALSE.
See Also#
KSP: Linear System Solvers, KSPSolve(), MatMatSolve(), KSPMatSolveTranspose(), MATDENSE, KSPHPDDM, KSPRICHARDSON, PCBJACOBI, PCASM, KSPSetMatSolveBatchSize()
Level#
intermediate
Location#
Examples#
src/ksp/ksp/tutorials/ex77.c
src/ksp/ksp/tutorials/ex76.c
src/ksp/ksp/tutorials/ex77f.F90
src/ksp/ksp/tutorials/ex79.c
src/ksp/ksp/tutorials/ex76f.F90
Implementations#
KSPMatSolve_HPDDM() in src/ksp/ksp/impls/hpddm/hpddm.cxx
KSPMatSolve_PREONLY() in src/ksp/ksp/impls/preonly/preonly.c
KSPMatSolve_Richardson() in src/ksp/ksp/impls/rich/rich.c
Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages