pub fn sub_simd<F>(a: &ArrayView1<'_, F>, b: &ArrayView1<'_, F>) -> Array1<F>where
F: Float + SimdUnifiedOps,Expand description
SIMD-accelerated element-wise subtraction
Computes a - b element-wise.
§Arguments
a- First arrayb- Second array
§Returns
Element-wise difference
§Examples
use scirs2_core::ndarray::array;
use scirs2_core::ndarray_ext::elementwise::sub_simd;
let a = array![5.0_f64, 7.0, 9.0];
let b = array![1.0_f64, 2.0, 3.0];
let c = sub_simd::<f64>(&a.view(), &b.view());
assert!((c[0] - 4.0).abs() < 1e-14);
assert!((c[1] - 5.0).abs() < 1e-14);
assert!((c[2] - 6.0).abs() < 1e-14);§Use Cases
- Gradient computation
- Error calculation
- Differencing signals
- Relative positioning