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

Home » Public Forums » archive » Re: intersection of 2 arrays
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: intersection of 2 arrays [message #19647] Mon, 10 April 2000 00:00
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
dmarshall@ivory.trentu.ca writes:
> I never seem to have the problem at the time when it is being discussed
> here since I remember something about this in the past.
>
> I have 2 arrays and would like a 3rd that contains the set intersection of
> the 2. Each element in each is unique.
>
> This seems like a basic function but after searching in help, etc. I didn't
> come up with an elegant solution. Maybe its too basic and I should know it?

There was an extensive discussion here on this newsgroup a week or two
ago that you should be able to find on www.deja.com. It got pretty
technical if that's what you want.

For integers with small dynamic range, then the SET_OPERATIONS that
David refers to should be fine.

If you want a canned solution, you might consider using the CMSET_OP
from here:

http://cow.physics.wisc.edu/~craigm/idl/idl.html

It handles other data types, including FLOAT and STRING. It performs
set union, intersect, and exclusive-or, and also negation (e.g. NOT A
AND B)

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: intersection of 2 arrays [message #19651 is a reply to message #19647] Mon, 10 April 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Dave Marshall (dmarshall@ivory.trentu.ca) writes:

> I never seem to have the problem at the time when it is being discussed
> here since I remember something about this in the past.
>
> I have 2 arrays and would like a 3rd that contains the set intersection of
> the 2. Each element in each is unique.
>
> This seems like a basic function but after searching in help, etc. I didn't
> come up with an elegant solution. Maybe its too basic and I should know it?

There is some information about this sort of thing in this
article on my web page:

http://www.dfanning.com/tips/set_operations.html

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: botton size ?
Next Topic: botton size ?

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

Current Time: Wed Oct 08 17:09:18 PDT 2025

Total time taken to generate the page: 0.00447 seconds