Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Can this run any faster?
Replies: 36   Last Post: May 9, 2013 12:04 PM

 Messages: [ Previous | Next ]
 Elnaz Sadeghian Posts: 206 From: Tehran, Iran Registered: 5/26/07
Re: Can this run any faster?
Posted: Apr 10, 2013 3:29 PM

Thanks Roger; that is a clever substitute. It runs 0.01 second faster than the original one.

Steve:
The code above is an excerpt of BCJR algorithm. It is the forward recursion part which sweeps over the trellis structure from the beginning to the end in forward direction.
It is difficult to explain in words what that excerpt is trying to do for the general audience since it requires a lot of backgroun math to set the scene.

I have another loop similar to the first one which is a backward recursion. It starts from the end working its way to the beginning:

% Backwards recursion
b=zeros(16,length);
b=b-inf;
b(1,length)=0;
for i= length-1:-1:1
for j= 1:32
A = b(transitions(j,1),i);
B = b(transitions(j,2),i+1) + ug (j, i+1) + eg(j, i+1);
if(A == -inf && B == -inf)
b(transitions(j,1),i) = -inf;
else
b(transitions(j,1),i)= max(A,B) + log(1+exp(-abs(A-B)));
end
end
end

If I apply Roger's idea I get 0.02 sec improvement in one calling. However, the main problem that costs time here is the big length of the signal (the variable i here).
But thanks Roger, that was clever.

Date Subject Author
4/10/13 Roger Stafford
4/10/13 dpb
4/10/13 Roger Stafford
4/10/13 Bruno Luong
4/10/13 EBS
4/10/13 Bruno Luong
4/10/13 Bruno Luong
4/11/13 Bruno Luong
4/11/13 Bruno Luong
4/10/13 Steven Lord
4/10/13 Bruno Luong
4/11/13 Robert Miethe
4/11/13 Yair Altman
4/11/13 EBS
4/11/13 Bruno Luong
4/11/13 Steven Lord
4/11/13 Bruno Luong
4/11/13 Bruno Luong
4/11/13 Steven Lord
4/12/13 Roger Stafford
4/12/13 Bruno Luong
4/12/13 Roger Stafford
4/13/13 Bruno Luong
4/13/13 Bruno Luong
4/13/13 Bruno Luong
4/13/13 Bruno Luong
4/13/13 Bruno Luong
4/14/13 Roger Stafford
4/14/13 Bruno Luong