[Numpy-discussion] Using logfactorial instead of loggamma in random_poisson sampler

zoj613 blkzol001 at myuct.ac.za
Sat Mar 6 12:36:35 EST 2021


Hi All,

I noticed that the transformed rejection method for generating Poisson
random variables used in numpy makes use of the `random_loggam` function
which directly calculates the log-gamma function. It appears that a
log-factorial lookup table was added a few years back which could be used in
place of random_loggam since the input is always an integer. Is there a
reason for not using this table instead? See link below for the line of
code:

https://github.com/numpy/numpy/blob/6222e283fa0b8fb9ba562dabf6ca9ea7ed65be39/numpy/random/src/distributions/distributions.c#L572

Regards
Zolisa



--
Sent from: http://numpy-discussion.10968.n7.nabble.com/


More information about the NumPy-Discussion mailing list