-
Notifications
You must be signed in to change notification settings - Fork 25
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
Improve choosing dividing-axis #5
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 3 3
Lines 85 90 +5
=====================================
+ Hits 85 90 +5
Continue to review full report at Codecov.
|
Maybe add a test? 😃 |
src/genz-malik.jl
Outdated
@@ -138,6 +138,8 @@ function (g::GenzMalik{n,T})(f, a::SVector{n}, b::SVector{n}, norm=vecnorm) wher | |||
if divdiff > maxdivdiff |
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.
We could add a divdiff = divdiff < eps(T) ? zero(divdiff) : divdiff
above this to ignore negligible differences and choose from the half-widths instead but I'm not sure if it is worth the trouble to make this more robust.
The thing that bugs me about this is the precision of the test. I feel like it should somehow be tied to an error estimate computed from |
Right now I'm not sure what would be an appropriate way of doing that. Does |
It certainly seems to help this particular integral, but any fix that depends on exact equality seems very fragile. One thing we could do would be to use the current error estimate |
Agreed.
Do you mean that we could choose by width along an axis when |
74fe93c
to
5305d02
Compare
I pushed some changes that should make this more robust. The scheme would be the following:
I have set |
I was thinking of essentially what you have in your current PR except with (A tolerance independent of what the integrand is doing doesn't make sense to me. |
Note that my suggested |
Forgot about dimensions. As I commented above I set the tolerance to a fixed value to avoid storing the fourth differences and choosing the axis at the end, but that is probably not of significant cost compared with the rest of the routine. |
You could use I agree that this makes the implementation more complicated, but I think it is worth it. |
5305d02
to
5ce606b
Compare
|
We can always use |
(The failed test seems to be only a 10% increase in function evaluations, though, which isn't too bad. |
I did some experimenting and found that |
5ce606b
to
0cca5bb
Compare
Sorry for the long delay; this looks ready to merge. |
Fixes #4
When the fourth difference is around the same value along every axis, we should choose the axis that corresponds to the largest width to ensure we sample better the whole box.
C.c. @stevengj