-
Notifications
You must be signed in to change notification settings - Fork 248
Implement special function log incomplete gamma function #1346
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
base: develop
Are you sure you want to change the base?
Conversation
|
@jzmaddock I've tried to add error checking and the promotion boilerplate based on your comment #1338 (comment). Does this look okay for a start? |
|
Thanks @JacobHass8 that looks good to me. BTW the separation between lgamma_incomplete_imp_final and lgamma_incomplete_imp shouldn't be needed in this case: that was a hack Matt introduced for some functions to workaround the lack of recursion support in some GPU contexts, but there's no recursion here, so we should be good :) Some tests and docs and hopefully this should be good to go! Thanks for this. |
What file should I put the tests in, |
test/test_igamma.hpp
Outdated
| // | ||
| // Check that lgamma_q returns correct values | ||
| // | ||
| BOOST_CHECK_CLOSE(::boost::math::lgamma_q(static_cast<T>(5), static_cast<T>(100)), static_cast<T>(log(1.6139305336977304790405739225035685228527400976549e-37L)), tolerance); | ||
| BOOST_CHECK_CLOSE(::boost::math::lgamma_q(static_cast<T>(22.5), static_cast<T>(2000)), static_cast<T>(-1883.4897732037716195918619632721L), tolerance * 10); // calculated via mpmath | ||
| BOOST_CHECK_CLOSE(::boost::math::lgamma_q(static_cast<T>(501.2), static_cast<T>(2000)), static_cast<T>(-810.31461624182202285737730562687L), tolerance * 10); // calculated via mpmath |
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 used one test case that was previously checked for gamma_q. I also added two more examples that I calculated using mpmath in python which supports arbitrary precision. Are there any other tests that I should implement?
|
drone tests were failing for 128-bit long double platforms, I've updated the test data with values from wolframalpha in case the data was truncated to double precision somewhere along the way. Also not sure why no github actions are being run - anyone any ideas? @mborland ? With regard to further tests, the area most likely to fail, would be where the implementation first switches to the log asymptotic expansion, and at higher precision (we should support 128-bit long doubles at least, I'm less concerned about full arbitrary precision just yet). |
|
Ah... I needed to approve the github run: now done! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1346 +/- ##
========================================
Coverage 95.28% 95.29%
========================================
Files 814 814
Lines 67364 67396 +32
========================================
+ Hits 64191 64223 +32
Misses 3173 3173
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Implementation of log incomplete gamma function using asymptotic approximations where the incomplete gamma function underflows. See #1173 and #1338.