Skip to content

Commit d54ab56

Browse files
committed
Remove loggamma definition and adjoint
1 parent b2e2471 commit d54ab56

File tree

4 files changed

+3
-8
lines changed

4 files changed

+3
-8
lines changed

src/KernelFunctions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export spectral_mixture_kernel, spectral_mixture_product_kernel
3434
using Compat
3535
using Requires
3636
using Distances, LinearAlgebra
37-
using SpecialFunctions: logabsgamma, besselk, polygamma
37+
using SpecialFunctions: loggamma, besselk, polygamma
3838
using ZygoteRules: @adjoint, pullback
3939
using StatsFuns: logtwo
4040
using InteractiveUtils: subtypes

src/basekernels/matern.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ end
2121
end
2222

2323
function _matern::Real, d::Real)
24-
exp((one(d) - ν) * logtwo - loggamma(ν) + ν * log(sqrt(2ν) * d) + log(besselk(ν, sqrt(2ν) * d)))
24+
y = sqrt(2ν) * d
25+
return exp((one(d) - ν) * logtwo - loggamma(ν) + ν * log(y) + log(besselk(ν, y)))
2526
end
2627

2728
metric(::MaternKernel) = Euclidean()

src/utils.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
hadamard(x, y) = x .* y
22

3-
loggamma(x) = first(logabsgamma(x))
4-
53
# Macro for checking arguments
64
macro check_args(K, param, cond, desc=string(cond))
75
quote

src/zygote_adjoints.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ end
5959
end
6060
end
6161

62-
@adjoint function loggamma(x)
63-
first(logabsgamma(x)) , Δ ->.* polygamma(0, x), )
64-
end
65-
6662
@adjoint function kappa::MaternKernel, d::Real)
6763
ν = first.ν)
6864
val, grad = pullback(_matern, ν, d)

0 commit comments

Comments
 (0)