From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Can this run any faster?
Date: Thu, 11 Apr 2013 17:08:07 +0000 (UTC)
Organization: Seagate Technology
Lines: 18
Message-ID: <kk6qln$c62$>
References: <kk24q4$3j5$> <kk5unh$gc1$> <kk6gdl$8jp$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1365700087 12482 (11 Apr 2013 17:08:07 GMT)
NNTP-Posting-Date: Thu, 11 Apr 2013 17:08:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3865886
Xref: comp.soft-sys.matlab:793293

"Yair Altman" wrote in message <kk6gdl$8jp$>...
> "Heinrich Acker" wrote in message <kk5unh$gc1$>...
> [snip]
> > My experience is that using inf or nan can slow down calculations significantly. I didn't try your code, nor did I try it recently on one of my programs, but since that discovery I went back to the old practice to use an extremly large value instead of inf. It is not always possible, but in many algorithms you will know a finite value that is larger than all finite values that can appear in that place, e.g. 1e99. So the suggestion is to use this value as a metaphor for inf, even if this seems to be less refined.
> > 
> > Of course, the result depends on the architecture of the system you are using. It may not help on your system at all. Your disappointing result when mexing the function is an indicator of an inf or nan speed problem, though. When I came across it, I briefly googled the problem and found out that some architectures raise an execption to process inf or nan, instead of producing an IEEE754 result directly by the FPU.
> > 
> > Heinrich
> I do not know which platform/ML release you are using Heinrich, but at least on Windows R2013a your statement seems to be incorrect. See below:
> Yair Altman

In my experience what Heinrich said can definitely be true - if you're talking about denormalized numbers, not inf/nans. Although it might be math on denorms I'm thinking about, and not necessarily conditionals.