Improvements for Orthonormalize Symmetric and Canonical#652
Improvements for Orthonormalize Symmetric and Canonical#652EricaCMitchell wants to merge 11 commits intom-a-d-n-e-s-s:masterfrom
Conversation
…l be symmetric (real) / hermitian (complex)
There was a problem hiding this comment.
Pull request overview
This PR updates the symmetric and canonical orthonormalization routines to better support complex-valued overlaps (via conjugate transpose), add/standardize linear-dependence handling, and adds new VMRA tests covering both routines.
Changes:
- Update
orthonormalize_symmetricto use conjugate transpose and introduce a linear-dependence tolerance parameter with user warnings. - Update
orthonormalize_canonicalto do more in-place work and optionally remove linearly dependent modes. - Add new tests in
testvmra.ccto validate orthonormality for both routines (real and complex, small and non-small test modes).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/madness/mra/vmra.h |
Modifies symmetric/canonical orthonormalization logic, tolerance handling, and overlap computation flags. |
src/madness/mra/testvmra.cc |
Adds tests for both orthonormalization routines and wires them into main(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const auto s_i = s(i); | ||
| s(i) = 1.0 / sqrt(s_i); | ||
| (s_i > lindep) ? rank++ : nlindep++; | ||
| } |
There was a problem hiding this comment.
Eigenvalues at/below the linear-dependence threshold are still inverted via 1.0 / sqrt(s_i). For near-zero (or slightly negative) eigenvalues this will produce inf/NaN and corrupt X. Only apply the inverse-sqrt when s_i > lindep (and > 0), and set the scaling to 0 (or otherwise handle via pseudoinverse / truncation) for dependent modes.
Description
Modifies orthonormalization routines for symmetric and canonical.
Details
orthonormalize_symmetricorthonormalize_symmetrickeeps track of linear dependencies based on a tolerance (default = 1e-12)orthonormalize_symmetricwarns user if linear dependencies are detectedorthonormalize_canonicalperforms more in-place modifications ofUandsrather than storing them in new tensorsorthonormalize_canonicaldoes not requirelindeptolerance (default = 1e-12)testvmrafororthonormalize_symmetricandorthonormalize_canonicalorthonormalize_*perform symmetric/Hermitianmatrix_inner