Method of CPNTensor.
Sub-tensor of a normalized CP tensor, sliced by equation (row) and rank (column).
Source: src/tensor/@CPNTensor/sliceTensor.m
sub = obj.sliceTensor()
sub = obj.sliceTensor(equationIndex)
sub = obj.sliceTensor(equationIndex, columnIndex)sliceTensor returns a CPNTensor holding
only the selected equations and rank-1 terms. Both slicing axes preserve
the CPN form — dropping parameter-matrix rows drops whole equations, and
dropping columns drops whole rank-1 terms — so the result is a valid
smaller tensor that can be evaluated or differentiated on its own, and
is mathematically equivalent to the corresponding sub-block of the
original.
The intended use is to build the slice once and
reuse it across operating points, rather than re-slicing on every
evaluation. jacobian uses
it exactly this way, folding its equation and column selection into a
slice before calling computeJacobian.
When columnIndex is omitted, the columns are inferred:
only the rank-1 terms that the selected equations actually reference are
kept, since terms with no weight in any selected equation contribute
nothing. Restricting equationIndex alone therefore already
narrows the tensor on both axes.
Structure-matrix rows are never dropped, even for
signals that no surviving monomial reads. This is deliberate: the row
space is the signal space, so keeping it intact means v and
variableIndex still index the full signal vector
downstream, and no re-mapping is needed between the slice and its
parent.
There is, correspondingly, no variable axis on this
method. Selecting variables is a selection on the columns of the
Jacobian, not a sub-tensor: dropping structure-matrix rows would
silently corrupt the factor products of every monomial that reads those
signals. Use jacobian’s variableIndex, which
post-slices the result columns, instead.
| Argument | Description |
|---|---|
obj |
CPNTensor to slice. |
equationIndex |
(default []) Parameter-matrix rows to keep.
Empty means all equations. |
columnIndex |
(default []) Rank-1 columns to keep. Empty
means only the columns the selected equations use. |
| Output | Description |
|---|---|
sub |
CPNTensor with the selected equations and rank terms,
and all structure-matrix rows retained. |
% 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);
whole = T.sliceTensor(); % 2 equations, R = 3
eq2 = T.sliceTensor(2); % 1 equation, R = 1 - only the x1x2 term
size(eq2.structureMatrixTrue,1) % 2 - both signal rows keptCPNTensor · jacobian · computeJacobian
· computeFunctionValue
· fromSparseComponents
MyToolbox Documentation | Generated automatically by CI/CD pipeline