Method of CPNTensor.
Unified CPN function-value primitive: evaluates any block of equations at an operating point.
Source: src/tensor/@CPNTensor/computeFunctionValue.m
f = obj.computeFunctionValue(sys, v)
f = obj.computeFunctionValue(sys, v, equationRows, columnIndex)
f = obj.computeFunctionValue(sys, v, equationRows, columnIndex, mode)computeFunctionValue evaluates the multilinear function
stored in the tensor at the full signal vector v and
returns the values of the selected equations,
where is the vector of monomial column products and the parameter matrix.
The per-factor formula — True
,
False
,
Continuous
— is selected by
sys.mtiBase,
monomial or literal; see CPNTensor and mss.
The tensor is read from sys.mtiTensor. v
must be in structure-matrix row order, that is, already
scattered through the owning model’s index vectors; assembling it is the
caller’s job.
Evaluation is delegated to the MTISIM kernel. The tensor is first
compiled by prepareForMTISIM, which bakes
sys.mtiBase into its output, so the kernel itself is
base-agnostic.
mode chooses how the parameter matrix
is applied. Both settings give identical results and differ only in
where the work happens:
"scatter" (default) passes
straight into MTISIM, which scatters the column products through it in
one call — no external sparse mat-vec."passthrough" has MTISIM return the raw column products
and applies
afterwards in MATLAB.Both handle non-square blocks: the output row count is decoupled from
the [x; u] split, and the whole signal vector is passed as
one block with no separate inputs. An unrecognised mode raises
CPNTensor:computeFunctionValue:mode.
| Argument | Description |
|---|---|
obj |
CPNTensor.
Ignored — the tensor is taken from sys.mtiTensor. |
sys |
Owning mss or mdss model. Supplies
mtiTensor and mtiBase. |
v |
Full signal vector in structure-matrix row order, assembled by the caller. |
equationRows |
Parameter-matrix rows to return. Default: all equations. |
columnIndex |
Monomial columns to evaluate. Default: all columns. |
mode |
"scatter" (default) or "passthrough". |
Empty ([]) is accepted for equationRows,
columnIndex and mode, and selects that
argument’s default.
| Output | Description |
|---|---|
f |
Values of the selected equations at v, one entry per
entry of equationRows. |
% x1 x2 x1x2
S = [ 1 0 1 % x1
0 1 1 ]; % x2
P = [ -10 10 0 % dx1 = -10*x1 + 10*x2
0 0 1 ]; % dx2 = x1*x2
T = CPNTensor(S,P);
sys = mss(T, uint32([1;2]), uint32(zeros(0,1)), 0, ...
uint32([1;2]), uint32(zeros(0,1)));
v = [0.3; 0.7];
T.computeFunctionValue(sys, v) % [4; 0.21]
T.computeFunctionValue(sys, v, 2, 3) % 0.21 - second equation onlyCPNTensor · computeJacobian
· jacobian
· sliceTensor
· mss · mdss
MyToolbox Documentation | Generated automatically by CI/CD pipeline