[−][src]Struct ndhistogram::value::Mean
ndhistogram bin value computes the mean of the data samples provided when filling.
Mean had 3 type parameters:
- the type that is being averaged,
- the type of the output when calculating the mean and its uncertainty,
- the type that counts the number of fills.
This allows, for example, integers to be used when filling or counting, but a floating point type to compute the mean. In most cases, you will only need to specify the first type as sensible defaults are set for the second two type parameters.
Example
use ndhistogram::{ndhistogram, Histogram, axis::Uniform, value::Mean}; // create a histogram and fill it with some values let mut hist = ndhistogram!(Uniform::new(10, 0.0, 10.0); Mean<i32>); hist.fill_with(&0.0, 1); hist.fill_with(&0.0, 2); hist.fill_with(&0.0, 3); let mean = hist.value(&0.0).unwrap(); assert_eq!(mean.get(), 2.0); // should be the mean of [1,2,3]
Implementations
impl<C, T, O> Mean<T, O, C> where
O: From<T> + From<C> + NumOps + Signed + Copy,
C: Copy,
T: Copy,
[src]
O: From<T> + From<C> + NumOps + Signed + Copy,
C: Copy,
T: Copy,
pub fn new<I>(values: I) -> Self where
I: IntoIterator<Item = T>,
Self: FillWith<T> + Default,
[src]
I: IntoIterator<Item = T>,
Self: FillWith<T> + Default,
Factory method to create a Mean from a set of values.
Usually this will not be used as a Histogram will be responsible for creating and filling values.
pub fn get(&self) -> O
[src]
Get the current value of the mean.
pub fn mean(&self) -> <O as Div>::Output
[src]
Get the current value of the mean.
pub fn num_samples(&self) -> C
[src]
Get the number of times the mean value has been filled.
pub fn variance_of_samples(&self) -> O
[src]
Compute the variance of the samples.
pub fn standard_deviation_of_samples(&self) -> O where
O: Float,
[src]
O: Float,
The square root of the variance of the samples.
pub fn variance_of_mean(&self) -> O
[src]
The square of the standard error of the mean.
pub fn standard_error_of_mean(&self) -> O where
O: Float,
[src]
O: Float,
Compute the standard error of the mean.
Trait Implementations
impl<T: Clone, O: Clone, C: Clone> Clone for Mean<T, O, C>
[src]
impl<T: Copy, O: Copy, C: Copy> Copy for Mean<T, O, C>
[src]
impl<T: Debug, O: Debug, C: Debug> Debug for Mean<T, O, C>
[src]
impl<T: Default, O: Default, C: Default> Default for Mean<T, O, C>
[src]
impl<T: Eq, O: Eq, C: Eq> Eq for Mean<T, O, C>
[src]
impl<T, C, O> FillWith<T> for Mean<T, O, C> where
T: Copy + AddAssign + Mul<Output = T>,
C: AddAssign + One,
[src]
T: Copy + AddAssign + Mul<Output = T>,
C: AddAssign + One,
impl<T: Hash, O: Hash, C: Hash> Hash for Mean<T, O, C>
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Ord, O: Ord, C: Ord> Ord for Mean<T, O, C>
[src]
pub fn cmp(&self, other: &Mean<T, O, C>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: PartialEq, O: PartialEq, C: PartialEq> PartialEq<Mean<T, O, C>> for Mean<T, O, C>
[src]
pub fn eq(&self, other: &Mean<T, O, C>) -> bool
[src]
pub fn ne(&self, other: &Mean<T, O, C>) -> bool
[src]
impl<T: PartialOrd, O: PartialOrd, C: PartialOrd> PartialOrd<Mean<T, O, C>> for Mean<T, O, C>
[src]
pub fn partial_cmp(&self, other: &Mean<T, O, C>) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Mean<T, O, C>) -> bool
[src]
pub fn le(&self, other: &Mean<T, O, C>) -> bool
[src]
pub fn gt(&self, other: &Mean<T, O, C>) -> bool
[src]
pub fn ge(&self, other: &Mean<T, O, C>) -> bool
[src]
impl<T, O, C> StructuralEq for Mean<T, O, C>
[src]
impl<T, O, C> StructuralPartialEq for Mean<T, O, C>
[src]
Auto Trait Implementations
impl<T, O, C> RefUnwindSafe for Mean<T, O, C> where
C: RefUnwindSafe,
O: RefUnwindSafe,
T: RefUnwindSafe,
[src]
C: RefUnwindSafe,
O: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, O, C> Send for Mean<T, O, C> where
C: Send,
O: Send,
T: Send,
[src]
C: Send,
O: Send,
T: Send,
impl<T, O, C> Sync for Mean<T, O, C> where
C: Sync,
O: Sync,
T: Sync,
[src]
C: Sync,
O: Sync,
T: Sync,
impl<T, O, C> Unpin for Mean<T, O, C> where
C: Unpin,
O: Unpin,
T: Unpin,
[src]
C: Unpin,
O: Unpin,
T: Unpin,
impl<T, O, C> UnwindSafe for Mean<T, O, C> where
C: UnwindSafe,
O: UnwindSafe,
T: UnwindSafe,
[src]
C: UnwindSafe,
O: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,