tensorproduct - Multiplication of multidimensional arrays
Implementation of Einstein summation convention for multidimensional matlab arrays, where repeated indices sum over.
Supports multiple:
- Outer products
- Inner products
- Singleton dimensions
- Pages
Example:
A = rand(5, 1,4,8); B = rand(4,10,5 ); R = tensorproduct('jzgi',A,'gxki',B,'kjg');
Outer: 'i','j', Inner: 'k', Page: 'g', Singleton: 'x','z', size(R) = [10,1,5,8].
Inputs:
- ind_R : string with indices of the output
- A : (non-empty) (multidimensional) matlab array
- ind_A : string with indices of array A
- B : (non-empty) (multidimensional) matlab array
- ind_B : string with indices of array B
Version compatibility: This implementation makes use of Matlab built-in function pagemtimes,
introduced in Matlab version R2020b. To make use of this implementation in previous Matlab releases, comment/uncomment few lines in the body of tensorproduct_core, as specified in the routine.
The performance of tensorproduct can be assessed by calling the function tensorproduct_benchmark.
引用格式
David Codony (2024). tensorproduct - Multiplication of multidimensional arrays (https://www.mathworks.com/matlabcentral/fileexchange/90586-tensorproduct-multiplication-of-multidimensional-arrays), MATLAB Central File Exchange. 检索来源 .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!