Expand description
Probabilistic numerical methods with explicit uncertainty over computational quantities.
uncertain-numerics treats numerical computation as an inference problem.
Instead of returning only a point estimate of an integral or of the solution
of a linear system, each method returns a validated Gaussian posterior: its
mean is the estimate and its variance states how much the computation still
does not know. Every statistical and numerical assumption behind that
posterior is explicit, documented, and tested.
§What is implemented
| Area | Entry points |
|---|---|
| One-dimensional Bayesian quadrature | BayesianQuadrature, RbfKernel, GaussianMeasure, ScalarNormalPosterior |
| Active Bayesian quadrature | ActiveBayesianQuadrature, VarianceReductionAcquisition |
| Probabilistic linear solvers | SpdLinearSystem, GaussianLinearBelief, ResidualProjectionSolver, AConjugateProjectionSolver, CovarianceGreedyProjectionSolver |
| Building blocks | GaussianConditioner, KernelMean, KernelIntegral, ScalarKernel, ContinuousProbabilityMeasure |
§Example
Infer the integral of cos(x) against a standard Gaussian measure from seven
function evaluations, together with its posterior uncertainty:
use uncertain_numerics::{BayesianQuadrature, GaussianMeasure, RbfKernel};
let kernel = RbfKernel::new(1.0, 1.0)?; // signal variance, length scale
let measure = GaussianMeasure::new(0.0, 1.0)?; // p(x) = N(0, 1)
let quadrature = BayesianQuadrature::new(kernel, measure, 1.0e-10);
let nodes = [-3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0];
let values: Vec<f64> = nodes.iter().copied().map(f64::cos).collect();
let posterior = quadrature.posterior(&nodes, &values)?;
// Exactly, E[cos X] = exp(-1/2) for X ~ N(0, 1).
let exact = (-0.5_f64).exp();
println!("{} ± {}", posterior.mean(), posterior.standard_deviation());
assert!((posterior.mean() - exact).abs() < 3.0 * posterior.standard_deviation());§Numerical policy
- Inputs are validated at the API boundary. Invalid values produce typed
errors that implement
std::error::Error; they never propagate asNaN. - Linear systems are solved from a reusable Cholesky factorization. Explicit inverses are never formed.
- Jitter is a caller-supplied constant added to the diagonal. Because it changes the posterior, it is never increased automatically to make a factorization succeed.
- Posterior variances that are negative by more than machine roundoff are reported as errors rather than clamped.
§Interpreting the uncertainty
Posterior uncertainty is conditional on the numerical model. Under the
assumed prior the reported intervals are empirically calibrated, which the
integration tests verify. Under misspecification, for example an RBF length
scale that is far too smooth for the integrand, the posterior can be
confidently wrong. The docs/ directory of the repository records the known
failure modes and the calibration status of each linear-solver policy.
§Minimum supported Rust version
Rust 1.85. Raising the MSRV is treated as at least a minor version bump.
Structs§
- AConjugate
Linear Solve Result - Result of an A-conjugate probabilistic linear solve.
- AConjugate
Linear Solve Step - One A-conjugate projection-conditioning step.
- AConjugate
Projection Solver - Probabilistic linear solver using residual directions orthogonalized in the
Ainner product. - Active
Bayesian Quadrature - Sequential active Bayesian quadrature over a finite candidate set.
- Active
Design Result - Result of a sequential active Bayesian-quadrature run.
- Active
Design Step - One function evaluation selected by the active design.
- Bayesian
Quadrature - Bayesian quadrature with an RBF covariance kernel and Gaussian integration measure.
- Covariance
Greedy Projection Solver - Sequential probabilistic linear solver with data-independent covariance-greedy directions.
- Covariance
Greedy Solve Result - Result of a covariance-greedy probabilistic linear solve.
- Covariance
Greedy Step - One covariance-greedy projection step.
- Covariance
Trace Acquisition - Covariance-trace acquisition for exact linear-system projection observations.
- Gaussian
Conditioner - Reusable factorization of a symmetric positive-definite linear system.
- Gaussian
Linear Belief - Gaussian belief over the unknown solution vector of a linear system.
- Gaussian
Measure - Gaussian probability measure (N(\mu, \sigma^2)).
- Linear
Solve Step - One residual-projection conditioning step.
- Probabilistic
Linear Solve Result - Result of an iterative probabilistic linear solve.
- RbfKernel
- Squared-exponential (radial-basis-function) covariance kernel.
- Residual
Projection Solver - Residual-driven probabilistic solver for dense SPD systems.
- Scalar
Normal Posterior - Gaussian posterior for a scalar computational quantity.
- Selected
Candidate - Candidate selected by posterior integral-variance reduction.
- Selected
Linear Direction - Candidate projection chosen to maximize posterior covariance-trace reduction.
- SpdLinear
System - Dense symmetric positive-definite linear system
A x = b. - Variance
Reduction Acquisition - Expected reduction in posterior integral variance from evaluating one candidate node.
Enums§
- Active
Design Error - Errors raised while running sequential active Bayesian quadrature.
- Active
Selection Error - Errors raised while selecting active Bayesian-quadrature candidates.
- Active
Termination - Reason a sequential active Bayesian-quadrature run terminated.
- Bayesian
Quadrature Error - Errors raised while constructing a Bayesian quadrature posterior.
- Conditioning
Error - Errors raised while constructing or using a Gaussian conditioning system.
- Covariance
Greedy Termination - Reason a covariance-greedy probabilistic solve terminated.
- Kernel
Error - Errors raised while constructing covariance kernels.
- Linear
Solve Termination - Reason a residual-projection probabilistic linear solve terminated.
- Linear
Solver Error - Errors raised by probabilistic linear-system primitives.
- Measure
Error - Errors raised while constructing probability measures.
- Posterior
Error - Errors raised while constructing probabilistic numerical results.
Traits§
- Continuous
Probability Measure - Contract for a normalized continuous probability measure on the real line.
- Kernel
Integral - Analytic double integral of a scalar kernel under a probability measure.
- Kernel
Mean - Analytic mean embedding of a scalar kernel under a probability measure.
- Scalar
Kernel - Contract for a scalar covariance kernel.