Documentation
¶
Overview ¶
Package sort provides SIMD-accelerated sorting for the dataset engines.
Sort dispatches to the best available algorithm per type:
- RadixSort for integers and floats (O(n), SIMD-accelerated)
- VQSort as comparison-based fallback (vectorized quicksort)
- Sorting networks for very small arrays (≤32 elements)
NthElement provides O(n) partial sorting for computing quantiles (Median, percentiles) without a full sort.
Architecture dispatch is automatic:
AMD64: AVX-512 → AVX2 → scalar ARM64: NEON → scalar Other: pure Go fallback
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IndicesFloat64 ¶ added in v0.0.2
IndicesFloat64 returns the indices that would sort the data. Uses Go's stdlib pdqsort (slices.SortFunc) on (value, index) pairs.
func IndicesInt64 ¶ added in v0.0.2
IndicesInt64 returns the indices that would sort the data.
func IndicesString ¶ added in v0.0.2
IndicesString returns the indices that would sort the data.
func NthElement ¶
NthElement rearranges data such that data[k] is the element that would be at position k if data were fully sorted. Elements before k are ≤ data[k], elements after are ≥ data[k]. Average O(n).
This is the core primitive for Median and quantile computation:
NthElement(data, n/2) // data[n/2] is now the median
func Small ¶ added in v0.0.2
Small sorts data of length ≤32 using a SIMD sorting network. For larger data, use Sort instead.
Types ¶
This section is empty.