-
Notifications
You must be signed in to change notification settings - Fork 42
Add InverseMap for lazy inverse of a linear map. #184
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
cf0439e
to
3f179e9
Compare
Codecov Report
@@ Coverage Diff @@
## master #184 +/- ##
=======================================
Coverage 98.60% 98.61%
=======================================
Files 16 17 +1
Lines 1365 1373 +8
=======================================
+ Hits 1346 1354 +8
Misses 19 19
Continue to review full report at Codecov.
|
9d67671
to
c75d541
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.
Thanks for that very nice contribution! I have a few requests:
- Could you please add a short feature announcement in the
history.md
, perhaps together with the two verbal examples from the docstring: factorization andldiv!
, orLinearMap
and iterative solver. - Speaking of these two use cases, it would be nice to add two such examples to the title page of the documentation, where we currently briefly demonstrate how to use iterative eigensolvers.
- This PR currently adds very few methods for
InverseMap
, and therefore relies on many generic fallbacks:issymmetric
,ishermitian
,isposdef
,transpose
andadjoint
. I wonder if we can do a little better. The first three should inherit that property fromA
;transpose
andadjoint
can be thrown onA
because inversion and transposition commute. It would be good then to test that these work properly under multiplication.
c75d541
to
341b22d
Compare
Thanks for the review, I think I updated everything (also took the liberty to bump the version number). |
85c65b7
to
8cd2807
Compare
Should we add a little convenience with InverseMap(A::AbstractMatrix) = InverseMap(factorize(A)) ? I know it may not work in all cases, but as a default maybe not too bad? |
I thought about it too. However, Edit:
since that would try to factorize Edit 2: I guess you could do
to avoid it, but I feel like it is better to ask the user to provide an appropriate factorization. |
2071753
to
d3d46db
Compare
That's all true. Also, implicit conversion/modification is not done anywhere in this package (only wrapping), and |
42209e3
to
6d777a9
Compare
6d777a9
to
63f290f
Compare
I added some tests for 3- and 5 arg |
Thanks Fredrik once again. The tests are awesome, especially the last test example which showcases the seamless integration with |
It is basically the same as the example I included on the index page. I can expand on it I suppose. |
I liked the extra preconditioner bit and the "context", i.e., the comparison to the original blocked problem. But I guess you're right. That relates more to |
I'm happy to write a more comprehensive example, but doesn't feel like it fits on the index page where you just quickly want to showcase the package. |
If you don't mind the effort, then you could perhaps add a new page to the documentation on which we demonstrate in some more detail "advanced applications" (or something like this). That would be cool. The "original" blocked operator, for instance, could be built both as a matrix or as a |
@fredrikekre I think I was asking for too much. Let's keep the PR as is. We should pursuit the tutorial idea further, but perhaps first collect ideas on how to do it and what to present. One option could be to keep the presentation short and reference downstream packages. Another option could be to present some nice examples explicitly and in detail without necessarily being relevant in concrete use cases. In any case, I think some more thought is required on how to make it useful. |
I started on it already, but I will make a follow up PR instead then :) |
Idea from the
inverse_map
class in deal.ii: https://www.dealii.org/current/doxygen/deal.II/group__LAOperators.html#ga87e38fbde431397c069a88692bd24ae7 with example usage in https://www.dealii.org/current/doxygen/deal.II/step_20.html#SolvingusingtheSchurcomplementcc @kimauth