How to efficiently do matrix multiplication for 2 specific dimensions of the tensor?
5 visualizzazioni (ultimi 30 giorni)
I have a rank-5 tensor A and a rank-2 matrix B, and I want to captured the first two dimentions of A as slices and do the mutiplication with B to form an output C.
I can do it as below by using 3 for loops. But that is not efficient. How can I do it vectorizedly (i.e. without using the for loops)?
My current code
C=zeros(7,4,8,2,14); % (7, 4) is due to matrix mutiplication of (7, 3)x(3, 4)
C % the output I want
James Tursa il 20 Nov 2019
Some FEX options that might work for you (some require an installed C compiler):