Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions analysis/sampleCHRR.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@

% Particular solution v0 and nullspace basis N: v = v0 + N*x.
% v0 is ANY particular solution; the sampled flux distribution is invariant to
% its choice and to the nullspace basis, so MATLAB's '\' (a sparse basic
% solution) and the Python reference's lstsq (minimum-norm solution) sample the
% same polytope despite returning different v0.
v0 = Aeq \ beq;
% its choice and to the nullspace basis, so the minimum-norm solution used here
% and the Python reference's lstsq sample the same polytope.
% lsqminnorm rather than '\': Aeq is square whenever the number of metabolites
% plus the number of folded-in fixed reactions equals the number of reactions,
% and it is then rank-deficient, for which '\' returns NaN. Those NaNs travel
% into the polytope and surface much later as a misleading "empty interior"
% error from sampleChebyshevCenter.
v0 = lsqminnorm(Aeq, beq);
N = null(Aeq);
d = size(N, 2);

Expand Down