Cumulative 2x2 Complex Matrix Multiplication
Version 1.1.0.0 (1.7 KB) by
Nicolas Ayotte
This takes a 2x2xm matrix and calculates the cumulative matrix multiplication along the 3rd diim.
This function calculates the cumulative matrix multiplication of input complex matrices A(2,2,m)
This function should be compiled using the Maltab Mex function.
m = 1000; % number of matrices
A = rand(2,2,m) + 1i * rand(2,2,m); % Example matrix;
B = cM(A); % B is a 2x2 matrix
This function is up to 180 times faster that the equivalent for loop.
B = eye(2);
for ii = 1 : 1000
B = B * A(:,:,ii);
end
Cite As
Nicolas Ayotte (2026). Cumulative 2x2 Complex Matrix Multiplication (https://uk.mathworks.com/matlabcentral/fileexchange/45651-cumulative-2x2-complex-matrix-multiplication), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2013a
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Creating and Concatenating Matrices in Help Center and MATLAB Answers
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
