[][src]Trait basic_dsp::PreciseStatisticsOps

pub trait PreciseStatisticsOps<T> {
    type Result;
    fn statistics_prec(&self) -> Self::Result;
}

Offers the same functionality as the StatisticsOps trait but the statistics are calculated in a more precise (and slower) way.

Associated Types

type Result

Loading content...

Required methods

fn statistics_prec(&self) -> Self::Result

Calculates the statistics of the data contained in the vector using a more precise but slower algorithm.

Example

use basic_dsp_vector::*;
let vector: Vec<f32> = vec!(1.0, 2.0, 3.0, 4.0, 5.0, 6.0);
let vector = vector.to_complex_time_vec();
let result = vector.statistics_prec();
assert_eq!(result.sum, Complex64::new(9.0, 12.0));
assert_eq!(result.count, 3);
assert_eq!(result.average, Complex64::new(3.0, 4.0));
assert!((result.rms - Complex64::new(3.4027193, 4.3102784)).norm() < 1e-4);
assert_eq!(result.min, Complex64::new(1.0, 2.0));
assert_eq!(result.min_index, 0);
assert_eq!(result.max, Complex64::new(5.0, 6.0));
assert_eq!(result.max_index, 2);
}
Loading content...

Implementors

impl<S, N, D> PreciseStatisticsOps<f64> for DspVec<S, f32, N, D> where
    D: Domain,
    N: RealNumberSpace,
    S: ToSlice<f32>, 
[src]

impl<S, N, D> PreciseStatisticsOps<f64> for DspVec<S, f64, N, D> where
    D: Domain,
    N: RealNumberSpace,
    S: ToSlice<f64>, 
[src]

impl<S, N, D> PreciseStatisticsOps<Complex<f64>> for DspVec<S, f32, N, D> where
    D: Domain,
    N: ComplexNumberSpace,
    S: ToSlice<f32>, 
[src]

impl<S, N, D> PreciseStatisticsOps<Complex<f64>> for DspVec<S, f64, N, D> where
    D: Domain,
    N: ComplexNumberSpace,
    S: ToSlice<f64>, 
[src]

impl<S, V, T> PreciseStatisticsOps<T> for Matrix2xN<V, S, T> where
    S: ToSlice<T>,
    T: RealNumber,
    V: Vector<T> + PreciseStatisticsOps<Statistics<T>, Result = Statistics<T>>, 
[src]

type Result = [Statistics<T>; 2]

impl<S, V, T> PreciseStatisticsOps<T> for Matrix3xN<V, S, T> where
    S: ToSlice<T>,
    T: RealNumber,
    V: Vector<T> + PreciseStatisticsOps<Statistics<T>, Result = Statistics<T>>, 
[src]

type Result = [Statistics<T>; 3]

impl<S, V, T> PreciseStatisticsOps<T> for Matrix4xN<V, S, T> where
    S: ToSlice<T>,
    T: RealNumber,
    V: Vector<T> + PreciseStatisticsOps<Statistics<T>, Result = Statistics<T>>, 
[src]

type Result = [Statistics<T>; 4]

impl<S, V, T> PreciseStatisticsOps<T> for MatrixMxN<V, S, T> where
    S: ToSlice<T>,
    T: RealNumber,
    V: Vector<T> + PreciseStatisticsOps<Statistics<T>, Result = Statistics<T>>, 
[src]

Loading content...