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

Luc Maisonobe commented on MATH-197:
------------------------------------

The problems comes from the way the distribution is computed. A Poisson process 
is simulated and lots of random numbers are drawn, until there product reach 
some threshold.
If lambda is greater or equal to 746, the value of Math.exp(-lambda) cannot be 
represented anymore in a double and it is replaced by 0 (exactly 0). The 
previous value, for lambda = 745 is 4.9e-324, which is ... small.
In this case, the threshold is never reached and the loop is exited only 
because of an exceeded count.
This means that in addition to being long to obtain, the result is false (it 
will be exactly 1000 * lambda).

So the current algorithm cannot handle large lambda values.

Does anybody have a reference for another algorithm that could be used for 
large lambda values ?

> RandomDataImpl.nextPoisson() is extreme slow for large lambdas
> --------------------------------------------------------------
>
>                 Key: MATH-197
>                 URL: https://issues.apache.org/jira/browse/MATH-197
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 1.2
>         Environment: jdk1.6.0_04, windows xp
>            Reporter: Tolja Zubow
>
> The RandomDataImpl.nextPoisson() is extreme slow for large lambdas:
> E.g. drawing 100 random numbers with lambda = 1000 takes around 10s on my 
> dual core with 2.2GHz.
> With lambda smaller than 500 everything is fine. Any ideas?
>     RandomDataImpl r = new RandomDataImpl();
>     r.reSeed(101);
>     int d = 100;
>     long poissonLambda = 1000;
>     long st = System.currentTimeMillis();
>     for (int row = 0; row < d; row++) {
>       long nxtRnd = r.nextPoisson(poissonLambda);
>     }
>     System.out.println("delta " + (System.currentTimeMillis() - st));

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to