Expand description
Special functions and numerical helpers for GAMLSS crates.
This crate intentionally exposes small scalar f64 free functions. Keeping
the API as free functions lets distribution crates call them without runtime
dispatch while still sharing one implementation of gamma/beta, normal-tail
and CDF inversion helpers.
Invalid domains return NaN for helper-style APIs and non-finite likelihood
scale values where that convention is already part of the surrounding
distribution code.
Functions§
- baseline_
softmax - Baseline softmax with a representable strictly-positive result.
- bernoulli_
kl - Kullback-Leibler divergence between Bernoulli probabilities.
- categorical_
kl - Kullback-Leibler divergence between categorical probability vectors.
- digamma
- Digamma function approximation for positive arguments.
- digamma_
delta - Difference
digamma(base + increment) - digamma(base)for positive arguments. - digamma_
minus_ ln - Difference
digamma(x) - ln(x)for positive finitex. - discrete_
quantile - Generalized inverse for a discrete CDF on non-negative integer support.
- exponential_
integral_ e1 - Exponential integral
E1(x) = integral_x^inf exp(-t) / t dt. - included_
count - Converts a finite CDF query point into the largest included count.
- integrate_
finite - Integrates a finite interval with adaptive Simpson quadrature.
- invert_
bounded_ cdf - Inverts a monotone CDF on a finite closed interval by bisection.
- invert_
positive_ cdf - Inverts a monotone CDF on
[0, +inf)by bracketing and bisection. - invert_
real_ cdf - Inverts a monotone CDF on the real line by bracketing and bisection.
- is_
nonnegative_ integer - Returns
truefor finite counts represented on the sharedf64observation path. - ln_beta
- Natural logarithm of the beta function for positive finite arguments.
- ln_
gamma - Natural logarithm of the absolute gamma function via the Lanczos approximation.
- ln_
gamma_ delta - Difference
ln(Gamma(base + increment)) - ln(Gamma(base))for positive arguments. - ln_
gamma_ stirling_ residual - Residual
ln(Gamma(x)) - x * ln(x) + xfor positive finitex. - ln_
multivariate_ beta - Logarithm of the multivariate beta function.
- log_
add_ exp - Stable two-term log-space addition.
- log_
ndtr - Natural logarithm of the standard normal CDF.
- log_
regularized_ beta - Logarithm of the regularized incomplete beta function
I_x(a, b). - normal_
mills_ ratio - Standard normal Mills ratio
phi(z) / Phi(z). - owens_t
- Owen’s T function
T(h, a). - regularized_
beta - Regularized incomplete beta function
I_x(a, b)for positivea,b. - regularized_
beta_ complement - Complement of the regularized incomplete beta function,
1 - I_x(a, b). - regularized_
gamma_ lower - Regularized lower incomplete gamma function
P(a, x). - regularized_
gamma_ upper - Regularized upper incomplete gamma function
Q(a, x) = 1 - P(a, x). - student_
t_ cdf_ standardized - Standard Student-t CDF.
- student_
t_ log_ cdf_ standardized - Logarithm of the standard Student-t CDF.
- student_
t_ log_ pdf_ standardized - Standard Student-t log-density.
- student_
t_ nll_ constant - Student-t normalizing constant on the negative log-density scale.
- unit_
normal_ cdf - Standard normal CDF.
- unit_
normal_ log_ pdf - Standard normal log-density.
- unit_
normal_ log_ sf - Natural logarithm of the standard normal survival function.
- unit_
normal_ quantile - Standard normal quantile using Wichura’s AS241 rational approximation.
- unit_
normal_ sf - Standard normal survival function
1 - Phi(z).