When I use PETSc to solve my linear systems, I always use the subroutine

PetscErrorCode  KSPSetOperators(KSP ksp,Mat Amat,Mat Pmat)

where Amat refers to the matrix that defines my linear system and Pmat is the Matrix used in constructing the preconditioner.

I am not sure in which scenarios it would be advisable to use another matrix than $A$ or Amat to construct the preconditioner, i.e. to use a preconditioner from another (probably related) linear system.

EDIT Taking a look at the PETSc Manual, one possible occasion in which the matrices Amat and Pmat differ is

when a preconditioning matrix is obtained from a lower order method than that employed to form the linear system matrix.

  • $\begingroup$ A preconditioner doesn't have to be an explicit matrix (see tutorial parabolic.c for SSOR preconditioner), in which case you can set it to call your own function to multiply it by a vector. Also, $A$ and $P$ should always differ, a preconditioner (depending on convention) is an approximation to the inverse $A^{-1}$, not the matrix itself (so you solve $PAx=Pb$, so multiplication by $P$ should be cheap). I don't really understand this question: why wouldn't you want the freedom to specify your own arbitrary preconditioner? $\endgroup$
    – Kirill
    Feb 7, 2015 at 11:31
  • $\begingroup$ @Kirill I'm sorry if my question led to confusion. In fact Pmat is not equal to $P$, instead it is an approximate of $\tilde{A}$ of $A$ that is used to "construct" the preconditioner $P$. $\endgroup$
    – el_tenedor
    Feb 7, 2015 at 13:59
  • $\begingroup$ I have no direct experience here, I looked at lines 1055-1077 of mcs.anl.gov/petsc/petsc-current/src/tao/pde_constrained/… and it uses KSPSetOperators to set its own preconditioner. Also, not all preconditioners are constructed directly from the matrix. They could come from a simpler equivalent system, mathematical considerations, or from somewhere else entirely, like FFT, wavelet transform. But maybe that's not relevant to KSPSetOperators, I don't know. $\endgroup$
    – Kirill
    Feb 8, 2015 at 1:59

1 Answer 1


Since nobody is stepping up to answer this question, let me point to a paper that contains an example of why one would want to do this: http://www.math.tamu.edu/~bangerth/publications.html#publications/reviewed-34 (publication 34, Kronbichler et al.). In fact, there are multiple examples in this paper:

  • We precondition $\begin{pmatrix}A &B \\ B^T & 0\end{pmatrix}$ by a block triangular matrix.

  • We precondition $A$ by one V-cycle based not on $A$ but based on an approximation $\tilde A$ that is simpler and emptier.

  • We approximate the exact $S^{-1}$ in the block preconditioner by the application of a mass matrix.

Complex applications quite frequently play with these things. You just don't ever see them if you just solve simple, scalar problems :-)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.