Faster submatrix selection
显示 更早的评论
Hi,
I've been trying to use mtimesx function for multidimensional multiplication to multiply M1*M2*.... A trial code for this is:
L=1000;
n=10;
a=rand(n,n,L);
for i=1:L
a(:,:,i)=expm(1i*(a(:,:,i)+a(:,:,i)')/2);
end
c=a;
while(L~=1)
L2=floor(L/2)*2;
d=c(:,:,end);
c = mtimesx(c(:,:,1:2:L2-1),c(:,:,2:2:L2));
if(L2~=L)
c(:,:,end+1) = d;
end
L=size(c,3);
end
It works quite well and gives a speed up when L is large but is slow when the dimension n is large. It seems to be due to finding the odd and even submatrices c(:,:,1:2:L2-1) and c(:,:,2:2:L2). Does anyones know how to speed up this process?
Thanks
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Correlation and Convolution 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!