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

Home » Public Forums » archive » Re: 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 #49840 is a reply to message #49744] Wed, 16 August 2006 10:40 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
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
Read Message
Read Message
Read Message
Previous Topic: Re: File_COPY
Next Topic: SETENV

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

Current Time: Fri Oct 10 10:01:24 PDT 2025

Total time taken to generate the page: 0.96276 seconds