commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darren Wilkinson (JIRA)" <>
Subject [jira] [Commented] (MATH-585) Very slow generation of gamma random variates
Date Fri, 10 Jun 2011 13:22:59 GMT


Darren Wilkinson commented on MATH-585:

So, I am not very good at reading patches, and I am not set up right now to be able to apply
it, but if I understand correctly, I think it looks fine. The idea is that there is just a
single instance of the gamma class associated with each random number stream, and the reason
for having it is to keep all of the constants and variables out of the name space of the random
number stream. This makes sense. It probably could be done with an inner class, which might
be slightly cleaner, but I do not feel strongly about it. Caching stuff is always a worry
for thread safety, but is clearly important for performance. I'm guessing that the random
number streams are not thread safe anyway, and that it is assumed that threads each have their
own random number streams (preferably seeded differently!). Thanks again for making this a
priority. You say it was quite easy, but I'm sure it was a lot of work!

> Very slow generation of gamma random variates
> ---------------------------------------------
>                 Key: MATH-585
>                 URL:
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 2.2, 3.0
>         Environment: All
>            Reporter: Darren Wilkinson
>            Assignee: Mikkel Meyer Andersen
>              Labels: Gamma, Random
>         Attachments: MATH585-1.patch
>   Original Estimate: 6h
>  Remaining Estimate: 6h
> The current implementation of gamma random variate generation works, but uses an inversion
method. This is well-known to be a bad idea. Usually a carefully constructed rejection procedure
is used. To give an idea of the magnitude of the problem, the Gamma variate generation in
Parallel COLT is roughly 50 times faster than in Commons Math. 

This message is automatically generated by JIRA.
For more information on JIRA, see:

View raw message