-
-
Notifications
You must be signed in to change notification settings - Fork 198
Description
Summary:
Our hypergeometric functions can hang, silently provide wrong results, or always provide wrong results for some values. This issue addresses the critical problems leading to wrong results, makes some stylistic changes, and adds tests. I did not change the algorithm yet and will not in this issue. Some similar issues might be in the beta functions. This bug affects the beta-binomial cdf. Related to meta-issue #27
Description:
- F32 assumes -1 * log(x) == log(-x), wrong result for x < 0
- F32 fix for above issue requires applying sign-flip later
- F32 returns
nanrather than terminating when denominator hits zero. - grad_F32 also assumes -1 * log(x) == log(-x), wrong result for x < 0
- grad_F32 fix for above issue requires applying sign-flip later
- grad_F32 can hang indefinitely
- grad_2F1 will silently return wrong results if not converging
- grad_2F1 terminates after an arbitrary number of steps
- grad_2F1 returns
nanrather than terminating when denominator hits zero.
Reproducible Steps:
Run new tests for beta-binomial CDF and F32.hpp against current develop branch.
Expected Output:
Matching an outside source, I am checking against Mathematica and Sympy
Additional Information:
Branch is bugfix/issue-487-hypergeometric-functions, has some tests, needs more tests, currently running current math tests on my machine, will push once that passes. Tests needed for all these:
- tests for values resulting in positive accumulator
- F32
- grad_F32
- grad_2F1
- tests for values resulting in negative accumulator
- F32
- grad_F32
- grad_2F1
- tests for values resulting in positive accumulator increment
- F32
- grad_F32
- grad_2F1
- tests for values resulting in negative accumulator increment
- F32
- grad_F32
- grad_2F1
- tests for values resulting in negative accumulator and sign-flip
- F32
- grad_F32
- grad_2F1
- tests for values resulting in negative accumulator and sign-flip
- F32
- grad_F32
- grad_2F1
- tests for throw-on-divergence, in general non-convergence should be caused by all positive a1,a2,a3,b1,b2 with large ratio or z > 1
- F32
- grad_F32
- grad_2F1
Current Version:
v2.14.0