-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add support for addition of functionals #258
Conversation
Codecov Report
@@ Coverage Diff @@
## main #258 +/- ##
==========================================
+ Coverage 93.59% 93.61% +0.02%
==========================================
Files 49 49
Lines 3528 3541 +13
==========================================
+ Hits 3302 3315 +13
Misses 226 226
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
scico/functional/_functional.py
Outdated
if isinstance(other, Functional): | ||
return FunctionalSum(self, other) | ||
raise NotImplementedError( | ||
f"Operation __add__ not defined between {type(self)} and {type(other)}" |
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.
The recommended way to do this is to return the constant NotImplemented
rather than raise an exception; see https://docs.python.org/3/library/constants.html#NotImplemented
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.
Fixed. (I wouldn't be surprised if there are some other instances of this error floating around in other modules.)
Add support for addition of functionals. The result is a functional without a prox, but that can be evaluated if both summand functionals can be evaluated.