pub unsafe fn perfect_sort(
    pool: &ThreadPool,
    idx: &[(IdxSize, IdxSize)],
    out: &mut Vec<IdxSize>
)
Available on non-target_family="wasm" only.
Expand description

This is a perfect sort particularly useful for an argsort of an argsort The second argsort sorts indices from 0 to len so can be just assigned to the new index location.

Besides that we know that all indices are unique and thus not alias so we can parallelize.

This sort does not sort in place and will allocate.

  • The right indices are used for sorting
  • The left indices are placed at the location right points to.

Safety

The caller must ensure that the right indexes fo &[(_, IdxSize)] are integers ranging from 0..idx.len