How to compute the inverse of permuation in numpy