Sorting might be overkill (and/or a little expensive) for this situation.
If A and B are the same shape (and they'd better be, or A is definitely not a
permutation of B), then you really only need to know if all the items (rows) of
A are also items (rows) of B.
So let's just ask that:
A e. B
1 1 1 1
A *./@:e. B
1
Now, if we needed slightly more information (and we're willing to pay for it),
in particular, exactly how A is permuted from B, we could use i. instead of e. :
A i. B
2 0 1 3
And from here, we can figure out exactly how far Jon would have had to go in
his quest to check every possible permutation:
A A.@:i. B
12
A C.@:i. B
+-----+-+
|2 1 0|3|
+-----+-+
Looks like about halfway ( (!#A)%2 ) . Not surprising.
-Dan
Please excuse typos; sent from a phone.
> On Jul 10, 2014, at 4:17 AM, Ben Gorte - CITG <[email protected]> wrote:
>
> B=:4 4$2 3 0 1 3 2 1 0 1 0 3 2 0 0 0 0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm