Hi,
I'm currently implementing some nonstandard distributions to be compatible with RTMB.
I am really not sure if I'm just overlooking stuff, but it seems like there is no simple AD implementation of the gamma function, which I really need.
However, as I use the distributions within a package, I would like to avoid linking to rtmbXtras in addition to RTMB. Would it be possible to have an implementation in RTMB? Or is there one and I am just really stupid?
For now I found the kind of silly workaround
lgamma_ad <- function(x) {
- RTMB::dgamma(1, shape = x, scale = 1, log = TRUE) - 1
}
lgamma_ad(exp(-100))
lgamma(exp(-100))
but this seems very rough to me :D
Thanks in advance :)