C = mytensorprod(A,B,dimA,dimB) returns the tensor product of tensors A and B. The arguments dimA and dimB are vectors that specify which dimensions to contract in A and B. The size of the output tensor is the size of the uncontracted dimensions of A followed by the size of the uncontracted dimensions of B.
C = mytensorprod(A,B) returns the outer product between tensors A and B. This syntax is equivalent to using one of the previous syntaxes with dimA = dimB = [] or dim = []. The size of the output tensor is [size(A) size(B)].
C = mytensorprod(A,B,"all") returns the inner product between tensors A and B, which must be the same size. The output is a scalar.
mytensorprod is very similar to the built-in function tensorprod introduced in R2022a.
The differences are:
mytensorprod does not support singletons;
引用格式
yi yang (2024). mytensorprod (https://www.mathworks.com/matlabcentral/fileexchange/116860-mytensorprod), MATLAB Central File Exchange. 检索来源 .
MATLAB 版本兼容性
创建方式
R2022a
兼容任何版本
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!