How is the nullspace correction implemented in the PETSc conjugate gradient solver? I searched the source code and documentation, but could not find references on the actual implementation.

For background, I am solving linear systems arising from a bilinear form which is elliptic in a quotient space $\mathbb{R}^n\big/\ker{\mathbf{Z}}$, where $\mathbf{Z}$ is an $m \times n$ matrix having non-trivial null-space.

I compute SVD of $\mathbf{Z}$ and feed the right singular vectors corresponding to "big" singular values as nullspace vectors to the PETSc conjugate gradient solver. It works like a charm, except when $\mathbf{Z}$ is not of academic size.


It is just a projection $1 - ZZ^T$. If you are digging around in the implementation, look at KSP_PCApplyBAorAB() and related functions.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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