Tensor matrix multiply
版本 1.0.0.0 (2.6 KB) 作者:
Oliver Woodford
Matrix multiplication over tensor arrays (i.e. arrays of matrices), with matrix transposition.
C = tmult(A, B) is equivalent to:
sz = [size(B) 1];
sz(1) = size(A, 1);
C = zeros(sz);
for a = 1:prod(sz(3:end))
C(:,:,a) = A(:,:,a) * B(:,:,a);
end
but is completely vectorized, so much faster. Tmult also supports bsxfun-style expansion of singular dimensions where appropriate, such that tmult(rand(4, 3, 10), rand(3, 2)) yields a 4x2x10 output.
引用格式
Oliver Woodford (2024). Tensor matrix multiply (https://www.mathworks.com/matlabcentral/fileexchange/61754-tensor-matrix-multiply), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
创建方式
R14
兼容任何版本
平台兼容性
Windows macOS Linux类别
在 Help Center 和 MATLAB Answers 中查找有关 Operators and Elementary Operations 的更多信息
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0.0 |