Skip to content

Commit 52dd7d4

Browse files
committed
Add ChainRules definitions for gamma and gamma_inc
1 parent d24f19e commit 52dd7d4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/chainrules.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,27 @@ ChainRulesCore.@scalar_rule(erfcx(x), (2 * x * Ω) - (2 / sqrt(π)))
2121
ChainRulesCore.@scalar_rule(erfi(x), (2 / sqrt(π)) * exp(x * x))
2222
ChainRulesCore.@scalar_rule(erfinv(x), (sqrt(π) / 2) * exp^2))
2323
ChainRulesCore.@scalar_rule(gamma(x), Ω * digamma(x))
24+
ChainRulesCore.@scalar_rule(
25+
gamma(a, x),
26+
(
27+
ChainRulesCore.@thunk(error("not implemented")),
28+
- exp(-x) * x^(a - 1),
29+
),
30+
)
31+
ChainRulesCore.@scalar_rule(
32+
gamma_inc(a, x, IND),
33+
@setup(z = exp(-x) * x^(a - 1) / gamma(a)),
34+
(
35+
ChainRulesCore.@thunk(error("not implemented")),
36+
z,
37+
ChainRulesCore.DoesNotExist(),
38+
),
39+
(
40+
ChainRulesCore.@thunk(error("not implemented")),
41+
-z,
42+
ChainRulesCore.DoesNotExist(),
43+
),
44+
)
2445
ChainRulesCore.@scalar_rule(
2546
invdigamma(x),
2647
inv(trigamma(invdigamma(x))),

0 commit comments

Comments
 (0)