Prev: technical help how to extract AVHRR NDVI values for points
Next: support vector machine number of features and samples
From: Marios Karaoulis on 13 May 2010 17:48 How can i optimize this triple for loop? num_mes=43; num_param=104; % pa and pm are a INTEGER matrices dimension 1Xnum_mes pa=[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,7,7,7,7,8,8,8,9,9,9;]; pm=[3,4,5,6,7,4,5,6,7,8,1,5,6,7,8,9,1,2,6,7,8,9,1,2,3,7,8,9,2,3,4,8,9,3,4,5,9,4,5,6,5,6,7;]; % icon is a INTEGER matrix in 3X2470 dimensions icon=randi([1 1303],3,2470); %aaa is a float matrix with 10X1303 dimensions aaa=rand([10,1303]); %x_flux y_flux is a float matrix with 10X2470 dimensions x_flux=rand([10,2470]); y_flux=rand([10,2470]); %width_param is a INTEGER mX1 matrix, that shows how many times the %internal loop must be calculated. width_param=randi([1 50],num_param,1); for mes=1:num_mes for m=1:num_param for k=1:width_param(m) l=param(m,k); a1=icon(1,l); a2=icon(2,l); a3=icon(3,l); area=area_elm(l); i=pa(mes); j=pm(mes); s1=aaa(i,a1)+aaa(i,a2)+aaa(i,a3); s2=aaa(j,a1)+aaa(j,a2)+aaa(j,a3); sum=2*(aaa(i,a1)*aaa(j,a1)+aaa(i,a2)*aaa(j,a2)+aaa(i,a3)*aaa(j,a3))+s1*s2; sum=area*sum*k_absc(kit)*k_absc(kit)/(12*prop(l)*prop(l)); jam=x_flux(i,l)*x_flux(j,l)+y_flux(i,l)*y_flux(j,l)+sum; jactmp=jactmp+jam; end trans_jac2(mes,m)=jactmp; jactmp=0; end end
From: Marios Karaoulis on 13 May 2010 18:02
also prop=rand([1,2470]); area_elm=rand([1,2470]); |