Trait basic_dsp_vector::SumOps

source ·
pub trait SumOps<T>: Sized
where T: Sized,
{ // Required methods fn sum(&self) -> T; fn sum_sq(&self) -> T; }
Expand description

Offers operations to calculate the sum or the sum of squares.

Required Methods§

source

fn sum(&self) -> T

Calculates the sum of the data contained in the vector.

§Example
use basic_dsp_vector::*;
let vector = vec!(Complex32::new(1.0, 2.0), Complex32::new(3.0, 4.0), Complex32::new(5.0, 6.0)).to_complex_time_vec();
let result = vector.sum();
assert_eq!(result, Complex32::new(9.0, 12.0));
}
source

fn sum_sq(&self) -> T

Calculates the sum of the squared data contained in the vector.

§Example
use basic_dsp_vector::*;
let vector = vec!(Complex64::new(1.0, 2.0), Complex64::new(3.0, 4.0), Complex64::new(5.0, 6.0)).to_complex_time_vec();
let result = vector.sum_sq();
assert_eq!(result, Complex64::new(-21.0, 88.0));
}

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<S, T, N, D> SumOps<Complex<T>> for DspVec<S, T, N, D>
where S: ToSlice<T>, T: RealNumber, N: ComplexNumberSpace, D: Domain,

source§

impl<S, T, N, D> SumOps<T> for DspVec<S, T, N, D>
where S: ToSlice<T>, T: RealNumber, N: RealNumberSpace, D: Domain,