Numpy: multiply two permutations Numpy: multiply two permutations numpy numpy

Numpy: multiply two permutations


Quite simply, b[a] will do the trick:

>>> import numpy as np>>> a = np.array([1, 3, 2, 0])>>> b = np.array([0, 2, 1, 3])>>> c = b[a]>>> print c[2 3 1 0]