Tensor matrix multiply

Matrix multiplication over tensor arrays (i.e. arrays of matrices), with matrix transposition.

Vous suivez désormais cette soumission

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.

Citation pour cette source

Oliver Woodford (2026). Tensor matrix multiply (https://fr.mathworks.com/matlabcentral/fileexchange/61754-tensor-matrix-multiply), MATLAB Central File Exchange. Extrait(e) le .

Catégories

En savoir plus sur Operators and Elementary Operations dans Help Center et MATLAB Answers

Informations générales

Compatibilité avec les versions de MATLAB

  • Compatible avec toutes les versions

Plateformes compatibles

  • Windows
  • macOS
  • Linux
Version Publié le Notes de version Action
1.0.0.0