Conversation
Member
Author
|
Argh, TIL, if the PR title is empty the PR message will be replaced by the template. Just a sec writing the PR message again |
Member
Author
|
PR message fixed |
WardBrian
reviewed
Sep 15, 2026
Member
Author
Excatly the same table, otherwise I would have shown the new table. |
Member
Author
|
Trimmed docs and tests. Passing evaluation counters by reference |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3392 with minimal approach (not fixing minor atol behavior continuity issue and not fixing the wasted ajoint computation).
Summary
Boost's adaptive Gauss-Kronrod recursion already accepts an absolute-error budget and honours it in its leaf criterion —
recursive_adaptive_integrate(info, a, b, max_levels, abs_tol, error, L1). Only the publicintegrate()entry point is missing a way to set it: it hard-codesReal(0)at all five call sites.Two changes:
Real abs_tol = Real(0)parameter ongauss_kronrod<Real, N>::integrate(), forwarded at the five recursion entry pointsabsolute_tolerancethrough — one lineThe parameter is trailing and defaults to the value previously hard-coded, so every existing Boost caller is unaffected and their quadrature is bit-for-bit unchanged.
Add abs_tol parameter to vendored Boost gauss_kronrod::integrate: the patch,STAN_CHANGES,.gitattributesFix Gauss-Kronrod order in docs: the pair is (G10,K21), not (G21,K21): pre-existing typo, 7 occurrences.Apply absolute tolerance during Gauss-Kronrod refinement: the Stan line, documentation, tests.absolute_tolerance == 0is Boost's sentinel for "derive the refinement budget from the root panel's own relative target", not "no absolute floor". A positive but negligible value therefore removes that derived budget and can refine slightly more than zero does. That is in the safe direction.Tests
prim 14, rev 18, mix 2, all passing.
positive_abs_tol_reduces_work_on_negligible_integranddoubles as the guard on the vendored patch: ifabsolute_toleranceever stops reaching refinement, the two evaluation counts become equal and it fails. Also covered: work bounded on an unresolvable integrand, monotonicity inabs_tol, the throw still firing when unconverged,max_depth = 0, and all four limit transforms.The saves in evals is already documented in #3392
Follow-ups, not in this PR
integrate_1d_adjointruns one quadrature per var scalar and does a full reverse sweep at each node while keeping a single adjoint. Batching them onto one shared partition is a further ~8× on this model and needs no additional Boost change, but it touches adjoint code shared withintegrate_1d, so maybe another PR?Side Effects
No
Release notes
Checklist
Copyright holder: Aki Vehtari
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
./runTests.py test/unit)make test-headers)make test-math-dependencies)make cpplint)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested