Struct average::Max [−][src]
pub struct Max { /* fields omitted */ }
Estimate the maximum of a sequence of numbers ("population").
Example
use average::Max; let a: Max = (1..6).map(f64::from).collect(); assert_eq!(a.max(), 5.);
Methods
impl Max
[src]
impl Max
pub fn from_value(x: f64) -> Max
[src]
pub fn from_value(x: f64) -> Max
Create a new maxium estimator from a given value.
pub fn new() -> Max
[src]
pub fn new() -> Max
Create a new maximum estimator.
pub fn max(&self) -> f64
[src]
pub fn max(&self) -> f64
Estimate the maxium of the population.
Trait Implementations
impl Debug for Max
[src]
impl Debug for Max
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Max
[src]
impl Clone for Max
fn clone(&self) -> Max
[src]
fn clone(&self) -> Max
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl Default for Max
[src]
impl Default for Max
impl FromIterator<f64> for Max
[src]
impl FromIterator<f64> for Max
fn from_iter<T>(iter: T) -> Max where
T: IntoIterator<Item = f64>,
[src]
fn from_iter<T>(iter: T) -> Max where
T: IntoIterator<Item = f64>,
Creates a value from an iterator. Read more
impl<'a> FromIterator<&'a f64> for Max
[src]
impl<'a> FromIterator<&'a f64> for Max
fn from_iter<T>(iter: T) -> Max where
T: IntoIterator<Item = &'a f64>,
[src]
fn from_iter<T>(iter: T) -> Max where
T: IntoIterator<Item = &'a f64>,
Creates a value from an iterator. Read more
impl Estimate for Max
[src]
impl Estimate for Max
fn add(&mut self, x: f64)
[src]
fn add(&mut self, x: f64)
Add an observation sampled from the population.
fn estimate(&self) -> f64
[src]
fn estimate(&self) -> f64
Estimate the statistic of the population.
impl Merge for Max
[src]
impl Merge for Max
fn merge(&mut self, other: &Max)
[src]
fn merge(&mut self, other: &Max)
Merge another sample into this one.
Example
use average::{Max, Merge}; let sequence: &[f64] = &[1., 2., 3., 4., 5., 6., 7., 8., 9.]; let (left, right) = sequence.split_at(3); let max_total: Max = sequence.iter().collect(); let mut max_left: Max = left.iter().collect(); let max_right: Max = right.iter().collect(); max_left.merge(&max_right); assert_eq!(max_total.max(), max_left.max());