[][src]Function rulinalg::utils::argmax

pub fn argmax<T>(u: &[T]) -> (usize, T) where
    T: Copy + PartialOrd

Find argmax of slice.

Returns index of first occuring maximum.

Examples

use rulinalg::utils;
let a = vec![1.0, 2.0, 3.0, 4.0];

let c = utils::argmax(&a);
assert_eq!(c.0, 3);
assert_eq!(c.1, 4.0);