If you dont want to use slow for loops to apply a matrix multiplication between two n-dimensional matices, this submission could be helpful. Unfortunately, singelton expansion is not supported. Thus it is required that boths inputs are the same size.
Input 1: n-by-m-by-... Matrix
Input 2: m-by-p-by-... Matrix.
Output: n-by-p-by-... Matrix.
Vincent Wilms (2022). Vectorized 2-dimensional multiplication of multidimensional matrices (https://www.mathworks.com/matlabcentral/fileexchange/53459-vectorized-2-dimensional-multiplication-of-multidimensional-matrices), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!