[ 
https://issues.apache.org/jira/browse/MATH-585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13044789#comment-13044789
 ] 

Mikkel Meyer Andersen commented on MATH-585:
--------------------------------------------

Thank you very much for reporting this. I have looked in the documentation of 
cern.jet.random.tdouble.Gamma in the Parallel COLT, and they write:
{quote}
Method: Acceptance Rejection combined with Acceptance Complement.
High performance implementation. This is a port of RandGamma used in CLHEP 
1.4.0 (C++). CLHEP's implementation, in turn, is based on gds.c from the C-RAND 
/ WIN-RAND library. C-RAND's implementation, in turn, is based upon
J.H. Ahrens, U. Dieter (1974): Computer methods for sampling from gamma, beta, 
Poisson and binomial distributions, Computing 12, 223-246.

and

J.H. Ahrens, U. Dieter (1982): Generating gamma variates by a modified 
rejection technique, Communications of the ACM 25, 47-54.
{quote}

Looking in the ChangeLog file in the source for version 2.1.0.1 of CLHEP, I 
found that "CLHEP now uses the LGPL license.". As far as I can tell, LGPL is 
not compatible with Apache License which Commons Math is under. 

This means that we must implement the method ourselves, e.g. based on the 
papers referred to above.

How urgent is your need for this speed-up? Unfortunately I'm quite busy for the 
next months, but please submit a patch if possible.

> 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
>              Labels: Gamma, Random
>   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

Reply via email to