You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[feat] Adding support for complex correlation matrices to GEVP routines - #302
This extends the existing GEVP functionality to complex Hermitian correlation matrices. With vector_obs=True one can also propagates the uncertainties of eigenvectors.
The crucial piece for the error propagation of the eigenvectors is the choice of the phase convention is $\mathrm{Im}(v_n^\dagger B,dv_n)=0$.
These derivatives are passed to derived_observable as a real-coordinate Jacobian, including uncertainties in both matrices and their correlations. Working directly with the complex eigensystem avoids the doubled eigenvalues of the real block representation discussed in #255. Genuine degeneracies still prevent the determination of the derivatives of the eigenvectors.
The existing real-matrix GEVP options are supported for complex input. Complex vector uncertainties use the derivatives above rather than differentiating the Cholesky decomposition. Projections use $v_l^\dagger C v_r$ (before we did not have to worry about the exact definition).
The many tests include matrices with prescribed eigenvalues and eigenvectors, checking their values, errors and correlations.
For now, this draft is intended for testing on the matrices motivating #255.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The real and imaginary component checks mishandle fixed complex entries in matrices containing CObs, leaving imaginary values unchanged in corr.real and returning zeros in corr.imag.
Extends the existing generalized eigenvalue routines to complex Hermitian correlation matrices, including optional propagation of eigenvector uncertainties.
Changes:
Adds complex eigensystem derivatives with a defined local phase convention.
Updates projections, pruning, and matrix helpers for complex input, and clarifies solver-failure handling.
Adds tests for covariance propagation, normalization, sorting, and prescribed eigensystems.
File
Description
tests/linalg_test.py
Tests complex eigenvector values and propagated covariance.
tests/correlators_test.py
Tests complex GEVP modes, projections, uncertainties, and failures.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Active issues can discard complex eigenvector components during sorting and raise AttributeError for mixed Obs/complex64 matrices, breaking supported GEVP and eigensolver inputs.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Promote eigenvector sorting reference to complex
pyerrors/correlators.py:1503
When C(t0) and C(ts) are real but another timeslice is complex, the sorting reference has a float dtype, so replacing its rows with complex vectors discards their imaginary components. This corrupts the determinant scores and can leave best_perm unassigned, causing GEVP(sort='Eigenvector') to fail. Promote the sorting reference to complex before replacing its rows.
Convert complex64 coordinates before derived-observable processing
pyerrors/linalg.py:418
A Hermitian object matrix mixing Obs entries with np.complex64 constants leaves np.float32 real and imaginary coordinates here. derived_observable only wraps Python int/float constants before accessing .cov_names, so eigh, eigv, and complex GEVPs with vector_obs=True raise AttributeError for this input. Preserve Obs components and convert the remaining coordinates to Python floats.
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
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.
This extends the existing GEVP functionality to complex Hermitian correlation matrices. With
vector_obs=Trueone can also propagates the uncertainties of eigenvectors.For$A=C(t)$ and $B=C(t_0)$ , we solve
with positive-definite$B$ . Error propagation uses the derivatives
The crucial piece for the error propagation of the eigenvectors is the choice of the phase convention is$\mathrm{Im}(v_n^\dagger B,dv_n)=0$ .
These derivatives are passed to
derived_observableas a real-coordinate Jacobian, including uncertainties in both matrices and their correlations. Working directly with the complex eigensystem avoids the doubled eigenvalues of the real block representation discussed in #255. Genuine degeneracies still prevent the determination of the derivatives of the eigenvectors.The existing real-matrix GEVP options are supported for complex input. Complex vector uncertainties use the derivatives above rather than differentiating the Cholesky decomposition. Projections use$v_l^\dagger C v_r$ (before we did not have to worry about the exact definition).
The many tests include matrices with prescribed eigenvalues and eigenvectors, checking their values, errors and correlations.
For now, this draft is intended for testing on the matrices motivating #255.