Skip to main content

simd_unary

Function simd_unary 

Source
pub fn simd_unary(a: &[f64], op: UnaryOp) -> Vec<f64>
Expand description

SIMD-accelerated element-wise unary operation.

Returns a new Vec with out[i] = f(a[i]). Bit-identical to scalar for all supported operations:

  • sqrt: IEEE 754 mandates correctly-rounded sqrt.
  • abs: Bit mask operation (clear sign bit).
  • neg: Bit flip operation (toggle sign bit).
  • relu: max(0, x) via compare + blend.