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

Home » Public Forums » archive » How to get matching elements of array efficiently
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
How to get matching elements of array efficiently [message #69934] Tue, 23 February 2010 12:11
JJ is currently offline  JJ
Messages: 36
Registered: January 2007
Member
Hi All,

I'm looking for an efficient (non-loop) solution to this problem. I
have two arrays A, B. The elements of A are not necessarily unique,
nor is A necessarily sorted. I'd like to find all the indices in A
that match values that occur in B.

For example, if A = [7,1,8,7,8], B = [7,8], the result should be
[0,2,3,4].

A and B can have many (order millions) of unique values, so I'd rather
avoid a loop if I can.

Is there any way to do this efficiently?

Thanks.

-JJ
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Out of range subscript encountered:
Next Topic: Re: Poor comparable performance for IDL on Solaris vs Vista or Snow Leopard

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

Current Time: Wed Oct 08 13:47:25 PDT 2025

Total time taken to generate the page: 0.00509 seconds