Skip to content

Add (I-UU^T)dAVΣ^{-1} projector terms for rectangular SVD - #15

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

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

Conversation

@sriharikrishna

Copy link
Copy Markdown
Collaborator

For non-square matrices (m≠n), the thin SVD derivative formulas require null-space projector terms: (I-UU^T)dA V Σ^{-1} for dU when m>k, and (I-VV^T)dA^T U Σ^{-1} for dV when n>k. These were already present in the complex variants (zgesvd_d, cgesvd_d) but missing from the real variants.

Files changed:

  • dgesvd_d.f90, sgesvd_d.f90: add projector blocks after omega*GEMM
  • dgesvd_dv.f90, sgesvd_dv.f90: add projector blocks inside ndir loop, defer ad_dir deallocation so projectors can use it

sriharikrishna and others added 2 commits December 4, 2026 12:22
For non-square matrices (m≠n), the thin SVD derivative formulas require
null-space projector terms: (I-UU^T)dA V Σ^{-1} for dU when m>k, and
(I-VV^T)dA^T U Σ^{-1} for dV when n>k. These were already present in
the complex variants (zgesvd_d, cgesvd_d) but missing from the real
variants.

Files changed:
- dgesvd_d.f90, sgesvd_d.f90: add projector blocks after omega*GEMM
- dgesvd_dv.f90, sgesvd_dv.f90: add projector blocks inside ndir loop,
  defer ad_dir deallocation so projectors can use it

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the old explicit (I-UU^T) construction with the cleaner
projector formula matching the real variants:
- dU += (I-UU^T) * dA * V * Σ^{-1}  when m > k
- dV += (I-VV^T) * dA^T * U * Σ^{-1} when n > k

Applied to zgesvd_d, zgesvd_dv, cgesvd_d, cgesvd_dv.

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