[][src]Function ml_rust_cuda::math::stats::mean

pub fn mean(vec: &Vector) -> f32

Returns the arithmetic mean of the values contained in a mathematical vector.

Examples

use ml_rust_cuda::math::{
  f32_eq,
  linear::Vector,
  stats::mean
};

let vec = Vector::new(vec![9_f32, 5_f32, 8_f32, 3_f32, 4_f32, 0_f32]);

let mean = mean(&vec);
assert!(f32_eq(mean, 29_f32 / 6_f32));