Hi,
I have the following loop that is called lots of times within a function and is slowing down considerably
n=200;F1=rand(n,4);F2=rand(n,4);dRad_dt=zeros(n,4)for i=1:4 for j=1:n for k=1:n if j+k<=n dRad_dt(j+k,i)=dRad_dt(j+k,i)+F1(j,i)*F2(k,i); end end endend
Any clues on how to vectorize this code or speed up considerably would be greatly appreciated
Best Answer