Repository navigation
Fix spinon Barnes defaults with optional Uni20 term budgets - #128
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟢 Approval recommended
The review identifies no unresolved issues, and the changes preserve explicit-limit validation while covering default and supported-precision Barnes behavior with focused regressions.
No open issues 🎉
What changed in this PR
Updates Bethe’s spinon Barnes coefficient-budget handling for compatibility with Uni20’s optional max_terms, while preserving strict validation for explicitly configured limits. Adds focused numerical regressions across native and MPFR configurations.
Changes:
- Normalize legacy integer and optional coefficient budgets before applying Barnes guards.
- Allow default construction when no budget is set while rejecting insufficient explicit budgets.
- Add Barnes identity and budget regression tests for native and MPFR precisions.
- Register the new regression executable with CTest.
| File | Description |
|---|---|
include/bethe/detail/spinon_barnes.hpp |
Applies native and MPFR coefficient-budget checks only when an explicit budget is set. |
tests/test_spinon_barnes.cpp |
Tests default construction, Barnes identity evaluation, and sufficient or insufficient budgets across supported precisions. |
tests/CMakeLists.txt |
Builds and discovers the new Barnes regression test executable. |
Review effort: Lite
|
Claude review of exact head Found 1 issue, in the test rather than the fix; details in the inline comment on What the PR does.
What I reviewed.
Verified. All runs: GCC 13.3, Release, x86_64 (80-bit
Not checked.
Review tier: full (code or new pull request) · model: claude-opus-5-5 · effort: high |
Uni20 PR #118 makes
log_gamma_options::max_termsoptional. An unset limit compares below an integer, so both Bethe Barnes coefficient guards reject default construction with the new dependency: native contexts throw “Barnes requires sixteen native coefficients” and MPFR contexts throw “Barnes precision exceeds coefficient budget”.Normalize the legacy integer/new optional field to an optional budget and enforce it only when set. Explicit limits remain strict, the existing coefficient-count formulas are unchanged, and Bethe's Uni20 pin remains at
ca350254.Added focused numerical regressions for default and explicit budgets in double, long double, and MPFR at 128/256 bits, checking the independent identity
G(4)=2and end-to-end rejection of insufficient explicit caps. In MPFR, Gamma is constructed first and adds its own 64 guard bits to Bethe's working precision: it requiresfloor((p+128)/6)+8coefficients versus Bethe'sfloor((p+64)/6)+8. Gamma therefore rejects insufficient explicit caps before Bethe's defensive guard. That assertion does not independently cover the Bethe MPFR guard; default construction is the discriminating regression for the unset-budget bug. Native explicit-cap tests exercise Bethe's own guard.Validation at
2579ad0: all three tests fail before the fix with Uni20697e49e7; all three pass afterward with both697e49e7and pinnedca350254(GCC 13, Release, MPFR enabled). CTest discovers all three cases. Follow-up643f6d3changes comments only; non-comment source and whitespace were checked without rerunning numerical tests. Existing pinned production is unaffected; this is a consumer compatibility fix for newer dependency overrides.