pub fn autocovariance(x: &[f64], max_lag: usize) -> Result<Vec<f64>>Expand description
Biased (divide-by-n) sample autocovariance for lags 0..=max_lag,
after mean removal. The biased estimator keeps the Toeplitz matrix
positive semi-definite, which Levinson–Durbin requires.
Direct O(n · max_lag) sums for small lags; above lag 64 the lags are
computed in one shot through a zero-padded FFT (O(m log m) with
m ≥ n + max_lag a power of two). Both paths give the same numbers up
to floating-point roundoff.