petsc-3.7.1 2016-05-15
Report Typos and Errors

# MatSetNullSpace

attaches a null space to a matrix.

### Synopsis

    #include "petscmat.h"
    PetscErrorCode MatSetNullSpace(Mat mat,MatNullSpace nullsp)

Logically Collective on Mat and MatNullSpace Many br

### Input Parameters

| mat | - the matrix Many br
| nullsp | - the null space object Many br

Many br

### Notes

This null space is used by the linear solvers. Overwrites any previous null space that may have been attached Many br

For inconsistent singular systems (linear systems where the right hand side is not in the range of the operator) you also likely should Many brcall MatSetTransposeNullSpace(). This allows the linear system to be solved in a least squares sense. Many br

You can remove the null space by calling this routine with an nullsp of NULL Many br

The fundamental theorem of linear algebra (Gilbert Strang, Introduction to Applied Mathematics, page 72) states that Many brthe domain of a matrix A (from R^n to R^m (m rows, n columns) R^n = the direct sum of the null space of A, n(A), + the range of A^T, R(A^T). Many brSimilarly R^m = direct sum n(A^T) + R(A). Hence the linear system A x = b has a solution only if b in R(A) (or correspondingly b is orthogonal to Many brn(A^T)) and if x is a solution then x + alpha n(A) is a solution for any alpha. The minimum norm solution is orthogonal to n(A). For problems without a solution Many brthe solution that minimizes the norm of the residual (the least squares solution) can be obtained by solving A x = \hat{b} where \hat{b} is b orthogonalized to the n(A^T). Many br

Krylov solvers can produce the minimal norm solution to the least squares problem by utilizing MatNullSpaceRemove(). Many br

### See Also

MatCreate(), MatNullSpaceCreate(), MatSetNearNullSpace(), MatGetNullSpace(), MatSetTransposeNullSpace(), MatGetTransposeNullSpace(), MatNullSpaceRemove()

Level:advanced
Location:src/mat/interface/matrix.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/ksp/ksp/examples/tutorials/ex4.c.html
src/ksp/ksp/examples/tutorials/ex29.c.html
src/ksp/ksp/examples/tutorials/ex32.c.html
src/ksp/ksp/examples/tutorials/ex34.c.html
src/ksp/ksp/examples/tutorials/ex50.c.html
src/snes/examples/tutorials/ex7.c.html
src/snes/examples/tutorials/ex12.c.html
src/snes/examples/tutorials/ex62.c.html