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

Home » Public Forums » archive » Re: a behemoth bubble sort
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: a behemoth bubble sort [message #81874 is a reply to message #81855] Wed, 31 October 2012 00:47 Go to previous message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Monday, 29 October 2012 22:24:07 UTC+1, fisch...@gmail.com wrote:

> Unfortunately, the bubble sort I've employed in this code needs to run
> through 20 billion+ data points for the program to complete, which is of
> course impossible.

Are you really running the code below on a cube with 20 billion points?


> My current codes is as follows:
[...]
> ;giant for-loop that looks at each individual voxel at each velocity
> ;step and places the velocity at that voxel into the new cube's v-dimension.
> for v = min,max-1 do begin ; v = velocity step
>
> for x = 0,xsize-1 do begin
> for y = 0,ysize-1 do begin
> for z =0,zsize-1 do begin
> if (nifs(x,y,z) eq v) then begin ;if voxel has vth velocity step
> flux(x,y,v-min) = v ;places v at the vth plane of flux cube
> endif
> endfor
> endfor
> endfor
>
> endfor

You can do this with only the outermost loop:

for v = min,max-1 do begin
ind = where(nifs eq v, count)
if (count gt 0) then begin
i3d = array_indices(nifs, ind)
flux[i3d[0,*], i3d[1,*], i3d[2,*]-min] = v
endif
endfor

If your datacube is really 20 billion points, you should really divide this into subcubes. This is left as an exercise for the reader :)

--
Yngvar
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Image Overlays on Google Earth with KML Files
Next Topic: Re: cgColor and Widget_Draw Frame problem

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

Current Time: Sat Oct 11 14:04:04 PDT 2025

Total time taken to generate the page: 0.87992 seconds