-
Notifications
You must be signed in to change notification settings - Fork 30
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
Low Rank dispatch rules #57
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #57 +/- ##
==========================================
+ Coverage 78.44% 78.78% +0.33%
==========================================
Files 36 36
Lines 2974 2988 +14
==========================================
+ Hits 2333 2354 +21
+ Misses 641 634 -7
☔ View full report in Codecov by Sentry. |
ca09dd6
to
0ae5c03
Compare
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.
Great work @Fr0do 🙏, this is a nice little addition showcasing some of the more complicated dispatch rules 🚀
Let's see if we can generalize this even further with some additional types (U,V need not be dense, Diagonal can be made more general). If you don't get to it, that's fine too, I can finish up with some additional cases later this week
U, V = A.Ms[0].Ms | ||
D_inv = inv(A.Ms[1], **kwargs) | ||
I = Identity(shape=(V.shape[0], U.shape[1]), dtype=V.dtype) | ||
return D_inv - D_inv @ U @ inv(V @ D_inv @ U + I, **kwargs) @ V @ D_inv |
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.
very clean!
|
||
|
||
@dispatch | ||
def inv(A: Sum[Product[Dense,Dense], Diagonal], **kwargs): |
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.
We should be able to generalize this to
Sum[Product[LinearOperator,LinearOperator]
right?
Also I believe we should be able to generalize Diagonal
to efficiently_invertible = Union[Diagonal, Identity, ScalarMul]
, we could extend that further to Triangular, Permutation
.
I didn't realize you're on a fork, I made some edits and here is a diff: Though the tests pass (with the adjustment to take into account that |
Is there a way to work collaboratively? I can add mainainers of CoLA to my fork as collaborators. Or maybe there is a way I can create a branch in your repo? |
Low-rank dispatch rules for Woodbury Identity case of
inv
and computationally effectivetrace
of low-rank product, resolves #48