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

Kevin Sheppard kevin.k.sheppard at gmail.com
Mon Mar 8 11:43:26 EST 2021


I did a quick test and using random_loggam was about 6% faster than using
logfactorial (on Windows).

Kevin


On Sun, Mar 7, 2021 at 2:40 AM Robert Kern <robert.kern at gmail.com> wrote:

> On Sat, Mar 6, 2021 at 1:45 PM Warren Weckesser <
> warren.weckesser at gmail.com> wrote:
>
>> At the time, making that change was not a high priority, so I didn't
>> pursue it. It does make sense to use the logfactorial function there,
>> and I'd be happy to see it updated, but be aware that making the
>> change is more work than changing just the function call.
>>
>
> Does it make a big difference? Per NEP 19, even in `Generator`, we do
> weigh the cost of changing the stream reasonably highly. Improved accuracy
> is likely worthwhile, but a minor performance improvement is probably not.
>
> --
> Robert Kern
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/numpy-discussion/attachments/20210308/314eca65/attachment.html>


More information about the NumPy-Discussion mailing list