-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
alg
keyword for svd and svd!
#31057
alg
keyword for svd and svd!
#31057
Conversation
Can you add some tests? I'm not sure I like |
FWIW |
Sure. What should I test? Only that the keyword argument exists or also that the results differ (maybe for something as in #31023)? BTW, I can't find tests for the |
I would test first that the keywords are accepted and that the results look like correct SVDs, i.e.:
|
This is being discussed on Slack. @andreasnoack pointed out the he made a similar change in Maybe it's better to call the keyword The remaining questions seem to be:
FWIW, I'd say verbosity might be ok here. It makes the code more self-explanatory and, given that this feature was absent for this long, people will only use this option very rarely. |
alg
keyword for svd and svd!method
keyword for svd and svd!
Possibly but keep in mind that "method" already has a fairly well-established meaning in programming languages which does not really agree with this meaning. It's fine to call these methods informally but "algorithm" seems both more precise and less confusing in this context. |
Someone pointed out on Slack (I forgot who), that we do use I'm not hugely keen on using symbols as enums though. |
I said that in a comment in this PR 5 days ago. 😐 |
I think we should consider using a struct for this. Then the |
Alright, I updated (and rebased) this one. I'm unsure about naming. I introduced abstract type SVDAlgorithm end
struct DivideAndConquer <: SVDAlgorithm end
struct Simple <: SVDAlgorithm end but in particular |
Some of these types might make sense across more than a single factorization e.g. there is also a divide and conquer version of the symmetric tridiagonal eigensolver so either we should just have a shared |
I'm also not too keen on the name "Simple". That doesn't really narrow it down enough. Does this simple algorithm not have a proper name? Any linalg folks know what this is called? |
Golub and Van Loan just call it "The SVD Algorithm". From this paper on the history of the SVD
The referenced papers are: "Golub-Kahan" usually refers to the bidiagonalization step. So I guess we could call it Maybe @higham might be able to help here. |
Alright, would be great if someone could review this. AFAICT, the two run failures are unrelated. |
bump :) |
Would be great if this would make it into 1.3. Could someone review this before feature freeze? |
FWIW, I have reviewed, but note that I am not a core dev so I am not sure how much it helps. I just really like the change and would also love to see it in 1.3. |
@andreasnoack, could you possibly find the time to review this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It mostly looks ready to go. I've added a few comments and suggestions.
Co-Authored-By: Andreas Noack <andreas@noack.dk>
Implemented the comments by @andreasnoack. Tests pass locally. |
@fredrikekre I've forgotten how we add the compat annotations. Could you help us out here? |
Until when does this have to be merged to be in 1.3? |
In the docstring for the function, add
|
@ararslan the keyword argument is named I added the compat annotation and fixed the NEWS.md conflict. |
method
keyword for svd and svd!alg
keyword for svd and svd!
Great addition; I had this in some local packages. 1.3 will be a great release. |
This PR adds an
alg
keyword tosvd
andsvd!
which allows the user to switch between a divide-and-conquer algorithm (default,LAPACK.gesdd!
) and a simple algorithm (LAPACK.gesvd!
).In the future, Jacobi methods could also be added. (#31080)
See #31023 and https://discourse.julialang.org/t/svd-better-default-to-gesvd-instead-of-gesdd/20603 for related discussions.
Closes #31023.