-
Notifications
You must be signed in to change notification settings - Fork 56
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
Refactor LinearOperator for method overriding #735
Refactor LinearOperator for method overriding #735
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
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 taking care of this! 🙏🏻
Some general points:
- Instead of just saying "You may implement this method in a subclass.", we should probably state that overriding the default implementation only makes sense if we know a more efficient implementation (in terms of memory or computation time) than the fallback.
- Can you get rid of the double underscores in the cache variables? We don't really need those anymore
Codecov Report
@@ Coverage Diff @@
## main #735 +/- ##
==========================================
+ Coverage 90.27% 90.40% +0.13%
==========================================
Files 197 197
Lines 7445 7454 +9
Branches 989 966 -23
==========================================
+ Hits 6721 6739 +18
+ Misses 487 481 -6
+ Partials 237 234 -3
|
Great job on your first PR @timweiland. To fix the formatting and isort issues, once you've installed tox you can run tox -e format To automatically keep code formatted you can also install the formatting libraries directly via
You can then run |
Thanks @JonathanWenger! I've fixed all of the problems now except for one which I'm unsure about: |
I talked to @marvinpfoertner about this and we agreed to simply make pylint ignore this line. |
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 again for doing this! :) Congrats on you first ProbNum PR! 🎉
f608889
to
4b7a49e
Compare
_matmul, _apply, _transpose etc. can now be implemented by overriding the corresonding methods in a subclass instead of passing the implementations in the constructor. The previous approach is still possible via the new LambdaLinearOperator.
Co-authored-by: Marvin Pförtner <marvin.pfoertner@icloud.com>
619cf6f
to
33d972c
Compare
In a Nutshell
_matmul, _apply, _transpose etc. can now be implemented by overriding the corresponding methods in a subclass instead of passing the implementations in the constructor. The previous approach is still possible via the new LambdaLinearOperator.
Detailed Description