Function polars_utils::sort::perfect_sort
source · 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 arg_sort of an arg_sort
The second arg_sort 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 for &[(_, IdxSize)]
are integers ranging from 0..idx.len