argsort

Function argsort 

Source
pub fn argsort<T: Ord>(slice: &[T], invert: bool) -> Vec<usize>
Expand description

Returns the argsort (i.e. indices) of the given vector slice.

ยงExample:

use remainder::utils::mle::argsort;
let data = vec![3, 1, 4, 1, 5, 9, 2];

// Ascending order
let indices = argsort(&data, false);
assert_eq!(indices, vec![1, 3, 6, 0, 2, 4, 5]);