standardize_simd

Function standardize_simd 

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

SIMD-accelerated standardization (z-score normalization)

Transforms to zero mean and unit variance: (x - mean) / std

§Arguments

  • a - Input array

§Returns

Standardized array

§Examples

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

let x = array![2.0_f64, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0];
let result = standardize_simd::<f64>(&x.view());
// Mean should be ~0, std should be ~1
let mean: f64 = result.iter().sum::<f64>() / result.len() as f64;
assert!(mean.abs() < 1e-10);

§Use Cases

  • Feature scaling for ML
  • Batch normalization
  • Statistical preprocessing
  • Anomaly scoring