Method of mdss.
Eliminate algebraic variables and their equality equations from an
mdss model while preserving the implicit multilinear
structure.
Source: src/model/@mdss/algebraicElimination.m
reducedSystem = algebraicElimination(sys)
reducedSystem = algebraicElimination(sys, analysisPoints)
reducedSystem = algebraicElimination(sys, analysisPoints, Name, Value)algebraicElimination removes algebraic variables and
their corresponding equality equations from an mdss model,
wherever doing so keeps the model multilinear (no variable ends up
squared). The result is an equivalent, smaller model in the same
CP-tensor representation. Variables listed in
analysisPoints are protected and never eliminated.
Two convenience guards are on by default and can leave more variables
unreduced than analysisPoints alone:
ProtectInequalities protects every algebraic variable that
appears on an inequality/switching row, and
GuardBlockGrowth skips any elimination that would grow a
row of the cyclic core (so small blocks do not fuse into one large
implicit loop).
| Argument | Description |
|---|---|
sys |
The mdss model to reduce (CP-tensor backed). |
analysisPoints |
Algebraic-variable indices to protect from elimination. Default
[]. |
| Name | Default | Description |
|---|---|---|
ProtectInequalities |
true |
Never eliminate an algebraic variable that appears on an inequality/switching row. |
GuardBlockGrowth |
true |
Skip any elimination that grows a row of the cyclic core. |
debug |
false |
Print elimination progress and matrix sizes. |
| Output | Description |
|---|---|
reducedSystem |
The reduced mdss model, equivalent to
sys. |
The algebraic elimination algorithm removes algebraic variables and
their corresponding equality equations from an mdss model,
while preserving the implicit multilinear (CP-tensor) structure. The
model is represented in a CP-tensor format:
where each column of the structure matrix encodes which variables appear in that monomial term (its support), and the corresponding column of the parameter matrix encodes the coefficient per equation.
Two local functions implement the core logic:
checkReducability determines whether a variable can safely
be eliminated, and reduction performs the actual
elimination.
checkReducabilityDetermines whether substituting varIdx (using
eqIdx) into all other equations in eqOthers
preserves multilinearity — i.e. no variable ends up appearing twice in
any term after substitution.
The substitution produces new terms by pairing each column
from the other equations with each column
from eqIdx. For each pair
,
the contribution to equation
is:
where the two factor matrices are defined as:
Scalar factor
— encodes that exactly one of
must involve varIdx for a valid substitution term to
arise:
varIdx, column
doesvarIdx, column
does notDot product — captures whether columns and share any active variable rows:
means that after substitution, some variable would appear in both column and column , creating a squared variable — a multilinearity violation.
The double sum over is a matrix triple product:
This replaces the original entry-by-entry double loop with three BLAS matrix operations.
If reducable is the zero vector, no multilinearity
violation occurs and the variable is safe to eliminate:
reductionPerforms the actual algebraic substitution: eliminates
varIdx from all equations by expressing it via
eqIdx and substituting into eqOthers. Returns
updated structure and parameter matrices with one fewer variable and one
fewer equation.
The sign of eqIdx is normalised so that the coefficient
of varIdx is positive. This makes the substitution
direction unambiguous — varIdx is always expressed as a
function of the other terms in eqIdx, not the negative.
Two sets of columns are identified:
colsContainingVar: columns whose
support includes varIdx. These disappear after
substitution, since varIdx is consumed.colsInfluencedByEqs: columns that
appear in either eqIdx or eqOthers. Only these
can produce new terms during substitution; all others pass through
unchanged.The base output matrices are built by:
eqOthers rows in the parameter matrix —
they will be replaced by substituted termseqIdx row entirely — it is consumed by the
substitutioncolsContainingVar — they are
absorbed into the eliminated variableWhat remains are the monomial terms unaffected by this substitution.
For each pair of columns from the restricted matrices, the new monomial term arising from the substitution has:
Coefficient per equation :
where
is the same scalar factor as in checkReducability.
Variable support — union of the supports of columns and :
Multiple pairs may produce the same monomial support . These are like terms whose coefficients are summed into the same output column.
Identifying like terms requires checking whether already exists as a column in the growing output matrix. A naive comparison scans all existing columns — O(n) per lookup.
Instead, each column is projected onto a fixed random probe vector to obtain a scalar fingerprint:
Two identical columns always produce the same scalar. Two different
columns produce the same scalar only with negligible probability
(floating-point collision on a random projection). A MATLAB
dictionary keyed on those (plain-double)
fingerprints then provides O(1) lookup:
Each equation row is scaled so its largest absolute coefficient is 1:
This keeps the representation numerically consistent across successive reductions.
mdss · trivialReduction
· determineParallizedSolvingOrder
MyToolbox Documentation | Generated automatically by CI/CD pipeline