[ https://issues.apache.org/jira/browse/MATH585?page=com.atlassian.jira.plugin.system.issuetabpanels:commenttabpanel&focusedCommentId=13047223#comment13047223
]
Brent Worden commented on MATH585:

Here is a performance improvement suggestion to the implementation in the patch:
Since the loop in calculateQ is always a fixed number of iterations, eliminate it and compute
the polynomial directly. Also, instead of computing is as a1*v + a2*v^2 + a3*v^3 + ... a9*v^9
use the equivalent form v*(a1 + v*(a2 + v*(a3 + ... + v*(a8 + a9*v)))))))). This method eliminates
about half of the multiplications needed to compute the polynomial.
Apply the same technique to the loops found in Step 4 (lines 244250 of MATH5851.patch) and
in Step 11 (lines 307318).
> Very slow generation of gamma random variates
> 
>
> Key: MATH585
> URL: https://issues.apache.org/jira/browse/MATH585
> 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: MATH5851.patch
>
> Original Estimate: 6h
> Remaining Estimate: 6h
>
> The current implementation of gamma random variate generation works, but uses an inversion
method. This is wellknown 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
