to_degrees_simd

Function to_degrees_simd 

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

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

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

§Arguments

  • x - Input 1D array of angles in radians

§Returns

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

§Performance

Uses SIMD scalar multiplication for optimal performance.

§Mathematical Properties

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

§Examples

use scirs2_core::ndarray::array;
use scirs2_core::ndarray_ext::elementwise::to_degrees_simd;
use std::f64::consts::PI;

let radians = array![0.0, PI/2.0, PI, 2.0*PI];
let degrees = to_degrees_simd(&radians.view());
// Result: [0.0, 90.0, 180.0, 360.0]

§Applications

  • Trigonometry: Converting calculation results to human-readable form
  • Graphics: Displaying rotation angles
  • Physics: Reporting angular measurements
  • Navigation: Displaying compass headings