[][src]Function arima::util::diffinv

pub fn diffinv<T: Num + Add + AddAssign + Copy + From<u8>>(
    x: &[T],
    d: usize
) -> Vec<T>

Calculate the inverse difference of a vector.

Arguments

  • &x - Reference to input vector slice of length n.
  • d - How often the inverse differences should be applied.

Returns

  • Output vector of length n+d containing the inversed values. The first d values are zero.

Example

use arima::util;
let x = [1, 1, 1, 1, 1];
let y = util::diffinv(&x, 1);
assert_eq!(y, &[0, 1, 2, 3, 4, 5]);

let z = util::diff(&y, 1);
assert_eq!(z, x);