[][src]Function arima::util::diff

pub fn diff<T: Num + Copy + Neg<Output = T> + Sub>(x: &[T], d: usize) -> Vec<T>

Returns a n-1 vector containing the pairwise difference x_t - x_t-1.

Arguments

  • &x - Reference to input vector slice of length n.
  • d - Number of differences to be taken.

Returns

  • Output vector of length n-1.

Example

use arima::util;
let x = [1, 2, 3];
assert_eq!(util::diff(&x, 1), &[1, 1])