statistics
Statistical Functions (Integer-Scaled)
Functions
| Function | Description |
|---|---|
stat_sum | Sum of all values. |
stat_mean_x10k | Mean * 10000. |
_stat_sort | Internal: simple insertion sort for small arrays. |
stat_median | Median (middle value of sorted data). |
stat_mode | Mode (most frequent value). Uses O(n^2) counting to avoid alloc_pages overlap. |
stat_min | Minimum value. |
stat_max | Maximum value. |
stat_range | Range (max - min). |
stat_variance_x10k | Variance * 10000. Uses sum of squared deviations. |
_stat_isqrt | Integer square root (helper for stdev). |
stat_stdev_x10k | Standard deviation * 10000. |
stat_percentile | Percentile (0-100). Returns value at that percentile. |
Details
stat_sum
fn stat_sum(data: &i64, n: i64) -> i64Sum of all values.
stat_mean_x10k
fn stat_mean_x10k(data: &i64, n: i64) -> i64Mean * 10000.
_stat_sort
fn _stat_sort(data: &i64, n: i64, out: &i64)Internal: simple insertion sort for small arrays.
stat_median
fn stat_median(data: &i64, n: i64) -> i64Median (middle value of sorted data).
stat_mode
fn stat_mode(data: &i64, n: i64) -> i64Mode (most frequent value). Uses O(n^2) counting to avoid alloc_pages overlap.
stat_min
fn stat_min(data: &i64, n: i64) -> i64Minimum value.
stat_max
fn stat_max(data: &i64, n: i64) -> i64Maximum value.
stat_range
fn stat_range(data: &i64, n: i64) -> i64Range (max - min).
stat_variance_x10k
fn stat_variance_x10k(data: &i64, n: i64) -> i64Variance * 10000. Uses sum of squared deviations.
_stat_isqrt
fn _stat_isqrt(n: i64) -> i64Integer square root (helper for stdev).
stat_stdev_x10k
fn stat_stdev_x10k(data: &i64, n: i64) -> i64Standard deviation * 10000.
stat_percentile
fn stat_percentile(data: &i64, n: i64, p: i64) -> i64Percentile (0-100). Returns value at that percentile.