Skip to content

Fix _check_conj_split missing negative-imaginary eigenvalues - #62

Closed
Marius1311 wants to merge 1 commit into
mainfrom
fix/check-conj-split-abs-imag
Closed

Marius1311 wants to merge 1 commit into
mainfrom
fix/check-conj-split-abs-imag

Conversation

@Marius1311

Copy link
Copy Markdown
Collaborator

The _check_conj_split function only checked last_eigenvalue.imag > EPS, which missed cases where the negative-imaginary part of a conjugate pair appeared at the split boundary. This caused silent failures to detect complex conjugate splits, leading to incorrect crispness values.

With newer scipy/numpy versions, LAPACK may return conjugate pairs with the negative-imaginary eigenvalue first, triggering this latent bug.

Changes:

  • Use abs(last_eigenvalue.imag) > EPS in _check_conj_split
  • Add normalize_conj_pairs test helper for canonical conjugate pair ordering
  • Use normalized ordering in eigenvalue assertions in test_P_2_LM/LR

The _check_conj_split function only checked last_eigenvalue.imag > EPS,
which missed cases where the negative-imaginary part of a conjugate pair
appeared at the split boundary. This caused silent failures to detect
complex conjugate splits, leading to incorrect crispness values.

With newer scipy/numpy versions, LAPACK may return conjugate pairs with
the negative-imaginary eigenvalue first, triggering this latent bug.

Changes:
- Use abs(last_eigenvalue.imag) > EPS in _check_conj_split
- Add normalize_conj_pairs test helper for canonical conjugate pair ordering
- Use normalized ordering in eigenvalue assertions in test_P_2_LM/LR
@Marius1311

Copy link
Copy Markdown
Collaborator Author

Superseded by #75, which includes the abs() fix. Instead of normalising pair order in the tests, sorted_brandts_schur now returns pairs positive-imaginary-first. The negative-first order showed up only with Apple Accelerate (#68); on OpenBLAS and SLEPc every pair checked was positive-first.

@Marius1311 Marius1311 closed this Nov 13, 2026
Marius1311 added a commit that referenced this pull request Nov 13, 2026
_check_conj_split only flagged a cut when the eigenvalue at the boundary had
a positive imaginary part. With Apple Accelerate, the Brandts sort can leave
a 2x2 block whose pair comes out negative-first, so a cut went unnoticed and
GPCCA used a non-invariant subspace. Check abs(imag), and read eigenvalues off
the Schur blocks with the positive imaginary part first instead of rsf2csf.
Test macOS on PyPI wheels (Accelerate).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Marius1311 added a commit that referenced this pull request Nov 13, 2026
_check_conj_split only flagged a cut when the eigenvalue at the boundary had
a positive imaginary part. With Apple Accelerate, the Brandts sort can leave
a 2x2 block whose pair comes out negative-first, so a cut went unnoticed and
GPCCA used a non-invariant subspace. Check abs(imag), and read eigenvalues off
the Schur blocks with the positive imaginary part first instead of rsf2csf.
Test macOS on PyPI wheels (Accelerate).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Marius1311
Marius1311 deleted the fix/check-conj-split-abs-imag branch November 13, 2026 14:27
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