[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9. The standalone Rmath library

The routines supporting the distribution and special(22) functions in R and a few others are declared in C header file `Rmath.h'. These can be compiled into a standalone library for linking to other applications. (Note that they are not a separate library when R is built, and the standalone version differs in several ways.)

The makefiles and other sources needed are in directory `src/nmath/standalone', so the following instructions assume that is the current working directory (in the build directory tree on a Unix-alike if that is separate from the sources).

`Rmath.h' contains `R_VERSION_STRING', which is a character string containing the current R version, for example "2.15.0".

There is full access to R's handling of NaN, Inf and -Inf via special versions of the macros and functions

    ISNAN, R_FINITE, R_log, R_pow and R_pow_di

and (extern) constants R_PosInf, R_NegInf and NA_REAL.

There is no support for R's notion of missing values, in particular not for NA_INTEGER nor the distinction between NA and NaN for doubles.

A little care is needed to use the random-number routines. You will need to supply the uniform random number generator

    double unif_rand(void)

or use the one supplied (and with a shared library or DLL you will have to use the one supplied, which is the Marsaglia-multicarry with an entry point

    set_seed(unsigned int, unsigned int)

to set its seeds).

The facilities to change the normal random number generator are available through the constant N01_kind. This takes values from the enumeration type

typedef enum {
} N01type;

(and `USER_NORM' is not available).

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by root on April, 26 2012 using texi2html 1.76.