Expand description
Parallel sorting and reduction utilities (CPU-side, rayon-based).
Provides:
radix_sort_u32– LSD radix sort foru32(4 passes of 8 bits).radix_sort_by_key– sort anyTby au32key function.parallel_prefix_sum– exclusive prefix-sum (scan) via rayon.parallel_reduce_sum– parallel tree reduction forf64.parallel_min_max– parallel min/max reduction.bitonic_sort– bitonic sort (pads to power-of-2 withf64::MAX).merge_sort_parallel– parallel merge sort via rayon.histogram_u32– parallel histogram.argsort– sorted index array forf64slice.nth_element– quickselect O(n) kth smallest element.
Structs§
- Sort
Timing Result - Sort timing result for performance comparison.
- Sort
Validation - Comprehensive sort validation: check sorted + permutation + stable order.
Functions§
- adaptive_
bucket_ sort - Frequency-adaptive bucket sort: allocates buckets proportional to data density.
- argsort
- Return indices that would sort
datain ascending order. - bitonic_
sort - Bitonic sort of a
Vecf64` in ascending order. - compare_
sorts - Run all three sort algorithms on a copy of the data and verify correctness.
- count_
inversions_ f64 - Count the number of inversions (pairs where
data[i]>data[j]for i < j). - counting_
sort_ by_ key - Counting sort that also carries satellite data (key-value pairs).
- counting_
sort_ u32 - Integer counting sort for values in [0, max_val].
- histogram_
bucket_ sort - Bucket sort for f64 values using a histogram to distribute elements.
- histogram_
u32 - Parallel histogram: count occurrences of
data[i] % num_bucketsper bucket. - is_
permutation_ f64 - Check if two slices contain the same elements (as a multiset).
- is_
permutation_ u32 - Check if two u32 slices contain the same elements.
- is_
sorted_ f64 - Verify that a slice of
f64is sorted in ascending order. - is_
sorted_ u32 - Verify that a slice of
u32is sorted in ascending order. - k_
way_ merge - K-way merge of multiple sorted slices using a min-heap approach.
- merge_
sort_ parallel - Parallel merge sort of a
Vecf64` using rayon. - merge_
sort_ parallel_ threshold - Parallel merge sort with configurable thread threshold.
- merge_
sorted - Merge two sorted slices into a single sorted Vec.
- merge_
sorted_ u32 - Merge two sorted
u32slices. - nth_
element - Quickselect O(n) algorithm: rearranges
dataso thatdata\[k\]holds the value that would be there in a fully sorted array, and returns it. - parallel_
min_ max - Parallel min/max reduction over a
f64slice. - parallel_
prefix_ sum - Exclusive prefix sum (scan) of
datausing rayon work-stealing. - parallel_
reduce_ sum - Parallel tree reduction: sum all
f64values indata. - radix_
histogram - Stage histogram: compute per-bucket histogram for a given bit range.
- radix_
sort_ by_ key - Sort a
VecTin ascending order of theu32key produced bykey_fn`. - radix_
sort_ gpu_ staged - Full 4-pass GPU radix sort decomposed into individual stages.
- radix_
sort_ stage_ u32 - GPU-style radix sort stage: one pass sorting by 8 bits starting at
shift. - radix_
sort_ u32 - LSD radix sort for
u32values using 8-bit passes (4 passes total). - validate_
radix_ sort - Validate that radix sort preserves all elements as a multiset.