Skip to content

Conversation

@kshyatt
Copy link
Member

@kshyatt kshyatt commented Jan 23, 2026

Definitely open to feedback on this one but thought we should start testing this. Also simplified the implementation a bit to reduce repeated code.

@kshyatt kshyatt requested a review from lkdvos January 23, 2026 11:23
minmn = min(m, n)
S₀ = collect(svd_vals(A))
U1, S1, V1ᴴ, ϵ1 = @testinferred svd_trunc(A; alg)
@test collect(diagview(S1))[1:alg.k] ≈ S₀[1:alg.k]
Copy link
Member

Choose a reason for hiding this comment

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

Overall looks good, but this alg.k kind of sticks out a bit, do we always expect this property to be available?
On a separate note, should we think about whether or not the svd_trunc should really just output an S of length k to begin with?
That way, we can simply do:

@test collect(diagview(S1))  S₀[axes(S1, 1)]

Copy link
Member Author

Choose a reason for hiding this comment

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

Should I add a comment that we should revisit this? IDK if this has to be solved in this PR

@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/implementations/svd.jl 91.66% <100.00%> (+11.42%) ⬆️

... 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.

@kshyatt kshyatt force-pushed the ksh/randomized_svd branch from adb7cda to 3afd7bc Compare January 23, 2026 18:56
Copy link
Member

@lkdvos lkdvos left a comment

Choose a reason for hiding this comment

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

Looks like a strict improvement, ok to go for me!

As discussed, at some point we might want to revisit the entire randomized SVD (and other factorizations) approach in its entirety, but not today 😉

@kshyatt kshyatt merged commit e0f754c into main Jan 27, 2026
10 checks passed
@kshyatt kshyatt deleted the ksh/randomized_svd branch January 27, 2026 14:22
@lkdvos lkdvos mentioned this pull request Jan 29, 2026
(Utr, Str, Vᴴtr), _ = truncate(svd_trunc!, (U, S, Vᴴ), alg.trunc)

do_gauge_fix = get(alg.alg.kwargs, :fixgauge, default_fixgauge())::Bool
# the output matrices here are the same size as for svd_full!
Copy link
Member

Choose a reason for hiding this comment

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

I am confused about the conclusion of the resolved comments, and just about the validity of this comment in the code, as well as why it is here in between those two code lines. The arguments to gaugefix! on the line below are already truncated, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree this comment should not be here, good catch.

I got confused because the output from the CUSOLVER randomized SVD has the same size as the output from svd_full - the matrices are only reduced in size when we directly call truncate which is/was confusing to me. I think what I should do is a) fix this comment b) add more documentation explaining this.

lkdvos referenced this pull request Jan 30, 2026
* update changelog

* bump v0.6.4

* add list of contributors

* Update Project.toml

Co-authored-by: Jutho <Jutho@users.noreply.github.com>

---------

Co-authored-by: Jutho <Jutho@users.noreply.github.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.

3 participants