Method of mdss.
Determine a block-lower-triangular solving order for the model’s equations.
Source:
src/model/@mdss/determineParallizedSolvingOrder.m
[solvingOrder, I, Isorted] = determineParallizedSolvingOrder(sys, withoutZ)determineParallizedSolvingOrder computes an order in
which the equality and inequality constraints of a hybrid implicit
multilinear model can be solved for their unknowns. It reorders the
sparsity pattern of the incidence matrix (the initial-value problem
restricted to the unknown signals) into block-lower-triangular form
using the Dulmage–Mendelsohn decomposition via orderIncidenceMatrix,
then identifies which blocks can be solved independently (subsets) and
which unknowns belong to the same coupled subproblem.
This is an internal function used by the simulator; it is not intended to be called directly.
The incidence matrix is first sliced to rows
[equalityIndex; inequalityIndex] and columns
[stateDeltaIndex; algebraicIndex; binaryIndex]. When
withoutZ == 1 the binary columns and inequality rows are
dropped, so only state-derivative unknowns against equality equations
are ordered.
The returned solvingOrder has one row per unknown, with
columns [varIdx, eqIdx, type, subset, subproblem]:
| Column | Meaning |
|---|---|
varIdx |
Index of the unknown variable (in the sliced column order). |
eqIdx |
Index of the equation used to solve it (in the sliced row order). |
type |
1 explicitly solvable, -1 implicit but
linear
(e.g. ),
0 implicit and nonlinear. |
subset |
Parallelisable group. A new subset starts where the matrix is block-diagonal, so different subsets share no variables and could be solved in parallel. |
subproblem |
Sequential solve order. The blocks are ordered
block-lower-triangular, so subproblem k provides inputs to
later ones — solve 1, 2, 3, … in order (the
forward-substitution sequence). |
A type of 0 always spans at least two
consecutive rows sharing the same subproblem, indicating
those unknowns must be solved together with a nonlinear solver. After
the block structure is found, each implicit subproblem is inspected
against the tensor (CPNTensor or
TTTensor) to detect whether its variables are actually
coupled through shared monomial columns; uncoupled subproblems are
demoted to linear (type = -1).
| Argument | Description |
|---|---|
sys |
The mdss model. |
withoutZ |
If 1, exclude binaries and inequalities and order only
state-derivative unknowns against equality equations. |
| Output | Description |
|---|---|
solvingOrder |
Matrix [varIdx, eqIdx, type, subset, subproblem], one
row per unknown. |
I |
The (sliced) incidence matrix of unknowns against equations. |
Isorted |
I reordered into block-lower-triangular form. |
Suppose the sliced incidence matrix of four unknowns against four
equations reorders (via orderIncidenceMatrix)
into the following block-lower-triangular pattern:
v1 v2 v3 v4
e1 [ 1 0 0 0 ] v1 alone -> explicit
e2 [ 1 1 1 0 ] ┐ v2,v3 both appear
e3 [ 0 1 1 0 ] ┘ in e2 and e3 -> 2x2 coupled block
e4 [ 0 0 0 1 ] v4 alone -> explicit
e1 involves only v1, so v1 is
solved explicitly. e2 and e3 both couple
v2 and v3, forming an irreducible 2×2 block
that must be solved together with a nonlinear solver. e4
involves only v4, solved explicitly and independently of
the rest. determineParallizedSolvingOrder encodes this
as
varIdx eqIdx type subset subproblem
1 1 1 1 1 % v1 : explicit, solved by e1
2 2 0 1 2 % v2 ┐ nonlinear subproblem
3 3 0 1 2 % v3 ┘ (e2,e3) solved together
4 4 1 2 3 % v4 : explicit, solved by e4
Reading the columns: type = 1 rows are solved
analytically one variable at a time; the two type = 0 rows
share subproblem = 2, so v2 and
v3 go to the nonlinear solver as one block. The
subset column marks parallelisable groups — v4
lands in subset = 2, meaning it is decoupled from the first
block and could be solved in parallel with it.
(If the coupled block turned out to be linear in its
unknowns, the tensor check would demote those rows to
type = -1.)
mdss · orderIncidenceMatrix
· incidenceMatrix
· msim
MyToolbox Documentation | Generated automatically by CI/CD pipeline