[jira] Commented: (MATH-197) RandomDataImpl.nextPoisson() is extreme slow for large lambdas
[ https://issues.apache.org/jira/browse/MATH-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12722346#action_12722346 ] Eugene Kirpichov commented on MATH-197: --- I have had a look at the source and it looks like the method is already implemented, so the bug should probably be closed? > 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.0, 1.1, 1.2 > Environment: jdk1.6.0_04, windows xp >Reporter: Tolja Zubow >Assignee: Brent Worden > Fix For: 2.0 > > > 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.
[jira] Commented: (MATH-197) RandomDataImpl.nextPoisson() is extreme slow for large lambdas
[ https://issues.apache.org/jira/browse/MATH-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12581576#action_12581576 ] Brent Worden commented on MATH-197: --- I've been looking at Devroye's 'Non-Uniform Random Variate Generation' book. The book is freely available at http://cg.scs.carleton.ca/~luc/rnbookindex.html. Chapter 10 defines some rejection methods for Poisson generation which, the author claims, are uniformily fast for all lambda. I hope to soon implement one or more of the rejection methods and test its performance. > 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.
[jira] Commented: (MATH-197) RandomDataImpl.nextPoisson() is extreme slow for large lambdas
[ 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.