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(Into::into).collect();
assert_eq!(a.max(), 5.);

Methods

impl Max
[src]

[src]

Create a new maxium estimator from a given value.

[src]

Create a new maximum estimator.

[src]

Estimate the maxium of the population.

Trait Implementations

impl Debug for Max
[src]

[src]

Formats the value using the given formatter.

impl Clone for Max
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for Max
[src]

[src]

Returns the "default value" for a type. Read more

impl FromIterator<f64> for Max
[src]

[src]

Creates a value from an iterator. Read more

impl Estimate for Max
[src]

[src]

Add an observation sampled from the population.

[src]

Estimate the statistic of the population.

impl Merge for Max
[src]

[src]

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().map(|x| *x).collect();
let mut max_left: Max = left.iter().map(|x| *x).collect();
let max_right: Max = right.iter().map(|x| *x).collect();
max_left.merge(&max_right);
assert_eq!(max_total.max(), max_left.max());