Skip to main content

Module statistics

Module statistics 

Source
Expand description

Statistical analysis support for f32 on no_std, powered by embedded-stats-f32.

Provides batch statistics with compensated Kahan summation (mean, variance, std_dev) and constant-memory streaming statistics with Welford’s algorithm (StreamingStats), with zero heap allocation, zero libm, and fail-fast rejection of NaN and ±inf values.

§Behavior & Notes

Operation / InputBehavior
mean(&[f32])Arithmetic mean via Kahan summation (Result<f32, StatsError>)
variance(&[f32])Population variance (divisor N) via Kahan (Result<f32, StatsError>)
std_dev(&[f32])Standard deviation (sqrt(variance)) (Result<f32, StatsError>)
StreamingStats::new()Initializes O(1) memory streaming accumulator
acc.update(x)Updates state if finite; preserves state on Err(StatsError::NonFiniteValue)
Empty slice / uninitialized StreamingStatsReturns Err(StatsError::EmptySlice)
NaN or ±Infinity input/outputReturns Err(StatsError::NonFiniteValue)

Structs§

StreamingStats
Accumulateur de moyenne en ligne, O(1) mémoire.

Enums§

StatsError
Erreurs EmptySlice et NonFiniteValue pour la roboustesse du systeme

Functions§

kahan_mean
Calcule la moyenne arithmétique d’une tranche f32.
kahan_std_dev
Calcule l’écart type de population (= √variance) d’une tranche f32.
kahan_variance
Calcule la variance de population (non corrigée, diviseur N) d’une tranche f32.
mean
Computes the arithmetic mean of slice using Kahan compensated summation.
std_dev
Computes the population standard deviation of slice.
variance
Computes the population variance (divisor N) of slice using Kahan summation.