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

Home » Public Forums » archive » Re: subscript array question
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: subscript array question [message #14298] Fri, 12 February 1999 00:00 Go to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
In article <7a0j1q$mvb$1@news.NERO.NET> bennetsc@ucs.orst.edu
(Scott Bennett) writes:

[..snip histogram solution, among other things..]

> That sure looks ingeniously devious to me. I had to try out all
> the pieces to see how it worked. :-)

I agree - almost sinister - a big contender for Hi-Tech Tip of the
year (and it's still just February!).

> However, I couldn't get my 2D
> case to perform well. I'm omitting here some non-essentials, but the
> routine originally had this in it:
>
[..]
> ths[thsubs,ssubs] = ths[thsubs,ssubs] + llvol
[..]
>
> Written like that, it ran in ~15 seconds on my test data set, but gave
> values in ths that were often too small, as I originally posted.

[..loop version taking ~46 seconds omitted..]

[..hist_2d version taking 37 *minutes* omitted...]

What you ought to try instead is to calculate the one-dimensional
index values from the two-dimensional indices:

subs = thsubs + ssubs * (size(ths))(1)

And then just plug it into the original scheme:

ths[min(subs):max(subs)] = ths[min(subs):max(subs)] +histogram(subs)

On a general note, if "subs" covers the array very sparsely, the
histogram method is not necessarily faster than the loop version (as a
limiting case, consider a huge array, and you want to add 1 to the
first and last element only - the histogram is just as huge as the
array, and a lot of time will be spent adding zeros to the array!)

Regards,

Stein Vidar
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: DICOM3 read/write module with AVS and/or IDL ?
Next Topic: Re: Timer events

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

Current Time: Wed Oct 08 17:00:49 PDT 2025

Total time taken to generate the page: 0.00470 seconds