Module erf

Module erf 

Source
Expand description

§Error Function Module - High-Precision Mathematical Functions for Statistical Computing

This module provides optimised implementations of the error function (erf) and complementary error function (erfc), fundamental mathematical functions essential for probability theory, statistics, and scientific computing applications.

§Overview

The error function and its complement are crucial for:

  • Normal Distribution: CDF and quantile calculations
  • Statistical Hypothesis Testing: P-value computations
  • Signal Processing: Noise analysis and filtering
  • Physics Simulations: Diffusion and heat transfer problems
  • Financial Mathematics: Risk assessment and option pricing

§Mathematical Definitions

§Error Function

erf(x) = (2/√π) ∫₀ˣ e^(-t²) dt

§Complementary Error Function

erfc(x) = 1 - erf(x) = (2/√π) ∫ₓ^∞ e^(-t²) dt

§Inverse Complementary Error Function

erfc⁻¹(p) : ℝ -> ℝ such that erfc(erfc⁻¹(p)) = p

§Usage Examples

use crate::kernels::scientific::erf::{erf, erfc, erf_simd, erfc_simd, erfc_inv};
use std::simd::Simd;

// Scalar usage
let x = 1.5;
let erf_val = erf(x);          // ≈ 0.9661
let erfc_val = erfc(x);        // ≈ 0.0339
let inv_val = erfc_inv(0.1);   // ≈ 1.2816 (90th percentile of std normal)

// SIMD usage (8 lanes)
let inputs = Simd::<f64, 8>::from_array([0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0]);
let results = erf_simd(inputs);

Functions§

erf
Compute the error function for a single floating-point value.
erf_simd
SIMD accelerated erf function
erfc
Compute the complementary error function for a single floating-point value.
erfc_inv
Inverse complementary error-function erfc⁻¹(p)
erfc_simd
SIMD accelerated erfc function