Skip to content

Defensive validation, numerical robustness, golub_welsch Result API (v0.2.0)#13

Merged
gvonness-apolitical merged 2 commits intomainfrom
fix/codebase-review-deferred-items
Mar 13, 2026
Merged

Defensive validation, numerical robustness, golub_welsch Result API (v0.2.0)#13
gvonness-apolitical merged 2 commits intomainfrom
fix/codebase-review-deferred-items

Conversation

@gvonness-apolitical
Copy link
Contributor

Summary

Addresses 12 deferred items from the codebase review, implemented in 5 phases by risk:

  • Input validation: Reject ±Inf (not just NaN) in tanh-sinh, oscillatory, Cauchy PV, and adaptive cubature. Replace partial_cmp().unwrap() with unwrap_or(Ordering::Equal). Promote debug_assert to assert in CubatureRule::new.
  • Numerical robustness: Split Lobatto n<2 error into ZeroOrder vs InvalidInput. Clamp global_error non-negative in adaptive cubature. Add dimension cap (d≤30). Clamp Newton iterates in Lobatto interior node computation.
  • Error estimation: Tanh-sinh non-convergence now reports |prev - prev_prev| instead of fabricated tol * 10.
  • Algorithm fixes: ln_gamma reflection uses .sin().abs().ln() to handle negative sin(πx). QUADPACK error simplification documented in gauss_kronrod.
  • Architecture (breaking): golub_welsch() returns Result, propagating QL non-convergence. All internal compute_* functions propagate via ?. Public constructors already returned Result, so most downstream callers are unaffected.

Bumps version to 0.2.0. Updates CHANGELOG, SECURITY (drops 0.1.x support), and README version references.

Test plan

  • cargo test --all-features — 263 tests pass (212 unit + 51 doc)
  • cargo clippy --all-features -- -D warnings — clean
  • cargo test --no-default-features — no_std mode passes
  • New tests: inf rejection (4 files), dimension cap, Lobatto error variants, tanh-sinh non-fabricated error, Jacobi negative α/β

…sult 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
@gvonness-apolitical gvonness-apolitical force-pushed the fix/codebase-review-deferred-items branch from 967378c to 196c62e Compare March 13, 2026 16:42
@gvonness-apolitical gvonness-apolitical merged commit 6ce2c8e into main Mar 13, 2026
6 checks passed
@gvonness-apolitical gvonness-apolitical deleted the fix/codebase-review-deferred-items branch March 13, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant