Hi,

I'm wondering if anyone may have insight on determining the indices of
unique pairs, triplets, quadruplets, etc.

Consider:
$x = pdl[1,5,8,9,12,20,18,16,16,13, 2,1,5,7,13,15]
$y = pdl[0,2,1,7, 2, 6, 9, 4, 9,20,20,0,8,7,20, 5]
$o = pdl[$x,$y]
$i = $o->uniqind

My desire is to have $i = [0 1 2 3 4 5 6 7 8 9 10 12 13 15]; noting that 11
and 14 are absent because they're repeats.
The obvious solution is to sum and then determine unique sums (i.e. $s =
$x+$y; $i = $s->uniqind), but this seems a little careless, and does not
work on ND matrices.  Further it does not allow for further diagnostics,
like the frequency or number of occurrences of pairs, triplets, etc.

Does anyone have a more robust solution or is there interest in enhancing
the functionality of 'uniq' (and its kin) to obtain results on, at the very
least, 2D and  possibly ND matrices?

Cheers,
Dan
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to