[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Array intersections
- Subject: Re: Array intersections
- From: davidf(at)dfanning.com (David Fanning)
- Date: Thu, 26 Feb 1998 11:03:21 -0000
- Newsgroups: comp.lang.idl-pvwave
- Organization: Fanning Software Consulting
- References: <34F59FFD.110D@texaco.com>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:10196
Robert Moss (mossrm@texaco.com) writes:
> I'm sure there were some clever responses to this same question
> just a few months ago, but for the life of me I cannot recall
> what they were. Here's the question:
>
> What is the most efficient way (using IDL, of course) to return
> the index at which two arrays intersect? e.g.
>
> a = [ 1B, 2B, 9B, 5B, 6B, 11B ]
> b = [ 5B, 6B ]
> idx = intersect( a, b )
> idx = 3
>
> This is a highly simplified example, but the point is that I want
> a function that will accept two array inputs (byte arrays in my specific
> case) and return to me the index in array a where the subset b starts.
>
> Refresh my memory, please.
You can find the clever responses on my web page at:
http://www.dfanning.com/tips/set_operations.html
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/