# subspaceProjection¶

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

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 vf: n x 1 - forward flux vr: n x 1 - reverse flux vnet: n x 1 - net flux u: m x 1 - chemical potential u0: m x 1 - standard chemical potential lnx: m 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)

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)

Returns the matrix for projection onto the subspace of matrix A, specified by sub_space

• ‘all’

• ‘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 M denote the Moore-Penrose pseudoinverse of the A 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

OUTPUTS:
[PR, PN, PC, PL]: matrices for projection onto the row, null,

column and left nullspace of A, respectively

subspaceSVD(S)

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