Skip to content

svd_vals(::DiagonalTensorMap) should return a SectorVector#333

Merged
kshyatt merged 8 commits into
mainfrom
ld-diagvals
Dec 23, 2025
Merged

svd_vals(::DiagonalTensorMap) should return a SectorVector#333
kshyatt merged 8 commits into
mainfrom
ld-diagvals

Conversation

@lkdvos

@lkdvos lkdvos commented Dec 19, 2025

Copy link
Copy Markdown
Member

Noticed some test failures in #325 due to the diagonal algorithms not returning a SectorVector, so I fixed that, added some tests and then found some other inconsistencies: svd_vals was sorting the entire SectorVector, effectively mixing up the blocks.

Both of these are fixed here.

@codecov

codecov Bot commented Dec 19, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/factorizations/diagonal.jl 83.33% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/factorizations/factorizations.jl 94.11% <ø> (+5.22%) ⬆️
src/factorizations/diagonal.jl 76.92% <83.33%> (+12.82%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lkdvos
lkdvos requested a review from Jutho December 19, 2025 18:57
Comment thread src/factorizations/diagonal.jl Outdated
@Jutho

Jutho commented Dec 21, 2025

Copy link
Copy Markdown
Member

I also noticed a small mistake in the PR that added LinearAlgebra.svd support. For a matrix, svd returns U, S as a vector, V as the adjoint of a matrix (Vᴴ). So I guess we want to replicate this, and thus have something like

U, S, Vᴴ = svd_compact(t) # or svd_full
return U, diagview(S), adjoint(Vᴴ)

Maybe you can also include this in the current PR?

@kshyatt kshyatt mentioned this pull request Dec 22, 2025
@kshyatt

kshyatt commented Dec 22, 2025

Copy link
Copy Markdown
Member

Added a small fix to address @Jutho's comment (hopefully)

@lkdvos

lkdvos commented Dec 22, 2025

Copy link
Copy Markdown
Member Author

I'm slightly worried that the diagview will fail for the full case, since we don't return a diagonal in that case. LinearAlgebra actually outputs things that don't multiply correctly there, and I'm not sure how we want to handle this?

@lkdvos

lkdvos commented Dec 22, 2025

Copy link
Copy Markdown
Member Author

I guess this is why we didn't overload the linearalgebra methods 😂

@kshyatt

kshyatt commented Dec 22, 2025

Copy link
Copy Markdown
Member

I'm slightly worried that the diagview will fail for the full case, since we don't return a diagonal in that case. LinearAlgebra actually outputs things that don't multiply correctly there, and I'm not sure how we want to handle this?

Should I just add a test for full and see what happens?

@kshyatt

kshyatt commented Dec 22, 2025

Copy link
Copy Markdown
Member

Alternatively: is anyone actually using these overloads? Can we just remove them, for now?

@lkdvos

lkdvos commented Dec 22, 2025

Copy link
Copy Markdown
Member Author

I'm happy to remove them again, definitely is independent of this PR

@kshyatt

kshyatt commented Dec 22, 2025

Copy link
Copy Markdown
Member

Since they don't seem to be tested anyway I say kill em all!!!

@lkdvos lkdvos left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think there's still an entry in the changelog that can be deleted again, afterwards I would just merge this

@kshyatt

kshyatt commented Dec 23, 2025

Copy link
Copy Markdown
Member

Nightly failures are the same Zygote stuff as usual. Is this good to go?

@kshyatt
kshyatt merged commit 8d63119 into main Dec 23, 2025
39 of 42 checks passed
@kshyatt
kshyatt deleted the ld-diagvals branch December 23, 2025 10:23
@lkdvos lkdvos mentioned this pull request Feb 4, 2026
Jutho referenced this pull request Feb 6, 2026
* bump v0.16.1

* update changelog
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.

3 participants