I have two permutations represented as Numpy arrays:
A:
0 1 2 3
A = [1, 3, 2, 0]
and B:
0 1 2 3
B = [0, 2, 1, 3]
how can I get C = A*B, where
0->1 * 1->2 = 2
1->3 * 3->3 = 3
2->2 * 2->1 = 1
3->0 * 0->0 = 0
C = (2, 3, 1, 0)
efficiently using Numpy?
Quite simply,
b[a]will do the trick: