pub fn smoothstep_simd<F>(
edge0: F,
edge1: F,
x: &ArrayView1<'_, F>,
) -> Array1<F>where
F: Float + SimdUnifiedOps,Expand description
SIMD-accelerated smoothstep interpolation
Returns smooth Hermite interpolation between 0 and 1 when edge0 < x < edge1:
- Returns 0 if x <= edge0
- Returns 1 if x >= edge1
- Returns smooth curve: 3t² - 2t³ where t = (x - edge0) / (edge1 - edge0)
§Arguments
edge0- Lower edge of the transitionedge1- Upper edge of the transitionx- Input values
§Returns
Array of smoothstep values in [0, 1]
§Examples
use scirs2_core::ndarray::{array, Array1};
use scirs2_core::ndarray_ext::elementwise::smoothstep_simd;
let x = array![0.0_f32, 0.25, 0.5, 0.75, 1.0];
let result = smoothstep_simd::<f32>(0.0, 1.0, &x.view());
assert!((result[0] - 0.0).abs() < 1e-6); // x=0 -> 0
assert!((result[2] - 0.5).abs() < 1e-6); // x=0.5 -> 0.5
assert!((result[4] - 1.0).abs() < 1e-6); // x=1 -> 1§Use Cases
- Shader programming (smooth transitions)
- Activation function variants
- Anti-aliasing
- Soft thresholding