fix: More efficient computation of permutation indices