Trait vecfx::StatsExt

source ·
pub trait StatsExt {
    // Required methods
    fn sum(&self) -> f64;
    fn min(&self) -> f64;
    fn max(&self) -> f64;
    fn mean(&self) -> f64;
    fn var(&self) -> f64;
    fn std_dev(&self) -> f64;
    fn imin(&self) -> usize;
    fn imax(&self) -> usize;
}
Expand description

Trait that provides simple descriptive statistics on a univariate set of numeric samples.

Required Methods§

source

fn sum(&self) -> f64

Sum of the samples.

Note: this method sacrifices performance at the altar of accuracy Depends on IEEE-754 arithmetic guarantees. See proof of correctness at: “Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates”

source

fn min(&self) -> f64

Minimum value of the samples.

source

fn max(&self) -> f64

Maximum value of the samples.

source

fn mean(&self) -> f64

Arithmetic mean (average) of the samples: sum divided by sample-count.

See: https://en.wikipedia.org/wiki/Arithmetic_mean

source

fn var(&self) -> f64

Variance of the samples: bias-corrected mean of the squares of the differences of each sample from the sample mean. Note that this calculates the sample variance rather than the population variance, which is assumed to be unknown. It therefore corrects the (n-1)/n bias that would appear if we calculated a population variance, by dividing by (n-1) rather than n.

See: https://en.wikipedia.org/wiki/Variance

source

fn std_dev(&self) -> f64

Standard deviation: the square root of the sample variance.

Note: this is not a robust statistic for non-normal distributions. Prefer the median_abs_dev for unknown distributions.

See: https://en.wikipedia.org/wiki/Standard_deviation

source

fn imin(&self) -> usize

Index to the minimum value of the samples.

source

fn imax(&self) -> usize

Index to the maximum value of the samples.

Implementations on Foreign Types§

source§

impl StatsExt for [f64]

source§

fn sum(&self) -> f64

source§

fn min(&self) -> f64

source§

fn max(&self) -> f64

source§

fn mean(&self) -> f64

source§

fn var(&self) -> f64

source§

fn std_dev(&self) -> f64

source§

fn imin(&self) -> usize

source§

fn imax(&self) -> usize

Implementors§