tensorproduct - Multiplication of multidimensional arrays

版本 1.0.1 (5.8 KB) 作者: David Codony
Product of multidimensional matlab arrays following Einstein summation convention, where repeated indices sum over
96.0 次下载
更新时间 2021/4/16

查看许可证

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 版本兼容性
创建方式 R2021a
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.1

All .m files published

1.0.0