cbrt_simd

Function cbrt_simd 

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

Compute the cube root of each element (SIMD-accelerated).

Computes cbrt(x) = x^(1/3) for each element, correctly handling negative values.

§Arguments

  • x - Input 1D array

§Returns

Array1<F> with the same length as input, where each element is the cube root.

§Mathematical Properties

  • cbrt(x^3) = x (exact inverse of cubing)
  • cbrt(-x) = -cbrt(x) (handles negative numbers)
  • cbrt(0) = 0
  • cbrt(1) = 1, cbrt(8) = 2, cbrt(27) = 3

§Examples

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

let x = array![0.0_f64, 1.0, 8.0, 27.0, -8.0];
let result = cbrt_simd(&x.view());
// Result: [0.0, 1.0, 2.0, 3.0, -2.0]

§Applications

  • Statistics: Transforming skewed data
  • Physics: Volume calculations from cubic dimensions
  • Numerical Analysis: Root-finding algorithms