| 1 |
This is a partial copy of the Rmath library that is part of R. |
| 2 |
|
| 3 |
The API has been modified for the random number generators. These now |
| 4 |
take, as argument, a pointer to an opaque struct JRNG which |
| 5 |
encapsulates the state of the random number generator. |
| 6 |
|
| 7 |
The file callbacks.cc is a C++ source file that translates the |
| 8 |
functions unif_rand, norm_rand and exp_rand into member function calls |
| 9 |
for the struct JRNG. |
| 10 |
|
| 11 |
The current version is based on R 3.1.2 patched (revision r67885). |
| 12 |
The original intention was to make as few changes as possible in order |
| 13 |
to make it easier to synchronise the library with R. Nevertheless, a |
| 14 |
number of other changes have been made: |
| 15 |
|
| 16 |
The header file Rmath.h has been renamed JRmath.h. Parts of the header |
| 17 |
that are not included when R_MATH_STANDALONE is undefined have been |
| 18 |
removed. |
| 19 |
|
| 20 |
We assume that the C library provides both expm1 and log1p, and that |
| 21 |
log1p is working correctly, rather than testing during configuration |
| 22 |
and providing drop-in replacements as the R math library does. This is |
| 23 |
mainly done to simplify the configuration (e.g. no need to derive |
| 24 |
JRmath.h from JRmath.h.in). If a C library in 2015 does not conform to |
| 25 |
the C99 standard then there is not much hope for that platform. |
| 26 |
|
| 27 |
All functions are remapped with prefix "jags_". This is unlike the |
| 28 |
R math library which remaps to "Rf_" internally and does no remapping |
| 29 |
when built as a standalone library. |
| 30 |
|
| 31 |
Due to the remapping, there is a namespace clash with the function |
| 32 |
"df". This is therefore renamed to dF. Similarly pf, qf, rf, are |
| 33 |
renamed pF, qF, rF respectively. |
| 34 |
|
| 35 |
In the private header file "nmath.h" we defined F77_CALL, which is |
| 36 |
defined in the file R_exts/RS.h in the R sources. |
| 37 |
|
| 38 |
The source file toms708.c must be compiled with the flat -std=c99. |
| 39 |
This is added to the Makefile variable libjrmath_la_CFLAGS. |