Nullspace¶
- echelonNullspace(S, side, tol)[source]¶
Returns the Echelon form of the: left nullspace, LS=[−L0 I]PS=0 or right nullspace SL=S([−L0 I]P)T=0.
- USAGE
[L0, I, P, L, p] = echelonNullspace (S, side, tol)
- INPUT
S – m x n stoichiometric matrix
- OPTIONAL INPUTS
side – {‘left’, ‘right’} left or right nullspace, left by default.
tol – upper bound on tolerance of linear independence default no greater than 1e-12
- OUTPUTS
if side == left
L0 – (m-r) x r matrix which forms the non-trivial part of the left nullspace in echelon form i.e. [−L0 I]PS=0.
P – m x m row (permutation matrix
I – (m-r) x (m-r) identity matrix
p – row permutation which leaves first 1:rankA rows independent and last rows dependent
if side == right
L0 – (n-r) x r matrix which forms the non-trivial part of the right nullspace in echelon form i.e. S([−L0 I]P)T=0.
P – n x n column permutaion matrix
I – (n-r) x (n-r) identity matrix
p – column permutation which leaves first 1:rankA columns independent and last columns dependent
See: Conservation analysis of large biochemical networks Ravishankar Rao Vallabhajosyula , Vijay Chickarmane and Herbert M. Sauro
- getNullSpace(S, printLevel)[source]¶
Calculates the nullspace of S for full(S) or rank(S)==m. If full row rank i.e. rank(S) = m, it’s much faster to work with a sparse LU.
- USAGE
[Z, rankS] = getNullSpace (S, printLevel)
- INPUT
S – m x n stoichiometric matrix
- OPTIONAL INPUT
printLevel – {0, (1)}, 0 means quiet
- OUTPUT
Z – (right) null space of S , S*Z = 0 (when m≤n, otherwise [])
rankS – scalar giving rank of S
- nullSpaceOperator(S, scale, printLevel)[source]¶
Uses LUSOL to compute a nullspace operator nullS We assume S is m x n with m<n with rank r. First nullS = nullSpaceOperator(S) computes a structure nullS from an m x n sparse matrix S (m<n). Second, if V is an (n-r) x k sparse matrix (k≥1), W = nullSpaceOperatorApply(nullS, V); computes an n x k sparse matrix W from V such that SW=0.
This is an operator form of finding an n x (n-r) matrix Z such that SZ=0 and then computing W=ZV. The aim is to obtain W without forming Z explicitly.
nullS.rank returns the rank of S (r≤m). It doesn’t matter if rank<m.
- USAGE
nullS = nullSpaceOperator (S, scale, printLevel)
- INPUTS
S – m x n matrix
scale – {(1), 0} geometric mean scaling of S
printLevel – {(1), 0}
- OUTPUT
nullS – nullspace operator to be used with nullSpaceOperatorApply.m
nullS.rank - rank of S
Note
Requires Nick Henderson’s 64 bit LUSOL interface to be intalled and added to the matlab path. See https://github.com/nwh/lusol see also https://web.stanford.edu/group/SOL/software/lusol/
- nullSpaceOperatorApply(nullS, V)[source]¶
Computes a sparse matrix W from V such that SW=0. First, nullS = nullSpaceOperator(S) computes a structure nullS from an m x n sparse matrix S (m<n), with rank r.
Second, if V is an (n-r) x k sparse matrix (k≥1), W = nullSpaceOperatorApply(nullS, V); computes an n x k sparse matrix W from V such that SW=0.
This is an operator form of finding an n x (n-r) matrix Z such that SZ=0 and then computing W=ZV. The aim is to obtain W without forming Z explicitly.
- nullspaceLUSOLapply2Modes(mode, m, n, V, nullS)[source]¶
Computes the matrix vector product with the operator nullspace function handle of the form y = pdMat(mode, m, n, x)
- USAGE
W = nullspaceLUSOLapply2Modes (mode, m, n, V, nullS)
- INPUTS
mode – mode=1 returns W=ZV, mode = 2 returns W=ZTV
m – first dimension of the matrix
n – second dimension of the matrix
V – one of the components of the multiplication
nullS – structure nullS from the function nullspaceLUSOLform(S); where m x n sparse matrix S (m<n).
- OUTPUT
W – Matrix vector product