argmax_simd

Function argmax_simd 

Source
pub fn argmax_simd<F>(a: &ArrayView1<'_, F>) -> Option<usize>
where F: Float + SimdUnifiedOps,
Expand description

SIMD-accelerated argmax (index of maximum)

Returns the index of the maximum element.

§Arguments

  • a - Input array

§Returns

Some(index) of maximum element, or None if array is empty

§Examples

use scirs2_core::ndarray::array;
use scirs2_core::ndarray_ext::elementwise::argmax_simd;

let x = array![3.0_f64, 1.0, 4.0, 1.0, 5.0, 9.0, 2.0, 6.0];
let idx = argmax_simd::<f64>(&x.view());
assert_eq!(idx, Some(5));  // x[5] = 9.0 is the maximum

§Use Cases

  • Classification prediction (class with highest probability)
  • Finding optimal parameters
  • Greedy selection algorithms
  • Winner-take-all networks