Re: Finding strings values common to two (large!) arrays [message #92086 is a reply to message #92085] |
Wed, 07 October 2015 15:19   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Wednesday, October 7, 2015 at 3:57:23 PM UTC-4, rj...@le.ac.uk wrote:
> CMSET_OP looks to be working but I'm not 100% sure due to this comment in the header:
>
> ; INDEX - if set, then return a list of indices instead of the array
> ; values themselves. The "slower" set operations are always
> ; performed in this case.
> ;
> ; The indices refer to the *combined* array [A,B]. To
> ; clarify, in the following call: I = CMSET_OP(..., /INDEX);
> ; returned values from 0 to NA-1 refer to A[I], and values
> ; from NA to NA+NB-1 refer to B[I-NA].
>
>
> When using the code like this, it is returning an array of indices that only seem to relate to the first array.
>
> e.g. (massively simplied) A has 10 elements, B has 20 and the returned indices are an array of 7 values such as [0,1,2,5,7,8,9]
>
> Would I not also expect indices for the elements in the second array (10-29) to also be returned going by the statement in the header?
If you are using 'AND', CMSET_OP() only returns indices to the first array. It doesn't ever return duplicates, so it doesn't need to tell you *again* the same values.
You might also want to check MATCH2 in the IDL astronomy library. I wrote that also, and it is designed to match large catalogs against each other and return the matching indices on both sides.
Craig
|
|
|