search for: b313ce56b2

Displaying 4 results from an estimated 4 matches for "b313ce56b2".

2020 Aug 10
2
qnbinom with small size is slow
Thanks Ben for verifying the issue. It is always reassuring to hear when others can reproduce the problem. I wrote a small patch that fixes the issue (https://github.com/r-devel/r-svn/pull/11): diff --git a/src/nmath/qnbinom.c b/src/nmath/qnbinom.c index b313ce56b2..d2e8d98759 100644 --- a/src/nmath/qnbinom.c +++ b/src/nmath/qnbinom.c @@ -104,6 +104,7 @@ double qnbinom(double p, double size, double prob, int lower_tail, int log_p) /* y := approx.value (Cornish-Fisher expansion) : */ z = qnorm(p, 0., 1., /*lower_tail*/TRUE, /*log_p*/FALSE); y =...
2020 Aug 21
1
qnbinom with small size is slow
...E. I think the solution is to move the update of y before the if. However, I need to make this slightly awkward check if incr == 1, so that the return in line 123 and the do-while block at the end of qnbinom() do not need to be modified. diff --git a/src/nmath/qnbinom.c b/src/nmath/qnbinom.c index b313ce56b2..16845d9373 100644 --- a/src/nmath/qnbinom.c +++ b/src/nmath/qnbinom.c @@ -49,10 +49,18 @@ do_search(double y, double *z, double p, double n, double pr, double incr) { if(*z >= p) { /* search to the left */ for(;;) { + y = fmax2(0, y - incr); if(y == 0 || - (*z = pnbi...
2020 Aug 20
0
qnbinom with small size is slow
...anks Ben for verifying the issue. It is always reassuring to hear > when others can reproduce the problem. > I wrote a small patch that fixes the issue > (https://github.com/r-devel/r-svn/pull/11): > diff --git a/src/nmath/qnbinom.c b/src/nmath/qnbinom.c > index b313ce56b2..d2e8d98759 100644 > --- a/src/nmath/qnbinom.c > +++ b/src/nmath/qnbinom.c > @@ -104,6 +104,7 @@ double qnbinom(double p, double size, double prob, > int lower_tail, int log_p) > /* y := approx.value (Cornish-Fisher expansion) : */ > z = qnorm(p, 0., 1., /...
2020 Aug 07
2
qnbinom with small size is slow
Hi all, I recently noticed that `qnbinom()` can take a long time to calculate a result if the `size` argument is very small. For example qnbinom(0.5, mu = 3, size = 1e-10) takes ~30 seconds on my computer. I used gdb to step through the qnbinom.c implementation and noticed that in line 106 (https://github.com/wch/r-source/blob/f8d4d7d48051860cc695b99db9be9cf439aee743/src/nmath/qnbinom.c#L106)