Method of CPNTensor.
Core method for computing the Jacobian matrix of a CPN tensor.
Source: src/tensor/@CPNTensor/computeJacobian.m
jacobianMatrix = computeJacobian(obj,v,mtiBase)
[jacobianMatrix,jacobianFunctionHandle] = computeJacobian(obj,v,mtiBase)The computeJacobian is the core function called by all
jacobian-instances using a CPN tensor. It computes the
partial derivatives with respect to all variables
as follows:
where is the operating point.
Each equation in the vector function behind the CPN tensor of rank can be written as
mtiBasemtiBase selects the multilinear basis, and it
reinterprets only the continuous structure entries
().
The True and False channels are identical in
both bases:
| Channel | Factor | Slope |
|---|---|---|
True
() |
||
False
() |
||
continuous, monomial (mtiBase=0) |
||
continuous, literal (mtiBase=1) |
Both bases share the same intercept and differ only in the slope. Consequently the Jacobian of one and the same CPN tensor is base dependent.
For , and the same tensor gives
mtiBase |
represented function | |
|---|---|---|
0 (monomial) |
||
1 (literal) |
In the literal base is the donβt-care, so drops out of the function entirely.
For more information on the computation of the Jacobian matrix of a continuous-valued CPN tensor, see [1].
| Argument | Type | Description |
|---|---|---|
obj |
CPNTensor | A CPN tensor object. |
v |
double | Vector containing the operating point or a vector of variables. |
mtiBase |
Boolean | Base of MTI model (monomial: mtiBase=false, literal: mtiBase=true) |
| Argument | Type | Description |
|---|---|---|
jacobianMatrix |
double | Sparse Jacobian matrix, where the rows correspond to the last mode of the CPN tensor, typically corresponding to the equation, and the columns correspond to the variables. No reordering is performed. |
jacobianFunctionHandle |
function_handle | Function handle to get the sparse Jacobian matrix for different operating points. |
Consider the following continuous-valued example with three variables
In this case, the multilinear basis is the monomial tensor. We want to evaluate the CPN tensor of the above set of equations at the point .
% constructing the CPN tensor
structureMatrix=[0.5 -0.5;
1 0;
0 1];
mtiBase=0;
parameterMatrix=[2 0;
4 6;
0 8];
T= CPNTensor(structureMatrix,parameterMatrix);
% generating the operating point of the variables
v_op=[-1;1;3];
% compute Jacobian matrix
jacobianMatrix=computeJacobian(T,v_op, mtiBase);The result gives Jacobian matrix
Alternatively, the Jacobian could be evaluated at different operating points, which can be achieved by creating a function handle. Consider the function:
The multilinear base is a monomial base.
% Create the CPN tensor
structureMatrix = [-1/2;
1/3];
mtiBase=0;
parameterMatrix = [ 6 ];
T = CPNTensor(structureMatrix,parameterMatrix);
% development point
v0 = [1; 1];
% function handle is the second output argument
[~,jacobinaFunctionHandle] = computeJacobian(T,v0,mtiBase);
J=jacobinaFunctionHandle(v0);The result is the Jacobian matrix:
Consider the following example
which uses a literal basis.
structureMatrix = [-0.5;
0.3];
mtiBase=1;% literal base
parameterMatrix = [ 1 ];
T = CPNTensor(structureMatrix,parameterMatrix); % Generate the CPN tensor
v0 = [1; 1]; % development point
J = round(computeJacobian(T,v0,mtiBase),4); The result is the Jacobian matrix:
### References
[1] Christoph Kaufmann, Diego CrespΓ de Valldaura Garcia, Gerwald Lichtenberg, Georg Pangalos, Carlos Cateriano YÑñez, βEfficient Linearization of Explicit Multilinear Systems using Normalized Decomposed Tensorsβ, IFAC-PapersOnLine, Volume 56, Issue 2, 2023, Pages 7312-7317, ISSN 2405-8963, https://doi.org/10.1016/j.ifacol.2023.10.344
jacobian | mss/stateJacobian | mss/outputJacobian | mdss/jacobian
MyToolbox Documentation | Generated automatically by CI/CD pipeline