pub fn frequency_offset_estimate(samples: &[Complex<f64>]) -> f64 {
    let latest: Vec<_> = samples.iter().skip(1).collect();
    let delayed: Vec<_> = samples
        .iter()
        .take(latest.len())
        .map(|x| x.conj())
        .collect();

    let mult: Vec<_> = latest
        .iter()
        .zip(delayed.iter())
        .map(|(x, y)| *x * y)
        .collect();
    let accum: Complex<f64> = mult.iter().sum();
    accum.arg()
}
/// Calculates a carrier offset estimate from the input sample vector.
///
/// Result is in radians/sample, and the estimator assumes the input symbol
/// vector is oversampled by some integer oversampling factor, `m`. The input
/// samples should NOT have gone through a matched filter at this point in the
/// demodulator chain.
///
/// Reference Chp. 8.2.2 in Meyr, Moeneclaey, and Fechtel.
///
/// # Arguments
///
/// * `samples` - Input vector of samples to calculate the carrier frequency
///               offset estimate from.
///
/// # Examples
///
/// ```
/// use comms_rs::demodulation::frequency_estimator::*;
/// use num::Complex;
///
/// let data: Vec<_> = (0..100).map(|x| Complex::new(0.0, x as f64).exp()).collect();
///
/// let estimate = frequency_offset_estimate(&data);
/// ```
Calculates a carrier offset estimate from the input sample vector.
Result is in radians/sample, and the estimator assumes the input symbol
vector is oversampled by some integer oversampling factor, `m`. The input
samples should NOT have gone through a matched filter at this point in the
demodulator chain.

Reference Chp. 8.2.2 in Meyr, Moeneclaey, and Fechtel.
Calculates a carrier offset estimate from the input sample vector . Result is in radians / sample and the estimator assumes the input symbol vector is oversampled by some integer oversampling factor ` m ` . The input samples should NOT have gone through a matched filter at this point in the demodulator chain . Reference Chp . 8 . 2 . 2 in Meyr Moeneclaey and Fechtel .
pub fn frequency_offset_estimate(samples: &[Complex<f64>]) -> f64 {
    let latest: Vec<_> = samples.iter().skip(1).collect();
    let delayed: Vec<_> = samples
        .iter()
        .take(latest.len())
        .map(|x| x.conj())
        .collect();
    let mult: Vec<_> = latest
        .iter()
        .zip(delayed.iter())
        .map(|(x, y)| *x * y)
        .collect();
    let accum: Complex<f64> = mult.iter().sum();
    accum.arg()
}
pub fn frequency_offset_estimate ( samples : & [ Complex < f64 > ] ) -> f64 { let latest : Vec < _ > = samples . iter ( ) . skip ( 1 ) . collect ( ) ; let delayed : Vec < _ > = samples . iter ( ) . take ( latest . len ( ) ) . map ( | x | x . conj ( ) ) . collect ( ) ; let mult : Vec < _ > = latest . iter ( ) . zip ( delayed . iter ( ) ) . map ( | ( x , y ) | * x * y ) . collect ( ) ; let accum : Complex < f64 > = mult . iter ( ) . sum ( ) ; accum . arg ( ) }
Calculates a carrier offset estimate from the input sample vector.
Calculates a carrier offset estimate from the input sample vector .
samples
&[Complex<f64>]
samples
&[Complex<f64>]
examples
```
use comms_rs::demodulation::frequency_estimator::*;
use num::Complex.



let estimate = frequency_offset_estimate(&data);
```
` ` ` use comms_rs :: demodulation :: frequency_estimator :: * ; use num :: Complex . let estimate = frequency_offset_estimate ( &data ) ; ` ` `