
Can this run any faster?
Posted:
Apr 9, 2013 6:30 PM


Hi all, Is there any way to make this excerpt of the code run faster? In my script I call the function including this loop many times and "length" is in the order of 30K or more. "transitions" is a stored 32 by 4 matrix. I have turned that function into C and am using it as a mex file but it's still prohibitively slow. Using tictoc I see that this loop is the most time consuming loop in that function. Is there anyway to make this run faster?
a=zeros(16,length); a=ainf; a(1,1)=0; for i= 2:length for j= 1:32 A = a(transitions(j,2),i); B = a(transitions(j,1),i1) + ug(j, i1) + eg(j, i1); if(A == inf && B == inf) a(transitions(j,2),i) = inf; else a(transitions(j,2),i) = max(A,B) + log(1+exp(abs(AB))); end end end
Thanks, Elnaz

