Expand description
Host-side scalar special functions shared by the CPU parity references of the GPU backends.
The CUDA kernels emit their own NVRTC-visible numerics (see
crate::numerics_device); this module is the matching host side
used by the CPU parity oracles (bms_flex_row’s test oracle) and the
CPU reference path (pirls_row’s probit CDF). Keeping a single definition
here means the host erfc cannot drift between backends.
Constants§
- INV_
SQRT_ 2PI 1/√(2π), matchingINV_SQRT_2PIin the kernel source bit-for-bit.- INV_
SQRT_ PI 1/√π, matchinginv_sqrt_piin the kernel source bit-for-bit.- LN_2
ln(2), matchingLN_2in the kernel source bit-for-bit.- SQRT_2
√2, matchingSQRT_2in the kernel source bit-for-bit.- SQRT_
2_ OVER_ PI √(2/π), matchingsqrt_2_over_piin the kernel source bit-for-bit.
Functions§
- erfc
- Complementary error function
erfc(x) = 1 − erf(x)evaluated on the host. - erfcx_
nonnegative - Scaled complementary error function
erfcx(x) = exp(x²)·erfc(x)forx ≥ 0, the host oracle for the deviceerfcx_nonnegative. Returns0.0at+∞; negative inputs andNaNreturnNaNbecause they violate the restricted domain. For0 ≤ x < 26evaluatesexp(x²)·erfc(x)directly; beyond that it switches to the same six-correction asymptotic expansion as the kernel. - log_
ndtr log Φ(x)for the standard normal CDF, the host oracle for the devicelog_ndtr. Forx < 0uses theerfcxrepresentationlog Φ(x) = −u² + log(½·erfcx(u)),u = −x/√2, keeping digits into the deep left tail; forx ≥ 0useslog1p(−½·erfc(x/√2)), retaining the negative tail after the CDF rounds to one. Propagates±∞/NaNexactly as the device path does.- log_
ndtr_ and_ mills - Joint
(log Φ(x), Mills ratio φ(x)/Φ(x)), the host oracle for the devicelog_ndtr_and_mills. Thex < 0branch computes the Mills ratio as√(2/π)/erfcx(u), which stays finite even whenΦ(x)underflows; thex ≥ 0branch formspdf/cdfdirectly. Boundary values mirror the kernel:(+0, +0)at+∞,(−∞, +∞)at−∞,(NaN, NaN)atNaN. - log_
ndtr_ mills_ curvature - Joint
(log Φ(x), φ(x)/Φ(x), −d²log Φ(x)/dx²)host oracle.