mytensorprod
Version 1.0.3 (2 KB) by
yi yang
Tensor products between two tensors. It supports GPU computing
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;
Cite As
yi yang (2026). mytensorprod (https://uk.mathworks.com/matlabcentral/fileexchange/116860-mytensorprod), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2022a
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.3 | The built-in function "tensorprod" also supports GPU computing starting from MATLAB 2023a. If you have MATLAB 2023a or later version, please use "tensorprod" instead of "mytensorprod". |
||
| 1.0.2 | Fix the bug if A or B is a vector |
||
| 1.0.1 | Summary changed |
||
| 1.0.0 |
