You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Defensive validation, numerical robustness, golub_welsch Result API (v0.2.0) (#13)
* Defensive input validation, numerical robustness, and golub_welsch Result API (v0.2.0)
Address 12 deferred codebase review items across 5 phases:
- Reject ±Inf (not just NaN) in tanh-sinh, oscillatory, Cauchy PV, cubature
- Replace partial_cmp().unwrap() with unwrap_or(Ordering::Equal)
- Promote debug_assert to assert in CubatureRule::new
- Split Lobatto n<2 error into ZeroOrder (n=0) vs InvalidInput (n=1)
- Clamp global_error to non-negative in adaptive cubature
- Add dimension cap (d≤30) for adaptive cubature
- Clamp Newton iterates in Lobatto interior node computation
- Fix tanh-sinh non-convergence error: use last two estimates instead of fabricated tol*10
- Fix ln_gamma reflection: .sin().ln() → .sin().abs().ln()
- Document QUADPACK error simplification in gauss_kronrod
- Make golub_welsch return Result, propagate through all compute_* functions
- Bump version to 0.2.0, update CHANGELOG, SECURITY, README
* Run cargo fmt
Copy file name to clipboardExpand all lines: CHANGELOG.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,30 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
8
-
## [0.1.0] - Unreleased
8
+
## [0.2.0] - 2026-03-13
9
+
10
+
### Changed
11
+
12
+
-**Breaking:**`golub_welsch()` now returns `Result`, propagating QL non-convergence as `QuadratureError::InvalidInput` instead of silently returning inaccurate nodes/weights. All internal `compute_*` functions in `gauss_jacobi`, `gauss_laguerre`, `gauss_hermite`, and `gauss_radau` propagate accordingly. Public constructors already returned `Result`, so most callers are unaffected.
13
+
-**Breaking:**`GaussLobatto::new(0)` now returns `QuadratureError::ZeroOrder` (previously `InvalidInput`). `GaussLobatto::new(1)` still returns `InvalidInput`.
14
+
- Input validation for `tanh_sinh`, `oscillatory`, `cauchy_pv`, and `cubature::adaptive` now rejects `±Inf` bounds (not just `NaN`). Error variant is unchanged (`DegenerateInterval`).
15
+
-`CubatureRule::new` assertion promoted from `debug_assert_eq!` to `assert_eq!`.
16
+
- Tanh-sinh non-convergence error estimate now uses the difference between the last two level estimates instead of a fabricated `tol * 10` value.
17
+
- QUADPACK error estimation heuristic in `gauss_kronrod` documented as an intentional simplification of the full formula.
18
+
19
+
### Fixed
20
+
21
+
-`ln_gamma` reflection formula: `.sin().ln()` → `.sin().abs().ln()` prevents `NaN` for negative arguments where `sin(π·x)` is negative (affects Gauss-Jacobi with certain α, β near negative integers).
22
+
- Newton iteration in Gauss-Lobatto interior node computation now clamps iterates to `(-1+ε, 1-ε)`, preventing division by zero in the `P''` formula when an iterate lands on ±1.
23
+
-`partial_cmp().unwrap()` in `golub_welsch` and `gauss_lobatto` sort replaced with `.unwrap_or(Ordering::Equal)` to avoid panics on NaN nodes.
24
+
- Adaptive cubature `global_error` subtraction clamped to `max(0.0)` to prevent negative error estimates from floating-point cancellation.
25
+
26
+
### Added
27
+
28
+
- Dimension cap (d ≤ 30) for adaptive cubature — returns `InvalidInput` for higher dimensions where Genz-Malik's `2^d` vertex evaluations would be impractical.
0 commit comments