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

Home » Public Forums » archive » Removing equal elements from an array
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: Removing equal elements from an array [message #49837 is a reply to message #49761] Wed, 16 August 2006 12:42 Go to previous messageGo to previous message
Julio[1] is currently offline  Julio[1]
Messages: 52
Registered: May 2005
Member
I'm using only integer values, so the Maarten's code and the Jean's tip
solved my problem. But I agree with you JD, when using float values it
won't work.

Thanks for all the comments!
Julio

JD Smith escreveu:

> On Wed, 16 Aug 2006 10:12:43 -0600, Jean H. wrote:
>
>> Hi,
>>
>> just sort your array based on the 2 fields...
>> you can do something like:
>> maxCol2 = max(a[1,*])
>> sortedIndices = sort([a[0,*]*maxCol2 + a[1,*]])
>> now do as you did before, but using a[0,sortedIndices] and
>> a[1,sortedIndices]
>
>
> This will only work in general for integer valued coordinates, but
> will get you into trouble with floating point. Note the following
> degeneracy, for maxCol2=180.:
>
> .1*180 + 1 == .05 * 180 + 10.
>
> thus, e.g., [.1,1] and [.05,10.] would be considered the same
> coordinates in your method.
>
> The only possibility for arbitrary floats over some range is to cast
> them to integers using a useful precision, and then shifting one set
> of numbers clear of the other.
>
> JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: quickly reassign numbers in large array?
Next Topic: Re: Changing the Dec labeling from horizontal to vertical

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

Current Time: Sat Oct 11 07:49:58 PDT 2025

Total time taken to generate the page: 0.88064 seconds