[][src]Function arima::util::mean

pub fn mean<T: Num + Copy + Add<T, Output = T> + From<i32>>(x: &[T]) -> T

Calculate the mean of a vector.

Arguments

  • &x - Vector of length n to calculate the mean for.

Returns

  • Output vector containing the mean sum(x)/.

Example

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