add an option to sort and rsort that returns instead the permutation

document that and mention inversePermutation
