How to operate with multidimensional arrays (Einstein summation)?
Afficher commentaires plus anciens
Let's imagine that I have an array of dimension 4 (A_ijkl) that I want to multiply with an array of dimension 2 (B_kl) to obtain an array of dimension 2 (C_ij; i.e., summing over indices k and l). What could be the most efficient (and clean) manner of doing so in Matlab?
And let's go one step further, what if we want to do C_ijxy=A_ijklxy * B_klxy ?
Thank you
Réponse acceptée
Plus de réponses (1)
Chern Hui Lee
le 4 Avr 2025
0 votes
For future reference, there is a function tensorprod available since R2022a that does exactly this.
https://www.mathworks.com/help/matlab/ref/tensorprod.html
Catégories
En savoir plus sur Fractals dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!