math::mean

Function harmonic

Source
pub fn harmonic(slice: &[f64]) -> f64
Expand description

Calculate harmonic mean (HM) of data set slice.

§Arguments

  • slice - collection of values

§Example

use math::mean;

let slice = [1., 7.];
assert_eq!(mean::harmonic(&slice), 1.75);