to_radians_simd

Function to_radians_simd 

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

Convert degrees to radians for each element (SIMD-accelerated).

Computes x * π / 180 for each element, converting angle measurements from degrees to radians.

§Arguments

  • x - Input 1D array of angles in degrees

§Returns

Array1<F> with the same length as input, where each element is the corresponding angle in radians.

§Performance

Uses SIMD scalar multiplication for optimal performance.

§Mathematical Properties

  • to_radians(0) = 0
  • to_radians(90) = π/2
  • to_radians(180) = π
  • to_radians(360) = 2π

§Examples

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

let degrees = array![0.0, 90.0, 180.0, 360.0];
let radians = to_radians_simd(&degrees.view());
// Result: [0.0, π/2, π, 2π]

§Applications

  • Trigonometry: Converting human-readable angles to radian form
  • Graphics: Rotation transformations
  • Physics: Angular velocity and position calculations
  • Navigation: Bearing and heading conversions