PCSetOperators#
Sets the matrix associated with the linear system and a (possibly) different one associated with the preconditioner.
Synopsis#
#include "petscksp.h"
PetscErrorCode PCSetOperators(PC pc, Mat Amat, Mat Pmat)
Logically Collective
Input Parameters#
pc - the preconditioner context
Amat - the matrix that defines the linear system
Pmat - the matrix to be used in constructing the preconditioner, usually the same as Amat.
Notes#
Passing a NULL
for Amat
or Pmat
removes the matrix that is currently used.
If you wish to replace either Amat
or Pmat
but leave the other one untouched then
first call KSPGetOperators()
to get the one you wish to keep, call PetscObjectReference()
on it and then pass it back in in your call to KSPSetOperators()
.
More Notes about Repeated Solution of Linear Systems#
PETSc does NOT reset the matrix entries of either Amat
or Pmat
to zero after a linear solve; the user is completely responsible for
matrix assembly. See the routine MatZeroEntries()
if desiring to
zero all elements of a matrix.
See Also#
KSP: Linear System Solvers, PC
, PCGetOperators()
, MatZeroEntries()
Level#
intermediate
Location#
Index of all PC routines
Table of Contents for all manual pages
Index of all manual pages