Sam T
unread,Jul 28, 2012, 1:49:36 AM7/28/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi,
I have been trying to use MTIMESX code to multiply two big n-dimensional matrices (A = 2500x2500x2500 and B = 2500x400) in a loop. But for simplistic purposes, consider the following example:
A = 3 x 3 x 3
B = 3 x 2
and C = A*B;
The multiplication A*B is such that dimension of C = 3 x 3 x 2
where C(i, j, l) = A(i, j, k) * B(k, l);
i.e.
C(:, :, 1) = A(:, :, k) * B(k, 1);
C(:, :, 2) = A(:, :, k) * B(k, 2);
Now, if I use mtimesx(A, B), then resultant matrix is (3 x 2 x 3) as compared (3 x 3 x 2).
This is because first two dimensions specify the matrix multiply involved. In this case it becomes 1st and 2nd dimension of matrix A while it should ideally be 2nd and 3rd dimension of matrix A to get the desired result.
I am wondering if there is a way around it? I look forward to hearing from you.
Thanks for your help.