Skip to content

Rewrite QGQ into DQ module#16

Merged
tovrstra merged 3 commits intomolmod:mainfrom
tovrstra:dq
Mar 8, 2026
Merged

Rewrite QGQ into DQ module#16
tovrstra merged 3 commits intomolmod:mainfrom
tovrstra:dq

Conversation

@tovrstra
Copy link
Copy Markdown
Member

@tovrstra tovrstra commented Mar 7, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR rewrites the stacie.qgq (Quasi-Gaussian Quadrature) module into a new stacie.dq (Designed Quadrature) module. The new module uses a fundamentally different optimization approach — a custom modified Levenberg-Marquardt algorithm with an orthogonal regularization scheme — replacing the previous L-BFGS-B optimizer from scipy. This results in better numerical stability and more control over the optimization. An analytical dq3 helper for 3-point quadrature is also added.

Changes:

  • New src/stacie/dq.py: Complete rewrite of the QGQ algorithm with the new DQ formulation using fixed (equal or user-specified) weights, a custom LM solver, and a new Equations class encapsulating the constraint system.
  • Updated tests: tests/test_qgq.py removed and replaced by the more comprehensive tests/test_dq.py, adding unit tests for individual methods (apply_sym, backprop_sym, proj, pen, solve_weights, dq3).
  • Updated documentation: docs/source/examples/qgq.py replaced by docs/source/examples/dq.py with an expanded tutorial, new BibTeX references added, changelog updated.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
src/stacie/dq.py New DQ module (699 lines) replacing qgq.py; new Equations class, solve_modified_lm, dq3 function, and public API
tests/test_dq.py New test file with more granular unit tests for the DQ internals
tests/test_qgq.py Removed (replaced by test_dq.py)
src/stacie/qgq.py Removed (replaced by dq.py)
docs/source/examples/dq.py New example notebook (450 lines) with DQ tutorial and regression tests
docs/source/examples/qgq.py Removed (replaced by dq.py)
docs/source/examples/index.md Updated to reference dq.py instead of qgq.py
docs/source/references.bib Added two new BibTeX entries for Chebyshev quadrature literature
docs/source/development/changelog.md Added changelog entry for the new stacie.dq module

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

Comment thread src/stacie/dq.py Outdated
Comment thread src/stacie/dq.py Outdated
Comment thread src/stacie/dq.py Outdated
Comment thread src/stacie/dq.py Outdated
Comment thread docs/source/examples/dq.py Outdated
Comment thread src/stacie/dq.py Outdated
Comment thread src/stacie/dq.py Outdated
Comment thread src/stacie/dq.py Outdated
Comment thread docs/source/development/changelog.md
Comment thread docs/source/references.bib Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 9 out of 9 changed files in this pull request and generated 2 comments.


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

Comment thread tests/test_dq.py Outdated
Comment thread src/stacie/dq.py Outdated
@tovrstra tovrstra merged commit 44f2897 into molmod:main Mar 8, 2026
7 checks passed
@tovrstra tovrstra deleted the dq branch March 8, 2026 10:35
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.

2 participants