laziness, impatience, and hubris PerlMonks

### Re: RFC: 100 PDL Exercises (ported from numpy)

by jtym (Novice)
 on Oct 30, 2018 at 13:10 UTC ( #1224907=note: print w/replies, xml ) Need Help??

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;

Create A New User
Node Status?
node history
Node Type: note [id://1224907]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (10)
As of 2020-04-01 08:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
To "Disagree to disagree" means to:

Results (186 votes). Check out past polls.

Notices?