Spnull
Jump to navigation
Jump to search
| spnull | |
| Returns a sparse orthonormal basis for the null space | |
| Other toolboxes required | none |
|---|---|
| License | license_spnull.txt |
| This is a helper function that only exists to aid other functions in QETLAB. If you are an end-user of QETLAB, you likely will never have a reason to use this function. |
spnull is a function that computes an orthonormal basis for the null space of a full or sparse matrix. When the matrix is sparse, this computation is performed via the QR decomposition and is typically much faster than using null(full(S)).
Syntax
- Z = spnull(S)
- Z = spnull(S,varargin)
Argument descriptions
- S: The matrix to have its null space computed.
- varargin (optional): Extra arguments that, if S is full, will be passed to MATLAB's null function.
Examples
The following example gives a 4-by-4 matrix whose null space is spanned by the two vectors $[0,0,1,0]^T$ and $[0,0,0,1]^T$:
>> S = sparse(4,4); >> S(1,1) = 1; S(3,2) = 1; >> spnull(S) ans = (3,1) 1 (4,2) 1
Note that the output is sparse because S is sparse. If the input is full then the output will be full as well:
>> spnull(full(S))
ans =
0 0
0 0
1 0
0 1
External links
- Sparse null space and orthogonal: The source of this file on MATLAB File Exchange