-
Notifications
You must be signed in to change notification settings - Fork 2
More matrix factorizations #52
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #52 +/- ##
==========================================
- Coverage 95.91% 95.42% -0.49%
==========================================
Files 14 15 +1
Lines 489 459 -30
==========================================
- Hits 469 438 -31
- Misses 20 21 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Definitely a good idea to have a submodule for this.
I feels a bit odd that there are some functions that exist there and some that do not (eg svdvals
), but I guess MatrixAlgebra
is not meant to be used outside of this package and then this does not matter?
@lkdvos thanks for the thoughtful comments, I'll go through them. |
Good catch. I originally left out |
@lkdvos I think I've addressed all of your comments, let me know what you think. |
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.
Overall looks good to me!
Just wanted to share some thoughts I had while reading through this, in the end this is completely subjective and shouldn't have any major implications, but I did want to know how you feel about this:
While the @eval
loops are nice, there are definitely also some drawbacks associated to them:
- I do feel it becomes more involved to read the source code and immediately capture what is going on.
- Static analysis tools have a harder time dealing with this, for example Cthulhu combined with VSCode has a harder time mapping type analysis to source code statements (since the source code statements are somewhat hidden).
- It becomes somewhat tricky to debug when you want to insert some print statements.
All of this just to highlight that macros don't come without drawbacks.
Here, in most cases I do think they are warranted and nice, but for example for the "loop"s over eigen
and eigen!
, and similarly the other in-place vs non-inplace versions I'm a bit more on the fence: the benefit in terms of convenience might not outweigh the drawbacks. Ultimately I don't think there is a "right" choice, but I don't think it's bad to bring this up and actively consider it every now and again :)
That's fair, I definitely don't like to overuse macros and it is good to assess where it is really worth it. Here I liked it because it guarantees that the logic across definitions are exactly the same. Some of definitions I think are long enough to warrant using |
This moves logic for selecting the proper MatrixAlgebraKit.jl matrix factorization from the tensor level to the matrix level by introducing a submodule
TensorAlgebra.MatrixAlgebra
. This enables making some of the tensor factorization definitions more compact by generating them in an@eval
loop. It also introduces new shorthand factorizationspolar
andorth
, where left or right can be selected with a keyword argument.