I have an array and index list in numpy:
ar = np.array([4, 5, 3, -1, -1, 0, 1, 2])
indices = np.array([5, 6, 1, 2, 0, 7, 3, 4])
ar_permuted = ar[indices]
#ar_permuted = array([0, 1, 5, 3, 4, 2, -1, -1])
Now, given ar_permuted and indices, what is the most straightforward way to recover ar?