How to efficiently do matrix multiplication for 2 specific dimensions of the tensor?
조회 수: 3(최근 30일)
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 2019년 11월 20일
Some FEX options that might work for you (some require an installed C compiler):