[
https://issues.apache.org/jira/browse/MATH-585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051708#comment-13051708
]
Phil Steitz commented on MATH-585:
----------------------------------
Wow, are having too much fun with this, Mikkel :)) Nice work!
I agree with Luc's comments and wonder if it might actually be better to detach
the inner class entirely and use composition instead - i.e. have RandomDataImpl
(lazily) construct and hold a reference to one (or two)
GammaRejectionSampler(s), passing itself as a constructor argument to the
cached sampler instance(s). I don't follow exactly how you are planning to
implement the caching otherwise, since a single RandomDataImpl may get requests
that split the parameter space. Also, there is an invariant stated in the
RandomDataImpl class javadoc that all of the variates that it sources come from
the same (pluggble, reseedable) RandomGenerator.
I also agree with Luc on the exception typing and advertising. We need to
understand what exactly can cause the raw MathExceptions and type what we throw
accordingly. Also, I agree with Luc on advertising the
NotStrictlyPositiveExceptions (or the superclass, IAE) for bad parameters.
One more thing. It would be great if there were a freely available online
reference somewhere. Not a requirement, but it makes it easier for more people
to join in the fun if the algorithm docs are freely available.
Thanks for jumping on this.
> Very slow generation of gamma random variates
> ---------------------------------------------
>
> Key: MATH-585
> URL: https://issues.apache.org/jira/browse/MATH-585
> 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: http://www.atlassian.com/software/jira