Struct average::Min
[−]
[src]
pub struct Min { /* fields omitted */ }
Estimate the minimum of a sequence of numbers ("population").
Example
use average::Min; let a: Min = (1..6).map(Into::into).collect(); println!("The minimum is {}.", a.min());
Methods
impl Min
[src]
fn from_value(x: f64) -> Min
[src]
Create a new minium estimator from a given value.
fn new() -> Min
[src]
Create a new minimum estimator.
fn min(&self) -> f64
[src]
Estimate the minium of the population.
Trait Implementations
impl Debug for Min
[src]
impl Clone for Min
[src]
fn clone(&self) -> Min
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for Min
[src]
impl FromIterator<f64> for Min
[src]
fn from_iter<T>(iter: T) -> Min where
T: IntoIterator<Item = f64>,
[src]
T: IntoIterator<Item = f64>,
Creates a value from an iterator. Read more
impl Estimate for Min
[src]
fn add(&mut self, x: f64)
[src]
Add an observation sampled from the population.
fn estimate(&self) -> f64
[src]
Estimate the statistic of the population.
impl Merge for Min
[src]
fn merge(&mut self, other: &Min)
[src]
Merge another sample into this one.
Example
use average::{Min, Merge}; let sequence: &[f64] = &[1., 2., 3., 4., 5., 6., 7., 8., 9.]; let (left, right) = sequence.split_at(3); let min_total: Min = sequence.iter().map(|x| *x).collect(); let mut min_left: Min = left.iter().map(|x| *x).collect(); let min_right: Min = right.iter().map(|x| *x).collect(); min_left.merge(&min_right); assert_eq!(min_total.min(), min_left.min());