comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Sky is falling, maybe?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Sky is falling, maybe? [message #68226] Thu, 08 October 2009 13:21
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Jean H. wrote:
> Lasse Clausen wrote:
>
>> I see a distinct difference in the SMOOTH output after the very uppy-
>> downy bit of the data. It seems the documentation should be changed
>> from
>
> Hi,
>
> I don't see any difference here...
>
> IDL> print, !version
> { x86 Win32 Windows Microsoft Windows 7.0.8 Feb 9 2009 32 64}
>
> Jean

IDL> a=smooth(power, 12)
IDL> b=smooth(power, 12, /nan)
IDL> print, where(a-b ne 0)
-1

...and power,a and b are still floats!

Jean
Re: Sky is falling, maybe? [message #68228 is a reply to message #68226] Thu, 08 October 2009 13:01 Go to previous message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
On Thu, 8 Oct 2009, JohnSmith wrote:

>
> "Jean H." <jghasban@DELTHIS.ucalgary.ANDTHIS.ca> wrote in message
> news:haldn9$lr4$1@news.ucalgary.ca...
>> Lasse Clausen wrote:
>>
>>> I see a distinct difference in the SMOOTH output after the very uppy-
>>> downy bit of the data. It seems the documentation should be changed
>>> from
>>
>> Hi,
>>
>> I don't see any difference here...
>>
>> IDL> print, !version
>> { x86 Win32 Windows Microsoft Windows 7.0.8 Feb 9 2009 32 64}
>>
>> Jean
>
> I did, which seems odd:
>
> IDL> print,!version
> { x86_64 Win32 Windows Microsoft Windows 7.1 Apr 21 2009 64 64}
>

The x86 version uses the x87 FPU (80 bit internally), while the x86_64
version probably uses the SSE/SSE2 FPU unit (strictly 64 bit). This may
create different result (the sky is falling, again :-)

regards,
lajos
Re: Sky is falling, maybe? [message #68229 is a reply to message #68228] Thu, 08 October 2009 12:50 Go to previous message
JohnSmith is currently offline  JohnSmith
Messages: 4
Registered: September 2009
Junior Member
"Jean H." <jghasban@DELTHIS.ucalgary.ANDTHIS.ca> wrote in message
news:haldn9$lr4$1@news.ucalgary.ca...
> Lasse Clausen wrote:
>
>> I see a distinct difference in the SMOOTH output after the very uppy-
>> downy bit of the data. It seems the documentation should be changed
>> from
>
> Hi,
>
> I don't see any difference here...
>
> IDL> print, !version
> { x86 Win32 Windows Microsoft Windows 7.0.8 Feb 9 2009 32 64}
>
> Jean

I did, which seems odd:

IDL> print,!version
{ x86_64 Win32 Windows Microsoft Windows 7.1 Apr 21 2009 64 64}
Re: Sky is falling, maybe? [message #68230 is a reply to message #68229] Thu, 08 October 2009 12:14 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Lasse Clausen wrote:

> I see a distinct difference in the SMOOTH output after the very uppy-
> downy bit of the data. It seems the documentation should be changed
> from

Hi,

I don't see any difference here...

IDL> print, !version
{ x86 Win32 Windows Microsoft Windows 7.0.8 Feb 9 2009 32 64}

Jean
Re: Sky is falling, maybe? [message #68231 is a reply to message #68230] Thu, 08 October 2009 12:11 Go to previous message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
On Thu, 8 Oct 2009, Lasse Clausen wrote:

> I find the following odd but maybe the sky is just falling and one of
> you guys can explain why this happens. Try running
>
> power = randomu(1001, 150)
> power[77+lindgen(10)*3] = 1e+7
> help, where(~finite(power))
> plot, power, yrange=[.1, 10]
> loadct, 12
> oplot, smooth(power, 12, /nan), thick=3, color=20
> oplot, smooth(power, 12), thick=3, color=120
> end
>
> On my machine
>
> IDL> print, !version
> { x86_64 linux unix linux 7.0 Oct 25 2007 64 64}
>
> I see a distinct difference in the SMOOTH output after the very uppy-
> downy bit of the data. It seems the documentation should be changed
> from
>
> SMOOTH should never be called without the NAN keyword if the input
> array may possibly contain NaN values.
>
> to
>
> SMOOTH should never be called without the NAN. Period.
>
> Again, maybe I'm missing something but the SMOOTH function seems like
> a pretty straight forward piece of code - without ever having seen it,
> of course - that leaves very little room for error. But by the same
> token we all know that "Every program has at least one bug and can be
> shortened by at least one instruction - from which, by induction - it
> can be shown that every program can be reduced to one instruction that
> doesn't work".
>
> So long
> Lasse
>

Yes, the sky is falling, again :-) Try with 'power=double(power)' and the
difference will disappear (randomu and 1e7 are too far apart for float).

smooth(...) and smooth(..., /nan) use different algorithms. The previous
one uses a sliding window, while the other does not (the sliding window
would give all NaNs after the first NaN).

regards,
lajos
Re: Sky is falling, maybe? [message #68232 is a reply to message #68231] Thu, 08 October 2009 12:04 Go to previous message
JohnSmith is currently offline  JohnSmith
Messages: 4
Registered: September 2009
Junior Member
"Lasse Clausen" <lbnc@lbnc.de> wrote in message
news:771d3ad1-2210-4252-87ad-10af20c3f397@m1g2000vbi.googleg roups.com...
> I find the following odd but maybe the sky is just falling and one of
> you guys can explain why this happens. Try running
>
> power = randomu(1001, 150)
> power[77+lindgen(10)*3] = 1e+7
> help, where(~finite(power))
> plot, power, yrange=[.1, 10]
> loadct, 12
> oplot, smooth(power, 12, /nan), thick=3, color=20
> oplot, smooth(power, 12), thick=3, color=120
> end
>
> On my machine
>
> IDL> print, !version
> { x86_64 linux unix linux 7.0 Oct 25 2007 64 64}
>
> I see a distinct difference in the SMOOTH output after the very uppy-
> downy bit of the data. It seems the documentation should be changed
> from
>
> SMOOTH should never be called without the NAN keyword if the input
> array may possibly contain NaN values.
>
> to
>
> SMOOTH should never be called without the NAN. Period.


my guess, and I have not thought hard about it, is that
the NAN keyword forces smooth to work in double precision internally.


Note: the difference goes away if you put a
power = double(power)

right after the randomu() call.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Sky is falling, maybe?
Next Topic: Re: Nearest neighbors

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:31:45 PDT 2025

Total time taken to generate the page: 0.00648 seconds