Repository navigation
v0.4.0
Highlights
Batch integrands. Every fixed-node rule now has a _batch variant. Instead of being called once per point, your integrand gets a slice of nodes and replaces each one with f(x) in place. That lets you evaluate it with SIMD math libraries such as simdly:
use integrate::prelude::*;
use simdly::SliceMath;
// ∫₀¹ eˣ dx = e − 1
let integral = simpson_rule_batch(|xs: &mut [f64]| xs.exp_in_place(), 0.0, 1.0, 1_000_usize);Benchmarks on AVX2 with simdly, against the scalar rules: Newton-Cotes and Romberg are ~1.9–2× faster; Gauss-Legendre (n ≤ 100) is ~1.3× faster.
Each _batch rule shares its implementation with its scalar counterpart, so for f64 integrands the results are bit-for-bit identical.
Added
batchmodule with_batchvariants of every fixed-node rule: rectangle, trapezoidal, Simpson, Newton 3/8, Romberg, Gauss-Legendre/Laguerre/Hermite/Chebyshev (both kinds) and Gauss-Kronrod. All are re-exported from the prelude.romberg::MAX_ROMBERG_COLUMNSconstant.
Changed
- MSRV raised from 1.74 to 1.89.
- Every fixed-node rule is now implemented once and shared by its scalar and
_batchvariants. Scalar results may differ from 0.3.x in the last bits, because the summation order changed. - Gauss-Laguerre, Gauss-Hermite and Gauss-Chebyshev rules now accumulate in
f64for every float type, which is more accurate forf32. romberg_methodpanics ifn_columnsexceedsMAX_ROMBERG_COLUMNS(32) instead of overflowing.- Scalar Newton-Cotes and Gauss-Legendre rules are 2–9% faster.
Fixed
- Simpson, Newton 3/8 and trapezoidal rules panic with a clear message instead of overflowing when the node count exceeds
usize::MAX.
Upgrading
- Requires Rust 1.89 or newer.
- If you call
romberg_methodwith more than 32 columns, it now panics; reducen_columns. - If you compare results exactly against 0.3.x, expect last-bit differences.