Skip to content

v0.4.0

Choose a tag to compare

@mtantaoui mtantaoui released this 31 Oct 20:21
· 3 commits to main since this release

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

  • batch module with _batch variants 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_COLUMNS constant.

Changed

  • MSRV raised from 1.74 to 1.89.
  • Every fixed-node rule is now implemented once and shared by its scalar and _batch variants. 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 f64 for every float type, which is more accurate for f32.
  • romberg_method panics if n_columns exceeds MAX_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_method with more than 32 columns, it now panics; reduce n_columns.
  • If you compare results exactly against 0.3.x, expect last-bit differences.