Re: Finding strings values common to two (large!) arrays [message #92087 is a reply to message #92086] |
Thu, 08 October 2015 04:40   |
rjp23
Messages: 97 Registered: June 2010
|
Member |
|
|
Thanks Craig, that's very helpful.
Just from the note in the header I was expecting it to repeat the same values again in the second array but that fact that it shouldn't (and doesn't) means it's all fine and working perfectly for what I need.
Cheers
Rob
On Wednesday, October 7, 2015 at 11:19:50 PM UTC+1, Craig Markwardt wrote:
> 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
|
|
|