You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use ForwardDiff on the upper incomplete gamma function as provided in SpecialFunctions.jl
Calling it with the first argument being an integer did work fine, but changing it to a float, caused the derivative being NaN.
I tried to dig into it a bit and the following MwE does show the problem.
using ForwardDiff
using SpecialFunctions
function testing_gamma(a::Number, x::Number)
return iszero(x) ? gamma(one(x)*a) : x^a * expint(1 - a, x)
end
promotereal(x::Real, y::Real) = promote(x, y)
test_gamma(a::Number,x::Number) = testing_gamma(promotereal(float(a), float(x))...)
If we want to get the gradient of testing_gamma wrt. to the second argument, this works fine
I tried to use ForwardDiff on the upper incomplete gamma function as provided in SpecialFunctions.jl
Calling it with the first argument being an integer did work fine, but changing it to a float, caused the derivative being
NaN
.I tried to dig into it a bit and the following MwE does show the problem.
If we want to get the gradient of
testing_gamma
wrt. to the second argument, this works fineHowever, on
test_gamma
it will return aNaN
value.Maybe someone has an idea why this behavior occurs and how it can best be fixed.
The text was updated successfully, but these errors were encountered: