http://qs321.pair.com?node_id=1224907


in reply to RFC: 100 PDL Exercises (ported from numpy)

93. Consider two arrays A and B of shape (8,3) and (2,2). How to find rows of A that contain elements of each row of B regardless of the order of the elements in B? (★★★)
use strict; use warnings; use PDL; my $A = floor(random(3,8) * 6); my $B = floor(random(2,2) * 6); my $C = $A->in($B->slice(',0'))->sumover * $A->in($B->slice(',1'))->su +mover ; my $rows = which($C > 0); print $rows;