-
Notifications
You must be signed in to change notification settings - Fork 5
Add some tests for randomized SVD #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3b07931
7401ab3
42c448c
5e1f782
eb86e19
86eeb48
f9cd6d5
0da3837
bc586e5
3afd7bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -398,29 +398,20 @@ function svd_trunc_no_error!(A::AbstractMatrix, USVᴴ, alg::TruncatedAlgorithm{ | |
| (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! | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| do_gauge_fix && gaugefix!(svd_trunc!, Utr, Vᴴtr) | ||
|
|
||
| return Utr, Str, Vᴴtr | ||
| end | ||
|
|
||
| function svd_trunc!(A::AbstractMatrix, USVᴴ, alg::TruncatedAlgorithm{<:GPU_Randomized}) | ||
| U, S, Vᴴ = USVᴴ | ||
| check_input(svd_trunc!, A, (U, S, Vᴴ), alg.alg) | ||
| _gpu_Xgesvdr!(A, diagview(S), U, Vᴴ; alg.alg.kwargs...) | ||
|
|
||
| # TODO: make sure that truncation is based on maxrank, otherwise this might be wrong | ||
| (Utr, Str, Vᴴtr), _ = truncate(svd_trunc!, (U, S, Vᴴ), alg.trunc) | ||
|
|
||
| Utr, Str, Vᴴtr = svd_trunc_no_error!(A, USVᴴ, alg) | ||
| # normal `truncation_error!` does not work here since `S` is not the full singular value spectrum | ||
| normS = norm(diagview(Str)) | ||
| normA = norm(A) | ||
| # equivalent to sqrt(normA^2 - normS^2) | ||
| # but may be more accurate | ||
| ϵ = sqrt((normA + normS) * (normA - normS)) | ||
|
|
||
| do_gauge_fix = get(alg.alg.kwargs, :fixgauge, default_fixgauge())::Bool | ||
| do_gauge_fix && gaugefix!(svd_trunc!, Utr, Vᴴtr) | ||
|
|
||
| ϵ = sqrt((normA + normS) * abs(normA - normS)) | ||
| return Utr, Str, Vᴴtr, ϵ | ||
| end | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.