A high-performance numerical quadrature (integration) library for Rust.
- Comprehensive -- Gauss-Legendre, Gauss-Kronrod, Jacobi, Hermite, Laguerre, Chebyshev, Radau, Lobatto, Clenshaw-Curtis, tanh-sinh, oscillatory, Cauchy PV
- Adaptive integration -- QUADPACK-style error-driven refinement with configurable GK pairs
- Multi-dimensional -- tensor products, Smolyak sparse grids, Genz-Malik adaptive cubature, quasi-Monte Carlo (Sobol, Halton)
- Generic over
F: Float-- works withf32,f64, and AD types (e.g., echidna) no_stdcompatible -- works without the standard library (withalloc)- Optional parallelism --
parallelfeature for rayon-based_parmethods - Precomputed rules -- generate nodes/weights once, integrate many times with zero allocation
Add to Cargo.toml:
[dependencies]
bilby = "0.1"use bilby::GaussLegendre;
// Create a 10-point Gauss-Legendre rule
let gl = GaussLegendre::new(10).unwrap();
// Integrate x^2 over [0, 1] (exact result = 1/3)
let result = gl.rule().integrate(0.0, 1.0, |x: f64| x * x);
assert!((result - 1.0 / 3.0).abs() < 1e-14);| Feature | Default | Description |
|---|---|---|
std |
Yes | Enables std::error::Error impl and cache module |
parallel |
No | Enables rayon-based _par methods (implies std) |
bilby works in no_std environments (with alloc). Disable default features:
[dependencies]
bilby = { version = "0.1", default-features = false }Enable the parallel feature for parallel variants of integration methods:
[dependencies]
bilby = { version = "0.1", features = ["parallel"] }This provides integrate_composite_par, integrate_par, integrate_box_par,
MonteCarloIntegrator::integrate_par, and GaussLegendre::new_par.
cargo test # Run tests (default features)
cargo test --all-features # Run tests including parallel
cargo test --no-default-features # Run tests in no_std mode
cargo bench # Run benchmarks
cargo clippy --all-features # LintLicensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
See CONTRIBUTING.md for guidelines.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.