/// Find the indexes of the unique numbers in an array.
///
/// For all elements in array `nrs`, find the index of the first occurrence of
/// that element in `nrs`, and store it in the result. Afterwards, the indices
/// array is sorted. Thus, equal numbers in the input array result in indices
/// occuring with the same frequency in the output array, though not necessarily
/// in the same order.
Find the indexes of the unique numbers in an array.
For all elements in array `nrs`, find the index of the first occurrence of
that element in `nrs`, and store it in the result. Afterwards, the indices
array is sorted. Thus, equal numbers in the input array result in indices
occuring with the same frequency in the output array, though not necessarily
in the same order.
Find the indexes of the unique numbers in an array . For all elements in array ` nrs ` find the index of the first occurrence of that element in ` nrs ` and store it in the result . Afterwards the indices array is sorted . Thus equal numbers in the input array result in indices occuring with the same frequency in the output array though not necessarily in the same order .
fn unique_indices(nrs: &[u64]) -> Vec<Idx>
{
    let count = nrs.len();
    let mut res = vec![];
    for idx in 0..count
    {
        let uniq_idx = match nrs.iter().position(|&x| x == nrs[idx])
            {
                Some(dup_idx) => dup_idx,
                None          => idx
            };
        res.push(uniq_idx as Idx);
    }
    res.sort();
    res
}
fn unique_indices ( nrs : & [ u64 ] ) -> Vec < Idx > { let count = nrs . len ( ) ; let mut res = vec ! [ ] ; for idx in 0 .. count { let uniq_idx = match nrs . iter ( ) . position ( | & x | x == nrs [ idx ] ) { Some ( dup_idx ) => dup_idx , None => idx } ; res . push ( uniq_idx as Idx ) ; } res . sort ( ) ; res }
Find the indexes of the unique numbers in an array.
Find the indexes of the unique numbers in an array .
nrs
&[u64]