Skip to content

Refactor adaptive quadrature interval handling#4

Merged
alexandrehoffmann merged 7 commits into
mainfrom
refacto-integrate-with-hints
Jul 24, 2026
Merged

Refactor adaptive quadrature interval handling#4
alexandrehoffmann merged 7 commits into
mainfrom
refacto-integrate-with-hints

Conversation

@alexandrehoffmann

Copy link
Copy Markdown
Owner

Updated the scaling factor and improved interval handling in the adaptive quadrature implementation. Added checks for finite integrals and adjusted the logic for adding intervals to capture the entire support.

Updated the scaling factor and improved interval handling in the adaptive quadrature implementation. Added checks for finite integrals and adjusted the logic for adding intervals to capture the entire support.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors AdaptiveQuadratureBase::integrateWithHints interval construction to better cover the integrand’s support, while also simplifying several integration helpers’ return logic.

Changes:

  • Adjusts the peak-neighborhood scaling factor and refactors how hint-based peak intervals are created/merged.
  • Adds logic intended to insert “gap” intervals between peak intervals and extends the interval set at the front/back using Gauss–Laguerre estimates.
  • Simplifies several functions by returning conditional expressions directly (removing temporary ret variables).
Comments suppressed due to low confidence (1)

include/LNIT/AdaptiveQuadratures/AdaptiveQuadratureBase_impl.hpp:153

  • The "Second pass" loop inserts into m_intervals while iterating over it, which changes indices and causes the next iteration to compare an inserted gap interval against the following original interval. That makes the assertion fail (gap.second == next.first) and can also lead to incorrect/degenerate intervals. This block also assumes m_intervals is non-empty (mu could be empty), but later code uses front()/back(). Consider rebuilding the expanded interval list in a separate vector and early-returning when no hint intervals were produced.
	// Second pass: add interval in between the previously computed intervals 
	for (size_t i=0; i+1!=m_intervals.size(); ++i)
	{
		assert(m_intervals[i].second != m_intervals[i+1].first);
		m_intervals.emplace(std::next(m_intervals.begin(), i + 1), m_intervals[i].second, m_intervals[i+1].first);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread include/LNIT/AdaptiveQuadratures/AdaptiveQuadratureBase_impl.hpp Outdated
alexandrehoffmann and others added 3 commits July 24, 2026 18:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread include/LNIT/AdaptiveQuadratures/AdaptiveQuadratureBase_impl.hpp
Comment thread include/LNIT/AdaptiveQuadratures/AdaptiveQuadratureBase_impl.hpp Outdated
@alexandrehoffmann
alexandrehoffmann merged commit a709e36 into main Jul 24, 2026
5 checks passed
@alexandrehoffmann
alexandrehoffmann deleted the refacto-integrate-with-hints branch July 25, 2026 09:39
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.

3 participants