Skip to content

Fix DGEEV_D eigenvector derivatives: normalization, complex pairs, le… - #16

Merged
sriharikrishna merged 2 commits into
mainfrom
shk/fix-dgeev-d
Dec 5, 2026
Merged

sriharikrishna merged 2 commits into
mainfrom
shk/fix-dgeev-d

Conversation

@sriharikrishna

Copy link
Copy Markdown
Collaborator

…ft eigenvectors

Three fixes to the forward-mode differentiated DGEEV:

  1. Add normalization correction for eigenvector derivatives. DGEEV normalizes eigenvectors to unit 2-norm, so dv must satisfy v^T*dv = 0. The perturbation formula produces dv in the span of other eigenvectors, which is not Euclidean-orthogonal to v for non-symmetric matrices. Project out the v-component after summing.

  2. Add complex conjugate pair eigenvector derivatives. The original code only handled real-real eigenvalue coupling. Now handles all four cases: real-real, real-complex, complex-real, complex-complex, with proper complex arithmetic in LAPACK's real storage format.

  3. Add left eigenvector derivatives using du_i = sum_{j!=i} [(v_j^H * dA^T * u_i) / ((lambda_i* - lambda_j*) * (v_j^H * u_j))] * u_j with the same normalization correction and complex pair handling.

Test covers both all-real eigenvalues and a matrix with two complex conjugate pairs (3+/-2i, 8+/-1.5i). All derivatives match central FD to <1e-8 relative error.

sriharikrishna and others added 2 commits December 4, 2026 12:48
…ft eigenvectors

Three fixes to the forward-mode differentiated DGEEV:

1. Add normalization correction for eigenvector derivatives. DGEEV
   normalizes eigenvectors to unit 2-norm, so dv must satisfy
   v^T*dv = 0. The perturbation formula produces dv in the span of
   other eigenvectors, which is not Euclidean-orthogonal to v for
   non-symmetric matrices. Project out the v-component after summing.

2. Add complex conjugate pair eigenvector derivatives. The original
   code only handled real-real eigenvalue coupling. Now handles all
   four cases: real-real, real-complex, complex-real, complex-complex,
   with proper complex arithmetic in LAPACK's real storage format.

3. Add left eigenvector derivatives using du_i = sum_{j!=i}
   [(v_j^H * dA^T * u_i) / ((lambda_i* - lambda_j*) * (v_j^H * u_j))] * u_j
   with the same normalization correction and complex pair handling.

Test covers both all-real eigenvalues and a matrix with two complex
conjugate pairs (3+/-2i, 8+/-1.5i). All derivatives match central FD
to <1e-8 relative error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add right/left eigenvector derivatives and normalization correction to:
- sgeev_d (single precision real, with complex conjugate pair handling)
- cgeev_d, zgeev_d (complex: simplified, no conjugate pair trick)
- dgeevx_d, sgeevx_d, cgeevx_d, zgeevx_d (expert variants)

The _dv wrappers call _d routines in a loop, so they inherit these
fixes automatically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sriharikrishna
sriharikrishna merged commit 3b7ed86 into main Dec 5, 2026
6 checks passed
sriharikrishna added a commit that referenced this pull request Dec 6, 2026
Resolve conflicts in 20 files: geev/gees _d source and test files
take our analytical versions (supersede PRs #13, #16); gesvd_dv files
take main's SVD fixes (PRs #14, #15).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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