Skip to content

Improvements for Orthonormalize Symmetric and Canonical#652

Open
EricaCMitchell wants to merge 11 commits intom-a-d-n-e-s-s:masterfrom
EricaCMitchell:pr-orthonormalize_symmetric
Open

Improvements for Orthonormalize Symmetric and Canonical#652
EricaCMitchell wants to merge 11 commits intom-a-d-n-e-s-s:masterfrom
EricaCMitchell:pr-orthonormalize_symmetric

Conversation

@EricaCMitchell
Copy link
Collaborator

Description

Modifies orthonormalization routines for symmetric and canonical.

Details

  • Fixes transpose to conjugate transpose in orthonormalize_symmetric
  • orthonormalize_symmetric keeps track of linear dependencies based on a tolerance (default = 1e-12)
  • orthonormalize_symmetric warns user if linear dependencies are detected
  • orthonormalize_canonical performs more in-place modifications of U and s rather than storing them in new tensors
  • orthonormalize_canonical does not require lindep tolerance (default = 1e-12)
  • Added tests to testvmra for orthonormalize_symmetric and orthonormalize_canonical
  • Convenience routines for orthonormalize_* perform symmetric/Hermitian matrix_inner
  • Typos

Copy link
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 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_symmetric to use conjugate transpose and introduce a linear-dependence tolerance parameter with user warnings.
  • Update orthonormalize_canonical to do more in-place work and optionally remove linearly dependent modes.
  • Add new tests in testvmra.cc to 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.

Comment on lines +491 to +494
const auto s_i = s(i);
s(i) = 1.0 / sqrt(s_i);
(s_i > lindep) ? rank++ : nlindep++;
}
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
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.

1 participant