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

Home » Public Forums » archive » Re: vector of bin indices using histogram?
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: vector of bin indices using histogram? [message #50782 is a reply to message #50780] Wed, 18 October 2006 07:47 Go to previous messageGo to previous message
Paolo Grigis is currently offline  Paolo Grigis
Messages: 171
Registered: December 2003
Senior Member
Is it fair to add the time used for computing the min & max
of the data into the total time for the direct method? When
using real data you might already know them, or else you can
get them directly out of the histogram via the omin and
omax keywords....

You might also want to change the computation of b with
a division into a multiplication by the reciprocal (see
example below).

x=fltarr(5d7)

t=systime(/seconds)
y=x/2.
print,systime(/seconds)-t
0.82191920

t=systime(/seconds)
y=x*(1./2)
print,systime(/seconds)-t
0.33465910


Ciao,
Paolo

greg michael wrote:
> Thanks Ben - I never met that function before! Unfortunately, it's
> using a bisection search, and comes out a little slower than the the
> direct calculation:
>
> pro test2,n
> x=randomu(0,n)
> h = HISTOGRAM(x, BINSIZE = 0.1, LOC = loc, MIN = 0.0)
>
> t=systime(/seconds)
> mx=max(x,min=mn)
> b=fix((x-mn)/(mx-mn)*10)
> print,"direct calc",systime(/seconds)-t
>
> t=systime(/seconds)
> b=VALUE_LOCATE(loc, x)
> print,"value_locate",systime(/seconds)-t
> end
>
> IDL> test2,5e7
> direct calc 1.5470002
> value_locate 2.8750000
>
> Well, maybe the direct calculation isn't so inefficient. But histogram
> must have known those numbers during its calculation. It's a pity they
> got thrown away.
>
> Greg
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: How to Sort/Uniq a list and keep its original index
Next Topic: Re: fast search

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

Current Time: Fri Oct 10 17:29:25 PDT 2025

Total time taken to generate the page: 0.79981 seconds