pub fn exponential_pdf_batch<F>(
x: &ArrayView1<'_, F>,
rate: F,
) -> StatsResult<Array1<F>>Expand description
Evaluate the Exponential PDF at each point in x using SIMD.
Computes f(x) = λ · exp(−λx) for x ≥ 0, else 0.
§Arguments
x— Points at which to evaluate.rate— Rate parameter λ (must be positive).
§Errors
Returns StatsError::InvalidArgument when rate <= 0 or x is empty.
§Examples
use scirs2_core::ndarray::array;
use scirs2_stats::exponential_pdf_batch;
let x = array![0.0_f64, 1.0, 2.0];
let pdf = exponential_pdf_batch(&x.view(), 1.0).expect("failed");
// pdf(0; λ=1) = 1.0, pdf(1) = e^-1 ≈ 0.368, pdf(2) = e^-2 ≈ 0.135
assert!((pdf[0] - 1.0).abs() < 1e-10);
assert!((pdf[1] - (-1.0_f64).exp()).abs() < 1e-10);