commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikkel Meyer Andersen (JIRA)" <>
Subject [jira] [Commented] (MATH-585) Very slow generation of gamma random variates
Date Sat, 18 Jun 2011 17:15:47 GMT


Mikkel Meyer Andersen commented on MATH-585:

The idea was that if I had to sample from both Gamma(1, 2) and Gamma(10, 34) I would instantiate
two RandomDataImpl - one for sampling from Gamma(1, 2) and one for sampling from Gamma(10,
34). This would be efficient due to caching mechanisms in the inner class GammaRejectionSampler.
If GammaRejectionSampler is made static, the two RandomDataImpl's would share the same GammaRejectionSampler,
hence the caching would not be exploited, which is why it isn't static. I am not that used
to using inner classes, so I might have misunderstood something - if so, please correct me.

Some of the constants are taken directly from the paper. I'll look into generating them with
a larger number of digits.

Thanks for pointing out the exception-corrections.

> 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, MATH585-4-gamma.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