argmin_simd

Function argmin_simd 

Source
pub fn argmin_simd<T>(
    array: ArrayView<'_, T, Ix2>,
    axis: Option<usize>,
) -> Result<Array<usize, Ix1>, &'static str>
Expand description

Return the indices of the minimum values along the specified axis with SIMD acceleration.

This is a SIMD-accelerated version of argmin that provides significant performance improvements for large arrays (typically 2-3x faster for f32 operations).

§Arguments

  • array - The input 2D array
  • axis - The axis along which to find the minimum values (0 for rows, 1 for columns, None for flattened array)

§Returns

A 1D array containing the indices of the minimum values

§Performance

  • For axis=None (flattened): Uses SIMD for f32/f64 types, ~2-3x faster
  • For axis=Some(0/1): Currently uses scalar implementation

§Examples

use scirs2_core::ndarray::array;
use scirs2_core::ndarray_ext::manipulation::argmin_simd;

let a = array![[5.0f32, 2.0, 3.0], [4.0, 1.0, 6.0]];

// Find index of minimum value in flattened array (SIMD-accelerated)
let result = argmin_simd(a.view(), None).unwrap();
assert_eq!(result[0], 4); // Index of 1.0 in flattened array