I have a 444-member array of arrays called final
, with each subarray containing 12 integer members. How can I do a pairwise comparison of the contents of the subarrays to find all pairs with 11 members in common ; failing that, all those with 10 in common ; etc. ?
Is there a built-in similarity measure for numeric arrays?
EDIT for clarity : I would be happy if the function returned the pair with maximum similarity, or an array of such pairs in the case of a multi-way tie.
Seeking the function Foo
In[1]:= bar = RandomInteger[9, {6, 4}]
Out[1]= {{6, 6, 1, 5}, {4, 0, 9, 3}, {0, 4, 2, 9},
{4, 6, 0, 6}, {2, 5, 4, 8}, {4, 1, 9, 1}}
In[2]:= Foo[%]
Out[2]= {{4, 0, 9, 3}, {0, 4, 2, 9}}
In[3]:= Foo[bar]
Out[3]= {bar[1], bar[2]}