I have a loop that looks like:
for t=1:size(datesdaily1,1)for i=1:size(secids,1) for j=1:size(secids,1) if not(isnan(weig1(t,i)*weig1(t,j)*rho(i,j)*sqrt(Rates(t,i)*Rates(t,j)))) numerator=numerator + weig1(t,i)*weig1(t,j)*rho(i,j)*sqrt(Rates(t,i)*Rates(t,j)); denominator=denominator+ weig1(t,i)*weig1(t,j)*(1-rho(i,j))*sqrt(Rates(t,i)*Rates(t,j)); end endendend
It takes a lot of time to run… is there anyway to increase efficiency? (maybe avoiding loops?)
Thanks, V
Best Answer