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

Home » Public Forums » archive » mean() function
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: mean() function [message #46956 is a reply to message #46938] Sun, 15 January 2006 05:53 Go to previous messageGo to previous message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
HI,

sometimes there is a trade-off between speed and correctness.
Here is another example:

IDL> print, !version
{ x86 linux unix linux 6.2 Jun 20 2005 32 64}

IDL> print, smooth([1, 1.0e20, 1, 1, 1, 1], 3)
1.00000 3.33333e+19 3.33333e+19 0.00000 0.00000 1.00000

Instead of calculating the average for each 3-element window, IDL uses
the first average only, then slides the window by adding/subtracting
elements from the window edge. For width w it uses only 2 add/sub per
window instead of w additions, which is a huge speed-up for large widths,
but can give incorrect result for rare cases.

regards,
lajos


On Sun, 15 Jan 2006, Reimar Bauer wrote:

> mean is not useable if it results in this
>
> IDL> print,mean( make_array(500000,val=35,/float) )
> 35.0413
> IDL> print,mean( make_array(400000,val=35,/float) )
> 35.0000
>
> I prefer a slower routine if this is right.
>
> no one would accept 1.0 + 1.0 result = 1.5
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: mean() function
Next Topic: ASP.NET vs JSF

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

Current Time: Sat Oct 11 03:26:24 PDT 2025

Total time taken to generate the page: 1.92264 seconds