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

Home » Public Forums » archive » Re: remove duplicate elements from a multi-dimensional array efficiently in IDL
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: remove duplicate elements from a multi-dimensional array efficiently in IDL [message #66313 is a reply to message #66312] Sun, 03 May 2009 10:47 Go to previous messageGo to previous message
chenbo09@gmail.com is currently offline  chenbo09@gmail.com
Messages: 15
Registered: May 2009
Junior Member
On May 2, 7:57 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
> On May 2, 8:47 pm, guillermo.castilla.castell...@gmail.com wrote:
>
>
>
>> On May 1, 12:36 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
>
>>> On May 1, 1:47 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
>
>>>> On May 1, 12:13 pm, "chenb...@gmail.com" <chenb...@gmail.com> wrote:
>
>>>> > Hello, everyone!
>
>>>> > Is there anyone knows a routine in IDL that be capable to remove
>>>> > duplicate elements from a multi-dimensional array efficiently? I 'm
>>>> > now working with huge arrays, and I have written one by myself, it
>>>> > works but is with low efficiency.
>
>>>> > example of my problem:
>>>> > the input array:
>>>> > 1,10,9,100,200
>>>> > 2,11,8,101,201
>>>> > 2,11,8,101,201
>>>> > 3,10,9,100,200
>>>> > 4,7,12,99,199
>>>> > 2,11,8,101,201
>
>>>> > goal:
>>>> > remove the duplicate elements with the same values for the second and
>>>> > the third column.
>
>>>> > expected output:
>>>> > 1,10,9,100,200
>>>> > 2,11,8,101,201
>>>> > 4,7,12,99,199
>
>>>> > Thanks for your help!
>
>>>> > Bo
>
>> If you don't have handy that ORD function Jeremy pointed out (I didn't
>> know of it), and assuming your array is of byte type, you can do the
>> following:
>
>> input = [[1,10,9,100,200],[2,11,8,101,201],[2,11,8,101,201],$
>> [3,10,9,100,200],[4,7,12,99,199],[2,11,8,101,201]]
>
>> keep = Where(Histogram(1000L*input[1,*]+input[2,*], rev=r) GT 0)
>> keep = r[r[keep]]
>> print, input[*,keep[sort(keep)]]
>> 1 10 9 100 200
>> 2 11 8 101 201
>> 4 7 12 99 199
>
>> Cheers
>
>> Guillermo
>
> You can find ord at:
>
> http://web.astroconst.org/jbiu/jbiu-doc/math/ord.html
>
> -Jeremy.

Jeremy,

Thanks for your kind and prompt help!
It took my own routine 18 hours to do the job. I have just plug the
codes you kindly offered into my codes, I'll let you know how
efficient your routine is. Thanks!

Bo
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Trying to run ENVI_FX_DOIT example
Next Topic: Re: Strange array division problem

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

Current Time: Fri Oct 10 04:29:51 PDT 2025

Total time taken to generate the page: 0.82888 seconds