Re: [Rd] qnbinom with small size is slow

2020-08-24 Thread Martin Maechler
> Constantin Ahlmann-Eltze 
> on Fri, 21 Aug 2020 11:51:13 +0200 writes:

> Hi Martin, thanks for verifying. I agree that the
> Cornish-Fisher seems to struggle with the small size
> parameters, but I also don't have a good idea how to
> replace it.

> But I think fixing do_search() is possible:

Yes,  but your fix was not correct..
(and I used time to find out)

Note that do_search()  is used in all three of

qnbinom()
 qbinom()
  qpois()

If a change was correct and an improvement, it will be an
improvement for all three cases; if it is only sometimes good,
it may also be sometimes bad for the other two cases.

Note that running the checks on the current R sources makes
almost no sense: Of course the new bugs (your: "slow"; mine:
inaccurate when result is quite larger than 0) are *NOT* yet in
the regression tests.

And it's really not worth doing experiments on the cloud ("QI"
is really increasing the climate change, by each time installing
tons (=> bandwidth) and running 1.5 hours ..):

I don't know what big a part of tree is killed by the bandwith
  (==> electricity of internet routers, cooling, ...)
and the 1.5 hour run
  (==> electricity of the CPUs; cooling; ...)
but I'd rather do test such small changes on my small desktop
where I don't need to install anything etc
(*and* I know that the Swiss electricity is almost exclusively
  produced from no-Carbon-emission plants).



I'm busy for another 1-3 days (taking & grading exams),
but really do want to address this myself, rather than trying
these proposals (and having you burn electricity on routers and
CPUs and coolers) ...

Martin

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] browser() cannot be called consistently from another environment

2020-08-24 Thread Antoine Fabri
Dear R-devel,

I have this debugging function that applies side effects, then acts like
browser once it's done :

meta_browser <- function() {
  # ...
  on.exit(eval.parent(quote(browser(
}

I can use it with a function such as fun1 below :

fun1 <- function(){
  meta_browser()
  print("hello")
  print("world")
}

fun1() will trigger the debugger as expected and we can browse along.

If however my function contains a loop (for, while, repeat), I'm not able
to debug anymore.

fun2 <- function(){
  meta_browser()
  print("hello")
  print("world")
  repeat {break}
}

fun2() will trigger the debugger but then everything will be executed at
once.

Is this a bug ? Is there another way, maybe more idiomatic, to get the same
effect and have it work with fun2() ?

Best,

Antoine

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel