Skip to main content

Crate gamlss_special

Crate gamlss_special 

Source
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 finite x.
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 true for finite counts represented on the shared f64 observation 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) + x for positive finite x.
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 positive a, 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).