computeFunctionValue

Method of CPNTensor.

Unified CPN function-value primitive: evaluates any block of equations at an operating point.

Source: src/tensor/@CPNTensor/computeFunctionValue.m

Syntax

f = obj.computeFunctionValue(sys, v)
f = obj.computeFunctionValue(sys, v, equationRows, columnIndex)
f = obj.computeFunctionValue(sys, v, equationRows, columnIndex, mode)

Description

computeFunctionValue evaluates the multilinear function stored in the tensor at the full signal vector v and returns the values of the selected equations,

f=Φ(equationRows,columnIndex)m(S(:,columnIndex),v), f = \Phi(\text{equationRows},\text{columnIndex}) \; m\bigl(S(:,\text{columnIndex}), v\bigr),

where mm is the vector of monomial column products and Φ\Phi the parameter matrix.

The per-factor formula — True v\to v, False 1v\to 1-v, Continuous ccv+(1|c|)(1bv)c \to c\,v + (1-|c|)(1-b\,v) — is selected by b=b=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.

Modes

mode chooses how the parameter matrix is applied. Both settings give identical results and differ only in where the work happens:

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.

Input arguments

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 arguments

Output Description
f Values of the selected equations at v, one entry per entry of equationRows.

Example

%      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 only

See also

CPNTensor · computeJacobian · jacobian · sliceTensor · mss · mdss


MyToolbox Documentation | Generated automatically by CI/CD pipeline