-
Notifications
You must be signed in to change notification settings - Fork 263
Add method to change the lists in scalar_product_metric.py
#1964
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 method to change the lists in scalar_product_metric.py
#1964
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1964 +/- ##
==========================================
- Coverage 91.63% 91.23% -0.39%
==========================================
Files 151 147 -4
Lines 13865 13669 -196
==========================================
- Hits 12704 12470 -234
- Misses 1161 1199 +38
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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 @johnharveymath!
The idea is very good. I'm just wondering if we can keep the previous function-based approach and add a method called e.g. register_scaled_method
that does exactly what add_scaled_method
is doing, but in a more transparent way (by being outside of the class). Is there any technical reason for such a solution not work?
Are you thinking something that would be used like this
and behind the scenes it is editing Another approach would be to have some sort of singleton class Whichever way we do this, a key advantage is that we could put a call to |
Exactly that @johnharveymath, very nice! I like your singleton class idea very much (even though threading is not necessarily something we care about). The other advantage of this strategy I can see is that everything becomes encapsulated
8000
in an object, so we know clearly where to look for. I sugggest to make this class private ( |
Here we go. It seemed to make sense to put The result is that Then, as for where the function |
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.
I think the design is very clean @johnharveymath. From my side we can merge as it it. (I suggest to register methods in another PR.)
A new class method is added to
ScalarProductMetric
calledadd_scaled_method
which allows the user to configure how a method from RiemannianMetric should be scaled. The lists become class variables to allow them to be edited.This fixes #1760.
###Tests
The added feature does not seem amenable to unit testing, but the following code does demonstrate that it works:
This has output
as expected.
Questions