pub fn acos_simd<F>(x: &ArrayView1<'_, F>) -> Array1<F>where
F: Float + SimdUnifiedOps,Expand description
Compute the arccosine of each element (SIMD-accelerated).
Computes acos(x) for each element, returning values in the range [0, π].
§Arguments
x- Input 1D array with values in [-1, 1]
§Returns
Array1<F> with the same length as input, where each element is the arccosine
in radians. Returns NaN for |x| > 1.
§Performance
- SIMD: Automatically used for large arrays (1000+ elements)
- Scalar: Used for small arrays or when SIMD is unavailable
§Mathematical Properties
- Domain: [-1, 1]
- Range: [0, π]
- acos(1) = 0, acos(-1) = π
- acos(0) = π/2
- acos(-x) = π - acos(x)
- acos(cos(x)) = x for x ∈ [0, π]
- acos(x) + asin(x) = π/2
- Returns NaN for |x| > 1
§Examples
use scirs2_core::ndarray::array;
use scirs2_core::ndarray_ext::elementwise::acos_simd;
let x = array![1.0_f64, 0.5, 0.0, -1.0];
let result = acos_simd(&x.view());
// Result: [0.0, π/3, π/2, π]§Applications
- 3D Graphics: Dot product angle calculations
- Machine Learning: Cosine similarity to angle conversion
- Physics: Angular momentum, rotation analysis
- Astronomy: Coordinate system transformations
- Navigation: Bearing and heading calculations