pub fn max_simd<F>(x: &ArrayView1<'_, F>) -> Option<F>where
F: Float + SimdUnifiedOps,Expand description
Find the maximum value in a 1D array with SIMD acceleration.
This function uses SIMD operations when beneficial for performance, providing significant speedups for large arrays on supported platforms (AVX2, NEON).
§Arguments
x- Input 1D array
§Returns
Some(value)- The maximum value in the arrayNone- If the array is empty
§Performance
- f32: ~2-3x faster than scalar for arrays > 1000 elements
- f64: ~2-3x faster than scalar for arrays > 1000 elements
- Automatically selects SIMD or scalar based on array size and platform capabilities
§Examples
use scirs2_core::ndarray::array;
use scirs2_core::ndarray_ext::reduction::max_simd;
let x = array![3.0f32, 1.0, 4.0, 1.0, 5.0, 9.0, 2.0];
let max_val = max_simd(&x.view()).unwrap();
assert_eq!(max_val, 9.0);