-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[TMath] Add Gradient and Laplacian methods for arrays #15100
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
Can one of the admins verify this patch? |
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.
See my suggestions for Gradient. Consider applying the same kind of changes to Laplacian. Thanks!
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.
Sorry, I edited now, crash should be gone
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.
Changes ok.
Thanks! From my side, the only thing left is improving the documentation of Laplacian, try copy-pasting from Gradient and adapting. |
c4a28aa
to
689204e
Compare
Thank you for providing suggestions and taking your time to review the code. |
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.
You are welcome. Min N must be changed for Laplacian. Thanks!
Done. |
Test Results 9 files 9 suites 1d 16h 55m 38s ⏱️ Results for commit 61618a1. ♻️ This comment has been updated with latest results. |
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.
Why the change in roofitcore and bindings?
Also go to "Files changed" tab and revise the comments on testTMath.cxx, they are marked as resolved by mistake.
Thanks a lot!
43a3658
to
519bdc9
Compare
Thank you for commenting. I am not sure what happened, but I think that the changes occured accidentally when merging from updated master branch. Those changes have been removed and I accepted the changes to the to testTMath.cxx. I noticed that there is one suggestion on TMath.h (https://github.com/root-project/root/pull/15100/files#r1563955528) and I am not whether it has been implemented to the code. I am having an issue trying to resolve this suggestion. For some reason it does not disappear from the files changed tab, and after trying to accept suggestion multiple times, it get added to the code multiple times. So I ended up with something like this template <typename T>
T *TMath::Gradient(Long64_t n, T *f, double h)
{
if (!f) {
::Error("TMath::Gradient", "Input parameter f is empty.");
return nullptr;
} else if (n < 2) {
::Error("TMath::Gradient", "Input parameter n=%lld is smaller than 2.", n);
return nullptr;
}
if (!f) {
::Error("TMath::Gradient", "Input parameter f is empty.");
return nullptr;
} else if (n < 2) {
::Error("TMath::Gradient", "Input parameter n=%lld is smaller than 2.", n);
return nullptr;
}
if (!f) {
::Error("TMath::Gradient", "Input parameter f is empty.");
return nullptr;
} else if (n < 2) {
::Error("TMath::Gradient", "Input parameter n=%lld is smaller than 2.", n);
return nullptr;
}
if (!f) {
::Error("TMath::Gradient", "Input parameter f is empty.");
return nullptr;
} else if (n < 2) {
::Error("TMath::Gradient", "Input parameter n=%lld is smaller than 2.", n);
return nullptr;
}
Long64_t i = 1; I removed the redundant if statements and the suggestion still shows up in the files changed tab. I am not sure what to do. |
That might be just a 'browser cache' issue. Refresh your window, now it looks correct to me. |
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.
LGTM!
Thank you for this new addition in TMath
This Pull request:
Changes or fixes:
Dear All. This pull request adds gradient and Laplacian methods for arrays. These can be used to calculate one-dimensional first and second order derivatives. Should there also be methods for calculating higher order derivatives and dimensions?
I am open to any feedback regarding the code.
Checklist:
This PR fixes #14304