pub fn std_simd<F>(x: &ArrayView1<'_, F>, ddof: usize) -> Option<F>where
F: Float + SimdUnifiedOps,Expand description
Compute the standard deviation of a 1D array with SIMD acceleration.
This function computes the square root of the variance using SIMD-accelerated variance computation.
§Arguments
x- Input 1D arrayddof- Delta degrees of freedom (0 for population std, 1 for sample std)
§Returns
Some(std)- The standard deviation of the arrayNone- If the array is empty or has insufficient data (length <= ddof)
§Performance
- f32: ~2-3x faster than scalar for arrays > 1000 elements
- f64: ~2-3x faster than scalar for arrays > 1000 elements
- Uses SIMD variance followed by sqrt
§Examples
use scirs2_core::ndarray::array;
use scirs2_core::ndarray_ext::reduction::std_simd;
let x = array![1.0f64, 2.0, 3.0, 4.0, 5.0];
let std = std_simd(&x.view(), 1).unwrap(); // Sample std (ddof=1)
assert!((std - 1.5811388300841898).abs() < 1e-10);