From m@ech|er @end|ng |rom @t@t@m@th@ethz@ch  Tue Jun  2 11:34:06 2020
From: m@ech|er @end|ng |rom @t@t@m@th@ethz@ch (Martin Maechler)
Date: Tue, 2 Jun 2020 11:34:06 +0200
Subject: [Rd] R standalone Rmath library - missing log1pexp(), rnbeta()
In-Reply-To: <11672D34-4B11-44E3-8017-A99A1D6AC3EE@doplganger.com>
References: <11672D34-4B11-44E3-8017-A99A1D6AC3EE@doplganger.com>
Message-ID: <24278.7438.755946.508490@stat.math.ethz.ch>

>>>>> William Birkett 
>>>>>     on Mon, 1 Jun 2020 15:16:07 -0400 writes:

    > I built the the standalone Rmath library,
    > https://cran.r-project.org/doc/manuals/r-release/R-admin.html#The-standalone-Rmath-library
    > <https://cran.r-project.org/doc/manuals/r-release/R-admin.html#The-standalone-Rmath-library>

    > The build process went smoothly.

    > But, there are two functions, log1pexp() and rnbeta(),
    > which appear in the header file, and not in
    > ?libRmath.dylib?.

    > There is a comment in the header, '// <--
    > ../nmath/plogis.c? next to log1pexp(). That file,
    > ?plogis.c? contains a function ?Rf_log1pexp?, which is how
    > the function would be named without '#define
    > MATHLIB_STANDALONE?.

    > The other function, 'rnbeta()? doesn?t appear in any of
    > the source files in the ?nmath? folder. Maybe a file is
    > missing.

Incidentally (not being an Apple costumer), I've seen this; as
I'm the one who had added  log1pexp()  (8 years ago), I've been intrigued.

The problems you are seeing are *not* at all related to R on the
Mac. ==> I'm exceptionally crossposting to R-devel.
=======> Please followup there, *not* on R-SIG-mac.

1) An R core colleague of mine had decided log1pexp() should be
   Rf_log1pexp() but had forgotten to update the documentation.

   This should be fixed one way (= documentation),  or then, as
   it is the *only* function with name Rf_*() in the whole of standalone
   Rmathlib.{so,dynlib} by renaming it back to log1pexp().

2) rnbeta(): This has been in the headers forever, but there has
   not been a corresponding function in R's C code.

   As you, can see, R's  rbeta(*, ncp = v) currently just calls R code,
   and so there was never a need for a C level rnbeta().  OTOH,
   this is a pity/asymmetry, and I had wanted to change this
   (and also add 'rnt' or 'rnf') to the standalone Rmathlib for
   a long time.  The reason this has not happened (yet?):
   Because of vectorization working differently in the current R
   code of the r*(*, ncp=*) functions and the corresponding C
   code, this would lead to different random numbers in this
   case... and so such a change --- to make Rmathlib "complete" ---
   is something to be discussed.

Best regards,
Martin Maechler
ETH Zurich  and  R Core Team


    > William B. Birkett ....
    > .......irkett at doplganger.com

    > 	[[alternative HTML version deleted]]



[Rd] R standalone Rmath library - missing log1pexp(), rnbeta()
Martin Maechler