# subspaceProjection¶

projectOntoSubspace(A, vf, vr, vnet, u, u0, lnx, printLevel, rowBool, colBool)[source]

Projects flux, net flux, potential and logarithmic concentration onto their respective subspaces of A using projection matrices generated either derived from SVD, or by using the Moore-Penrose pseudoinverse

Optionally, a subset of the matrix A may be chosen by using A(rowBool,colBool) but then only the true rows of u, u0, lnx, and true columns of vf,vr,vnet are projected and the remaining rows and columns are not affected

Let M denote the Moore-Penrose pseudoinverse of A and the subscripts are the following _R row space, _N nullspace, _C column space, _L left nullspace,

Example for flux of net flux

Let

$\begin{split}vf &= vf_R + vf_N \\ vf_R &= M A vf = PR vf \\ vf_N &= (I - M A) vf = PN vf\end{split}$

Example for potential or logarithmic concentration

Let

$\begin{split}u &= u_C + u_L \\ u_C &= A M u = PC u \\ u_L &= (I - A M) u = PL u\end{split}$

Usage

[vfN, vfR, vrN, vrR, vnetN, vnetR, uL, uC, u0L, u0C, lnxL, lnxC] = projectOntoSubspace(modelT, vf, vr, vnet, u, u0, lnx)

Inputs

• A m x n matrix
• vfn x 1 - forward flux
• vrn x 1 - reverse flux
• vnetn x 1 - net flux
• um x 1 - chemical potential
• u0m x 1 - standard chemical potential
• lnxm x 1 - logarithmic concentration

Optional inputs

• rowBool m x 1 - boolean indicating the subset of rows of A
• colBool ‘n x 1’ - boolean indicating the subset of cols of A

Outputs

• vfN – forward flux - nullspace
• vfR – forward flux - row space
• vrN – reverse flux - nullspace
• vrR – reverse flux - row space
• vnetN – net flux - nullspace
• vnetR – net flux - row space
• uL – chemical potential - left nullspace
• uC – chemical potential - column space
• lnxL – logarithmic concentration - left nullspace
• lnxC – logarithmic concentration - column space
projectSVD(U1, u)[source]

Assumes that U1 has orthonormal columns so that $$U1 U1^T$$ is a projector. It returns the projections

$\begin{split}u1 &= U1 U1^T u \\ u2 &= (I - U1 U1^T) u\end{split}$

Usage

[u1, u2] = projectSVD(U1, u)

Example

[U1, D1, V1, r] = subspaceSVD(S);
[uC, uL] = projectSVD(U1, u);
[vfR, vfN] = projectSVD(V1, vf);
[vrR, vrN] = projectSVD(V1, vr);

subspaceProjector(A, printLevel, sub_space)[source]

Returns the matrix for projection onto the sub_space of the internal reaction stoichiometric matrix specified by sub_space If sub_space is ‘all’ then all are returned

Let M denote the Moore-Penrose pseudoinverse of the internal reaction stoichiometric matrix S and the subscripts are the following _R row space i.e. range(A’) _N nullspace i.e. null(A) _C column space i.e. range(A) _L left nullspace i.e. null(A’)

Let

$\begin{split}v &= v_R + v_N \\ v_R &= M A v = PR v \\ v_N &= (I - M A) v = PN v\end{split}$

Let

$\begin{split}u &= u_C + u_L \\ u_C &= A M u = PC u \\ u_L &= (I - A M) u = PL u\end{split}$

Examples:

Given $$A v = b$$, then $$v_R = M b$$

Given $$A^Tu = q$$, then $$u_C = M^T q$$

Usage

[PR, PN, PC, PL] = subspaceProjector(model, printLevel, sub_space)

Input

• A m x n matrix

Optional inputs

• printLevel – {(1), 0}, 1 = print diagnostics, 0 = silent
• sub_space – returns projection matrices onto all or one select
• sub_space
• ‘all’
• ‘R’ row space
• ‘N’ nullspace
• ‘C’ column space
• ‘L’ left nullspace

Output

• [PR, PN, PC, PL] – matrices for projection onto the row, null, column and left nullspace of A, respectively
subspaceSVD(S)[source]

Returns quantities satisfying $$S = U1 D1 V1^T$$, where U1 and V1 have r orthonormal columns, and D1 is r x r diagonal and has numerical rank r.

The matrix S may be diagonal. Matrices U1 and V1 may be used by projectSVD.m to project given vectors onto certain subspaces.

Usage

[U1, D1, V1, r] = subspaceSVD(S)

Input

• S – matrix

Outputs

• U1, D1, V1 – matrices
• r – numerical rank of D1