Norm-1 canonical-polyadic (CPN) tensor container for multilinear MTI models.
Source: src/tensor/@CPNTensor/CPNTensor.m
CPNTensor is the default mtiTensor used by mss and mdss models. It stores a
multilinear model as a sum of rank-1 product terms in reduced norm-1
canonical-polyadic form, keeping the underlying matrices sparse.
A CPNTensor stores the parameter tensor of a multilinear
time-invariant (MTI) model in a sparse canonical polyadic normalized
(CPN) representation. In CPN representation, the multilinear vector
function
of an MTI model with signals
is evaluated as sums of products
The structure matrix
selects which signals enter each product term. The parameter
matrix
hold the weight of the terms; entry
is the coefficient of term
in equation
.
The structure of the product term changes with the model base
,
more details in mss and here.
Internally CPNTensor never stores
and
as single dense matrices. Each is split by value into three sparse
components so that the common
entries are held as logical masks:
Structure matrix (, rows = signals, columns = product terms)
| Component | Meaning | Factor contributed |
|---|---|---|
structureMatrixTrue |
signal enters directly | |
structureMatrixFalse |
signal enters complemented | |
structureMatrixContinuous |
complete product term |
Parameter matrix (, rows = equations, columns = product terms)
| Component | Meaning |
|---|---|
parameterMatrixOne |
coefficient |
parameterMatrixMinusOne |
coefficient |
parameterMatrixContinuous |
general weight |
The three structure components must have disjoint support: every (row, column) entry is sourced from at most one of True / False / Continuous. This is checked at construction, which errors with the offending (row, column) positions if the supports overlap.
The most common form passes a single signed structure
matrix and a single signed parameter matrix;
CPNTensor splits each into its three components
automatically. Structure entries equal to
become structureMatrixTrue and all other entries go to
structureMatrixContinuous; parameter entries equal to
and
become parameterMatrixOne /
parameterMatrixMinusOne and the rest go to
parameterMatrixContinuous.
Take the state equations of the SprottΒ B attractor . With signals ordered :
a = 0.4; b = 1.2; c = 1;
% xp1 xp2 xp3 x2x3 x1 x2 const x1x2
structureMatrix = [ 1 0 0 0 0 0 0 0 ; % xp1
0 1 0 0 0 0 0 0 ; % xp2
0 0 1 0 0 0 0 0 ; % xp3
0 0 0 0 1 0 0 1 ; % x1
0 0 0 1 0 1 0 1 ; % x2
0 0 0 1 0 0 0 0 ]; % x3
parameterMatrix = [-1 0 0 a 0 0 0 0 ; % eq1
0 -1 0 0 1 -b 0 0 ; % eq2
0 0 -1 0 0 0 c -1 ]; % eq3
T = CPNTensor(structureMatrix, parameterMatrix);
T.R % tensor rank = number of monomial columns = 8| Syntax | Result |
|---|---|
T = CPNTensor() |
Empty tensor. |
T = CPNTensor(structureMatrix, parameterMatrix) |
Split both signed matrices into True/False/Continuous and One/MinusOne/Continuous components. Both arguments are required. |
T = CPNTensor(structureMatrixTrue, structureMatrixFalse, structureMatrixContinuous, parameterMatrixOne, parameterMatrixMinusOne, parameterMatrixContinuous) |
Set all six sparse components directly. All six arguments are required. |
T = CPNTensor(Name, Value, ...) |
Nameβvalue form; give
structureMatrix/parameterMatrix and/or the
split component names. |
The static factory methods fromRawMatrices
and fromSparseComponents
provide the same two construction routes with explicit nameβvalue
arguments.
| Property | Description |
|---|---|
structureMatrixTrue |
Sparse logical mask of monomial factors . |
structureMatrixFalse |
Sparse logical mask of complemented factors . |
structureMatrixContinuous |
Sparse weights for general factors . |
parameterMatrixOne |
Sparse logical mask of coefficient . |
parameterMatrixMinusOne |
Sparse logical mask of coefficient . |
parameterMatrixContinuous |
Sparse remaining coefficient values. |
R (read-only) |
Tensor rank = number of monomial columns of the structure matrix. |
| Method | Purpose |
|---|---|
fromRawMatrices |
Static factory from a signed structure and/or parameter matrix. |
fromSparseComponents |
Static factory from the six split components. |
trueFalseStructure |
Split a signed structure matrix into True/False/Continuous. |
trueFalseParameter |
Split a signed parameter matrix into One/MinusOne/Continuous. |
updateRank |
Refresh R from the current structure matrix. |
computeIncidenceMatrix |
Structural incidence of equations vs.Β signals. |
computeJacobian |
Jacobian of the equation system at an operating point. |
computeFunctionValue |
Evaluate the equation system at a point. |
sliceTensor |
Extract a subset of rows/monomials. |
The model base is not stored in the
CPNTensor β it is the mss property
mtiBase (0 = monomial, 1 =
literal) which is automatically accounted for when simulating with msim and is otherwise
passed as a flag to the evaluation methods (e.g.Β computeFunctionValue
and computeJacobian).
For mdss models,
currently only monomial base is supported.
The True and False factors evaluate identical in both bases; only the continuous factor differs:
| factor | monomial base (mtiBase = 0) |
literal base (mtiBase = 1) |
|---|---|---|
| True | ||
| False | ||
| Continuous |
So the same stored CPNTensor evaluates
to different numbers depending on the base the model hands to the
evaluation method. This is why the construction and storage methods on
this page β fromRawMatrices,
fromSparseComponents,
trueFalseStructure,
trueFalseParameter,
updateRank
β do not mention the base: they only split and hold the matrices and are
base-independent. The base enters solely when the tensor is
evaluated.
mtiTensor Β· mdss Β· mss Β· TTTensor
MyToolbox Documentation | Generated automatically by CI/CD pipeline