Hello,
I'm having trouble to compute a summation with four indices. My code below is very time consuming. The problem is have to compute for every i,j,k,l the three smallest elements of A. Any other suggestions that run a bit faster than my code? (N is approximately 156)
sum = 0; for i=1:N for j=1:N for k=1:N for l=1:N A = [N-(i-1),N-(j-1),N-(k-1),N-(l-1)]; B = sort(A); sum = sum + B(1)*B(2)*B(3); end end end end
Thank you very much!
Best Answer