Skip to main content
`Ctrl`+`K`

# MatCreateSchurComplement

Creates a new `Mat` that behaves like the Schur complement of a matrix

## Synopsis

    #include "petscksp.h"
    PetscErrorCode MatCreateSchurComplement(Mat A00, Mat Ap00, Mat A01, Mat A10, Mat A11, Mat *S)

Collective

## Input Parameters

- A00 - the upper-left block of the original matrix \(A = [A00 A01; A10 A11]\)

- Ap00 - matrix from which the preconditioner is constructed for use in \(ksp(A00,Ap00)\) to approximate the action of \(A00^{-1}\)

- A01 - the upper-right block of the original matrix \(A = [A00 A01; A10 A11]\)

- A10 - the lower-left block of the original matrix \(A = [A00 A01; A10 A11]\)

- A11 - (optional) the lower-right block of the original matrix \(A = [A00 A01; A10 A11]\)

## Output Parameter

- S - the matrix that behaves as the Schur complement \(S = A11 - A10 ksp(A00,Ap00) A01\)

## Notes

The Schur complement is NOT explicitly formed! Rather, this function returns a virtual Schur complement that can compute the matrix-vector product by using formula \(S = A11 - A10 A^{-1} A01\) for Schur complement `S` and a `KSP` solver to approximate the action of \(A^{-1}\).

All four matrices must have the same MPI communicator.

`A00` and `A11` must be square matrices.

`MatGetSchurComplement()` takes as arguments the index sets for the submatrices and returns both the virtual Schur complement (what this returns) plus a sparse approximation to the Schur complement (useful for building a preconditioner for the Schur complement) which can be obtained from this matrix with `MatSchurComplementGetPmat()`

## Developer Notes

The API that includes `MatGetSchurComplement()`, `MatCreateSchurComplement()`, `MatSchurComplementGetPmat()` should be refactored to remove redundancy and be clearer and simpler.

## See Also

KSP: Linear System Solvers, `MatCreateNormal()`, `MatMult()`, `MatCreate()`, `MatSchurComplementGetKSP()`, `MatSchurComplementUpdateSubMatrices()`, `MatCreateTranspose()`, `MatGetSchurComplement()`, `MatSchurComplementGetPmat()`, `MatSchurComplementSetSubMatrices()`

## Level

intermediate

## Location

src/ksp/ksp/utils/schurm/schurm.c

## Examples

src/ksp/ksp/tutorials/ex27.c

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