-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[math] Fix inconsistent behaviour of TFormula parameter functions #7812
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
[math] Fix inconsistent behaviour of TFormula parameter functions #7812
Conversation
lmoneta
left a comment
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 nice improvements and I agree it is consistent now.
I think we should then fixes also TF1::SetParNames and TF1::SetParameters to be consistent and since TF1 is probably more used than TFormula itself
Yes agreed, I will make these changes in this PR. |
|
|
I see, I understand the issue with TF1::SetParameters. There is probably no need to have those functions virtual, in ROOT we do not have a derived class re-implementing those, but we cannot say this for user defined classes. |
b9758d5 to
73f26bc
Compare
|
Since I still think this is a nice improvement, I resurrected this PR by rebasing the changes on top of ROOT |
fa27846 to
751e434
Compare
751e434 to
7a06e35
Compare
|
@phsft-bot build |
|
Starting build on |
|
Build failed on mac11/noimt. |
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.
Hi @parth-07! I have resurrected this PR in order to close the underlying issue.
I simplified your implementation a bit, and also did the same treatment with the variadic template methods to the TF1Parameters class.
I didn't do this for the TF1 though, because variadic templates would break the support for the context menu in the TBrowser. In addition, there is the problem that it's a virtual function as @lmoneta pointed out.
But what is consistent now is that both SetParNames and SetParameters have default argument values that correspond to the parameters or names not changing. For the Parameters, this is encoded by NaN, and for the names it is encoded with empty strings.
|
Hi @guitargeek, thank you for resurrecting the pull request. |
…ot-project#7812) This commit aims to fix the problem of inconsistency in `TFormula::SetParNames()` and `TFormula::SetParameters()` functions as described in root-project#7805. I have added warning if more values are provided than the actual number of parameters of `TFormula` object, original behaviour of the function is maintained apart from the added warning. Some test will fail due to the added warning, please tell if I should remove the warning or resolve the root cause of the warnings ( For instance, `TF1` using `TFormula::SetParameters()` and always passing 11 arguments is one cause of failing tests) I would also like to slightly modify behaviour of these functions such that value and names of only specified parameters should be changed, current behaviour is to reset the value and names of parameters which aren't specified, but this change may negatively impact programs using these functions. But still, I think this change will make these functions more intuitive. Please tell if I should add this change. This commit fixes root-project#7805 --------- Co-authored-by: Jonas Rembser <jonas.rembser@cern.ch>
This PR aims to fix the problem of inconsistency in
TFormula::SetParNames()andTFormula::SetParameters()functions as described in #7805.I have added warning if more values are provided than the actual number of parameters of
TFormulaobject, original behaviour of the function is maintained apart from the added warning.Some test will fail due to the added warning, please tell if I should remove the warning or resolve the root cause of the warnings ( For instance,
TF1usingTFormula::SetParameters()and always passing 11 arguments is one cause of failing tests)I would also like to slightly modify behaviour of these functions such that value and names of only specified parameters should be changed, current behaviour is to reset the value and names of parameters which aren't specified, but this change may negatively impact programs using these functions. But still, I think this change will make these functions more intuitive. Please tell if I should add this change.
This PR fixes #7805