Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,31 @@ categories = ["mathematics", "science", "algorithms"]
[lib]
bench = false

[features]
default = ["std"]
std = []
parallel = ["dep:rayon", "std"]

[dependencies]
num-traits = "0.2"
num-traits = { version = "0.2", default-features = false, features = ["libm"] }
rayon = { version = "1", optional = true }

[dev-dependencies]
criterion = { version = "0.8", features = ["html_reports"] }
approx = "0.5"

[[bench]]
name = "node_generation"
harness = false

[[bench]]
name = "integration_1d"
harness = false

[[bench]]
name = "cubature"
harness = false

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
59 changes: 39 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@

A high-performance numerical quadrature (integration) library for Rust.

- **Gauss-Legendre** -- O(1) per-node generation via the Bogaert (2014) algorithm
- **Gauss-Kronrod** -- embedded pairs (G7-K15 through G25-K51) for error estimation
- **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 with `f32`, `f64`, and AD types (e.g., [echidna](https://github.com/Entrolution/echidna))
- **`no_std` compatible** -- works without the standard library (with `alloc`)
- **Optional parallelism** -- `parallel` feature for rayon-based `_par` methods
- **Precomputed rules** -- generate nodes/weights once, integrate many times with zero allocation

## Quick Start
Expand All @@ -22,37 +25,53 @@ Add to `Cargo.toml`:
bilby = "0.1"
```

```rust,ignore
```rust
use bilby::GaussLegendre;

// Create a 10-point Gauss-Legendre rule
let gl = GaussLegendre::new(10);
let gl = GaussLegendre::new(10).unwrap();

// Integrate x^2 over [0, 1]
let result = gl.integrate(0.0, 1.0, |x| x * x);
// 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);
```

## Roadmap
## Features

bilby is being developed in phases. See [ROADMAP.md](ROADMAP.md) for details.
| Feature | Default | Description |
|---------|---------|-------------|
| `std` | Yes | Enables `std::error::Error` impl and `cache` module |
| `parallel` | No | Enables rayon-based `_par` methods (implies `std`) |

| Phase | Version | Content |
|-------|---------|---------|
| 0 | v0.1.0 | Gauss-Legendre (Bogaert), Gauss-Kronrod pairs, fixed-order integration |
| 1 | v0.2.0 | Adaptive integration (QUADPACK-style), infinite domains, error control |
| 2 | v0.3.0 | Classical rule families (Jacobi, Laguerre, Hermite, Chebyshev, Radau, Lobatto, Clenshaw-Curtis) |
| 3 | v0.4.0 | Multi-dimensional (tensor product, sparse grids, adaptive cubature, quasi-Monte Carlo) |
| 4 | v0.5.0 | Specialty methods (oscillatory, tanh-sinh, Cauchy principal value) |
| 5 | v1.0.0 | Parallelism, caching, `no_std`, benchmarks |
### `no_std` support

bilby works in `no_std` environments (with `alloc`). Disable default features:

```toml
[dependencies]
bilby = { version = "0.1", default-features = false }
```

### Parallelism

Enable the `parallel` feature for parallel variants of integration methods:

```toml
[dependencies]
bilby = { version = "0.1", features = ["parallel"] }
```

This provides `integrate_composite_par`, `integrate_par`, `integrate_box_par`,
`MonteCarloIntegrator::integrate_par`, and `GaussLegendre::new_par`.

## Development

```bash
cargo test # Run tests
cargo bench # Run benchmarks
cargo clippy # Lint
cargo fmt # Format
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 # Lint
```

## License
Expand Down
220 changes: 0 additions & 220 deletions ROADMAP.md

This file was deleted.

Loading