pub fn argmax(values: impl IntoIterator<Item = f64>) -> Option<(usize, f64)>Expand description
The index and the value of the largest element of values, the first one on ties
(None for an empty sequence or one of NaN only; NaN elements are skipped): the
decision of the detectors that pick the strongest candidate.
§Examples
use comnum_math::argmax;
assert_eq!(argmax([0.5, 2.0, -1.0, 2.0]), Some((1, 2.0)));
assert_eq!(argmax([f64::NAN, -3.0]), Some((1, -3.0)));
assert_eq!(argmax(std::iter::empty()), None);