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

Home » Public Forums » archive » Re: how to sort data based on other sorted data
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: how to sort data based on other sorted data [message #57979 is a reply to message #57978] Thu, 10 January 2008 10:47 Go to previous messageGo to previous message
JMB is currently offline  JMB
Messages: 13
Registered: January 2008
Junior Member
> The idea is to merge your array of coordinates in a single vector that
> can be sorted. The merging has to be done in a way that x,y,z info
> doesn't mix.

You can test the following method that seems to work for integers or
unsigned integers.
[-32768,+32768] or [0,+65535]
It doesn't work with floating points!:

;***************************************************

; a xyz matrix is generated for testing:
Rows=50000
xyz=dblarr(3,Rows)

xyz[0,*]=fix((randomu(S,Rows)-0.5)*2.^16)
xyz[1,*]=fix((randomu(S,Rows)-0.5)*2.^16)
xyz[2,*]=fix((randomu(S,Rows)-0.5)*2.^16)

; the method! quite short ;-)

c=xyz[2,*]*2.^32+xyz[1,*]*2.^16+xyz[0,*]
indices=sort(c)

end
;***************************************************

You can benchmark with multisort!

Cheers,

Jerome
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: How to Auto Insert IDL 7 Template
Next Topic: IDL Workbench Nits

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

Current Time: Sat Oct 11 00:28:39 PDT 2025

Total time taken to generate the page: 1.36437 seconds