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

Home » Public Forums » archive » Re: algorithm question. Can I get rid of the for loop?
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: algorithm question. Can I get rid of the for loop? [message #83753 is a reply to message #83749] Fri, 22 March 2013 06:25 Go to previous messageGo to previous message
Heinz Stege is currently offline  Heinz Stege
Messages: 189
Registered: January 2003
Senior Member
On Thu, 21 Mar 2013 14:32:15 -0700 (PDT), S�ren Frimann wrote:

> FOR i=0,N_Elements(y)-1 DO BEGIN
> index = Where((x GE x[i] - dx) AND (x LE x[i] + dx))
> y0[i] = Median(y[index]) ; Median filtering
> s0[i] = 1.4826*Median(Abs(y[index] - y0[i])) ;estimating uncertainty
> ENDFOR

Hi S�ren,

I don't know, how to get rid of the loop. However you can make it
significantly faster, provided that the x values are monotonically
increasing:

Before entering the loop get the indices of the lower and upper limits
for all x values by use of the VALUE_LOCATE function. Then you can use
this pre-calculated indices instead of the index array from the WHERE
function.

Cheers, Heinz
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Rotating Tickmark labels
Next Topic: Re: Inscribed circle

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

Current Time: Sat Oct 11 10:27:36 PDT 2025

Total time taken to generate the page: 1.19684 seconds