|
81 | 81 |
|
82 | 82 | @testset "log gamma and co" begin
|
83 | 83 | # It is important that we have negative numbers with both odd and even integer parts
|
84 |
| - for x in (1.5, 2.5, 10.5, -0.6, -2.6, -3.3, 1.6 + 1.6im, 1.6 - 1.6im, -4.6 + 1.6im) |
| 84 | + test_points = (1.5, 2.5, 10.5, -0.6, -2.6, -3.3, 1.6 + 1.6im, 1.6 - 1.6im, -4.6 + 1.6im) |
| 85 | + for x in test_points |
85 | 86 | for m in (0, 1, 2, 3)
|
86 | 87 | test_frule(polygamma, m, x)
|
87 | 88 | test_rrule(polygamma, m, x)
|
88 | 89 | end
|
89 | 90 |
|
90 | 91 | isreal(x) && x < 0 && continue
|
91 | 92 | test_scalar(loggamma, x)
|
| 93 | + for a in test_points |
| 94 | + # ensure all complex if any complex for FiniteDifferences |
| 95 | + _a, _x = promote(a, x) |
| 96 | + test_frule(gamma, _a, _x; rtol=1e-8) |
| 97 | + test_rrule(gamma, _a, _x; rtol=1e-8) |
| 98 | + |
| 99 | + test_frule(loggamma, _a, _x) |
| 100 | + test_rrule(loggamma, _a, _x) |
| 101 | + end |
92 | 102 |
|
93 | 103 | isreal(x) || continue
|
94 | 104 | test_frule(logabsgamma, x)
|
95 | 105 | test_rrule(logabsgamma, x; output_tangent=(randn(), randn()))
|
| 106 | + for a in test_points |
| 107 | + isreal(a) && a > 0 || continue |
| 108 | + test_frule(gamma_inc, a, x, 0) |
| 109 | + test_rrule(gamma_inc, a, x, 0; output_tangent=(randn(), randn())) |
| 110 | + end |
96 | 111 | end
|
97 | 112 | end
|
98 | 113 | end
|
0 commit comments