Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Elnaz Sadeghian

Posts: 169
From: Tehran, Iran
Registered: 5/26/07
Can this run any faster?
Posted: Apr 9, 2013 6:30 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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 tic-toc 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=a-inf;
a(1,1)=0;
for i= 2:length
for j= 1:32
A = a(transitions(j,2),i);
B = a(transitions(j,1),i-1) + ug(j, i-1) + eg(j, i-1);
if(A == -inf && B == -inf)
a(transitions(j,2),i) = -inf;
else
a(transitions(j,2),i) = max(A,B) + log(1+exp(-abs(A-B)));
end
end
end

Thanks,
Elnaz


Date Subject Author
4/9/13
Read Can this run any faster?
Elnaz Sadeghian
4/10/13
Read Re: Can this run any faster?
Roger Stafford
4/10/13
Read Re: Can this run any faster?
dpb
4/10/13
Read Re: Can this run any faster?
Roger Stafford
4/10/13
Read Re: Can this run any faster?
Elnaz Sadeghian
4/10/13
Read Re: Can this run any faster?
Elnaz Sadeghian
4/10/13
Read Re: Can this run any faster?
Bruno Luong
4/10/13
Read Re: Can this run any faster?
Elnaz Sadeghian
4/10/13
Read Re: Can this run any faster?
EBS
4/10/13
Read Re: Can this run any faster?
Bruno Luong
4/10/13
Read Re: Can this run any faster?
Bruno Luong
4/11/13
Read Re: Can this run any faster?
Bruno Luong
4/11/13
Read Re: Can this run any faster?
Bruno Luong
4/10/13
Read Re: Can this run any faster?
Steven Lord
4/10/13
Read Re: Can this run any faster?
Bruno Luong
4/11/13
Read Re: Can this run any faster?
Robert Miethe
4/11/13
Read Re: Can this run any faster?
Yair Altman
4/11/13
Read Re: Can this run any faster?
EBS
4/11/13
Read Re: Can this run any faster?
Bruno Luong
4/11/13
Read Re: Can this run any faster?
Steven Lord
4/11/13
Read Re: Can this run any faster?
Bruno Luong
4/11/13
Read Re: Can this run any faster?
Bruno Luong
4/11/13
Read Re: Can this run any faster?
Steven Lord
4/12/13
Read Re: Can this run any faster?
Roger Stafford
4/12/13
Read Re: Can this run any faster?
Bruno Luong
4/12/13
Read Re: Can this run any faster?
Roger Stafford
4/13/13
Read Re: Can this run any faster?
Bruno Luong
4/13/13
Read Re: Can this run any faster?
Bruno Luong
4/13/13
Read Re: Can this run any faster?
Bruno Luong
4/13/13
Read Re: Can this run any faster?
Bruno Luong
4/13/13
Read Re: Can this run any faster?
Bruno Luong
4/14/13
Read Re: Can this run any faster?
Roger Stafford
4/14/13
Read Re: Can this run any faster?
Bruno Luong
5/8/13
Read Re: Can this run any faster?
Elnaz Sadeghian
5/8/13
Read Re: Can this run any faster?
Marc
5/9/13
Read Re: Can this run any faster?
Bruno Luong
5/9/13
Read Re: Can this run any faster?
Elnaz Sadeghian

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.