Function inc_stats::median[][src]

pub fn median<T, V, I>(data: I) -> Option<T> where
    T: Float + FromPrimitive,
    V: DerefCopy<Output = T>,
    I: IntoIterator<Item = V>, 

Get the median of a set of data

This takes linear time and linear space.

Examples

let med = inc_stats::median(&[3.0, 1.0, 2.0]).unwrap();
assert_eq!(2.0, med);
let med = inc_stats::median(std::iter::empty::<f64>());
assert!(med.is_none());