pub fn normal_cdf_batch<F>(
x: &ArrayView1<'_, F>,
mean: F,
std_dev: F,
) -> StatsResult<Array1<F>>Expand description
Evaluate the Normal CDF at each point in x using a SIMD-friendly
rational approximation (Abramowitz & Stegun 26.2.17, max error 7.5 × 10⁻⁸).
The standard-normal CDF Φ(z) is approximated element-wise; for non-standard parameters the inputs are standardised: z = (x − µ) / σ.
§Arguments
x— Points at which to evaluate.mean— Distribution mean µ.std_dev— Distribution standard deviation σ (must be positive).
§Errors
Returns StatsError::InvalidArgument when std_dev <= 0 or x is empty.
§Examples
use scirs2_core::ndarray::array;
use scirs2_stats::normal_cdf_batch;
let x = array![0.0_f64, 1.959964_f64];
let cdf = normal_cdf_batch(&x.view(), 0.0, 1.0).expect("failed");
// CDF(0) ≈ 0.5, CDF(1.96) ≈ 0.975
assert!((cdf[0] - 0.5).abs() < 1e-6);
assert!((cdf[1] - 0.975).abs() < 1e-4);