bilby
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
Quick Start
Add to Cargo.toml:
[]
= "0.2"
use GaussLegendre;
// Create a 10-point Gauss-Legendre rule
let gl = new.unwrap;
// Integrate x^2 over [0, 1] (exact result = 1/3)
let result = gl.rule.integrate;
assert!;
Features
| Feature | Default | Description |
|---|---|---|
std |
Yes | Enables std::error::Error impl and cache module |
parallel |
No | Enables rayon-based _par methods (implies std) |
no_std support
bilby works in no_std environments (with alloc). Disable default features:
[]
= { = "0.2", = false }
Parallelism
Enable the parallel feature for parallel variants of integration methods:
[]
= { = "0.2", = ["parallel"] }
This provides integrate_composite_par, integrate_par, integrate_box_par,
MonteCarloIntegrator::integrate_par, and GaussLegendre::new_par.
Development
License
Licensed 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.
Contributing
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.