pub fn sort_permutation(
shape: &[usize],
dim: usize,
cmp: impl Fn(usize, usize) -> Ordering,
) -> Vec<usize>Expand description
The permutation that sorts along dim stably by cmp, which compares
the flat indices of two elements: for each element of the result, the
flat index of the element it comes from.