Atom - œ¿
- Permutation Index By Key
Tags: miscellaneous , array , combinatorics
Arity: dyadic
This atom is dyadic, which means it takes two arguments.
Functionality
Find the permutation index of x
where the base permutation is x
sorted by index in y
.
Details
For example, to compute 1,2,3 œ¿ 3,4,1,2
, we first sort x
by its indices in y
, which gives us [3, 1, 2]
. Then, we find the permutation index of [1, 2, 3]
in all permutations of [3, 1, 2]
. The latter's permutations are [[3, 1, 2], [3, 2, 1], [1, 3, 2], [1, 2, 3], [2, 3, 1], [2, 1, 3]]
, so the result is 4
.