math::meanFunction geometric
Source pub fn geometric(slice: &[f64]) -> f64
Expand description
Calculate geometric mean (GM) of data set slice
.
If the result would be imaginary, function returns NAN
.
§Arguments
slice
- collection of values
§Example
use math::mean;
let slice = [9., 16.];
assert_eq!(mean::geometric(&slice), 12.);