Expand description
Things I’ve done to make R’s nmath library work
- Copied the nmath source
- Set
MATHLIB_STANDALONE
: telling nmath to build for use outside R - Copied R’s includes since they are still needed even with
MATHLIB_STANDALONE
. - Copy
Rconfig.h
andconfig.h
from the mingw dir (normally these files would be generated, but I think the math libs use very little of them). - Copy
Rmath.h
fromRmath.h0.in
and replace the build system placeholders (there are only 2). - Manually whitelist the functions to include, otherwise we pull in a lot of stuff, including stuff outside the source tree (and also it doesn’t compile for some reason).
Rmath.h
wierdly sets the normal functions as aliases - we have to use the raw function name here e.g.dnorm4
.
I’ve done some work on rust versions of these functions in the riir
branch. This branch
should be used for testing those functions in future.
R is released as GPLv2 which I interpret as meaning this library must also be released as GPLv2. If all the functions were replaced with native rust ones, then the license could be changed to something more permissive.
Modules
- This module provides the output of bindgen, in case the raw functions are useful.
Functions
- Evaluate the culmulative distribution function of the beta distribution with parameters
a
andb
atx
. - Evaluate the probability density function of the beta distribution with parameters
a
andb
atx
. - Evaluate the quantile function of the beta distribution with parameters
a
andb
at probabilityp
. - Evaluate the culmulative distribution function of the binomial distribution with
n
trials and probability of successp
atx
. - Evaluate the probability density function of the binomial distribution with
n
trials and probability of successp
atx
. - Evaluate the quantile function of the binomial distribution with
n
trials and probability of successpr
at probabilityp
. - Evaluate the culmulative distribution function of the Cauchy distribution with parameters
location
andscale
atx
. - Evaluate the probability density function of the Cauchy distribution with parameters
location
andscale
atx
. - Evaluate the quantile function of the Cauchy distribution with parameters
location
andscale
at probabilityp
. - Evaluate the culmulative distribution function of the chi-squared distribution with
df
degrees of freedom atx
. - Evaluate the probability density function of the chi-squared distribution with
df
degrees of freedom atx
. - Evaluate the quantile function of the chi-squared distribution with
df
degrees of freedom at probabilityp
. - Evaluate the culmulative distribution function of the exponential distribution with given
scale
atx
. - Evaluate the probability density function of the exponential distribution with given
scale
atx
. - Evaluate the quantile function of the exponential distribution with given
scale
at probabilityp
. - Evaluate the culmulative distribution function of the f distribution with parameters
df1
anddf2
atx
. - Evaluate the probability density function of the f distribution with parameters
df1
anddf2
atx
. TODO I think df1 is the numerator degrees of freedom (when viewed as the ratio of two chi-squared dists. Check and doc this. - Evaluate the quantile function of the f distribution with parameters
df1
anddf2
at probabilityp
. - Evaluate the culmulative density function of the gamma distribution with
shape
andscale
atx
. - Evaluate the probability density function of the gamma distribution with given
shape
andscale
atx
. - Evaluate the quantile function of the gamma distribution with
shape
andscale
at probabilityp
. - Evaluate the culmulative distribution function of the geometric distribution with trial probability
p
atx
.P(X=x) = p(1-p)^x
. - Evaluate the probability density function of the geometric distribution with trial probability
p
atx
.P(X=x) = p(1-p)^x
. - Evaluate the quantile function of the geometric distribution with trial probability
prob
at probabilityp
.P(X=x) = p(1-p)^x
. - Evaluate the culmulative distribution function of the hypergeometric distribution. If
samples
samples were taken at random from a collection ofsucc
successes andfail
failures, then this function evaluates the chance of≤x
successes being in the sample. - Evaluate the probability density function of the hypergeometric distribution. If
samples
samples were taken at random from a collection ofsucc
successes andfail
failures, then this function evaluates the chance ofx
successes being in the sample. - Evaluate the quantile function of the hypergeometric distribution. If
samples
samples were taken at random from a collection ofsucc
successes andfail
failures, then this function evaluates the number of samples where there isp
probability there are <= that many successes. - Evaluate the culmulative distribution function of the logistic distribution.
- Evaluate the probability density function of the logistic distribution.
- Evaluate the quantile function of the logistic distribution.
- Evaluate the culmulative distribution function of the log-normal distribution with parameters
mean_log
andsd_log
atx
. - Evaluate the probability density function of the log-normal distribution with parameters
mean_log
andsd_log
atx
. - Evaluate the quantile function of the log-normal distribution with parameters
mean_log
andsd_log
at probabilityp
. - Evaluate the culmulative distribution function of the negative binomial distribution. If there is
prob
probability of successin a Bernoulli trial, and we perform trials until we seesize
successes, then this function returns the probability of seeing≤x
failures in those trials. - Evaluate the probability density function of the negative binomial distribution. If there is
prob
probability of successin a Bernoulli trial, and we perform trials until we seesize
successes, then this function returns the probability of seeingx
failures in those trials. - Evaluate the quantile function of the negative binomial distribution. If there is
prob
probability of successin a Bernoulli trial, and we perform trials until we seesize
successes, then this function returns the number of failures we would expect to see with probabilityp
. - Evaluate the culmulative distribution function of the non-central beta distribution.
- Evaluate the probability density function of the non-central beta distribution.
- Evaluate the quantile function of the non-central beta distribution.
- Evaluate the culmulative distribution function of the non-central f distribution.
- Evaluate the probability density function of the non-central f distribution.
- Evaluate the quantile function of the non-central f distribution.
- Evaluate the culmulative distribution function of the non-central student’s t distribution.
- Evaluate the probability density function of the non-central student’s t distribution.
- Evaluate the quantile function of the non-central student’s t distribution.
- Evaluate the culmulative distribution function of the non-central chi-squared distribution with
df
degrees of freedom and non-centrality parameterncp
atx
. - Evaluate the probability density function of the non-central chi-squared distribution with
df
degrees of freedom and non-centrality parameterncp
atx
. - Evaluate the quantile function of the non-central chi-squared distribution with
df
degrees of freedom and non-centrality parameterncp
at probabilityp
. - Evaluate the culmulative density function of the normal distribution with mean
mu
and variancesigma
squared atx
. - Evaluate the culmulative density function of the normal distribution with mean
mu
and variancesigma
atx
. Both integrals ((-∞, x)
and(x, ∞)
) are returned in that order. - Evaluate the probability density function of the normal distribution with mean
mu
and variancesigma
2 atx
. - Evaluate the quantile function of the normal distribution with mean
mu
and variancesigma
squared at probabilityp
. - Evaluate the culmulative distribution function of the poisson distribution.
- Evaluate the probability density function of the poisson distribution.
- Evaluate the quantile function of the poisson distribution.
- Evaluate the culmulative distribution function of the signrankon signed rank distribution.
- Evaluate the probability density function of the Wilcoxon signed rank distribution.
- Evaluate the quantile function of the signrankon signed rank distribution.
- Evaluate the culmulative distribution function of the student’s t distribution with degrees of freedom
df
atx
. - Evaluate the probability density function of the student’s t distribution with degrees of freedom
df
atx
. - Evaluate the quantile function of the student’s t distribution with degrees of freedom
df
at probabilityp
. - Evaluate the culmulative distribution function of the studentized range distribution.
- Evaluate the quantile function of the studentized range distribution.
- Evaluate the culmulative distribution function of the Weibull distribution.
- Evaluate the probability density function of the Weibull distribution.
- Evaluate the quantile function of the Weibull distribution.
- Evaluate the culmulative distribution function of the Wilcoxon rank-sum distribution.
- Evaluate the probability density function of the Wilcoxon rank-sum distribution.
- Evaluate the quantile function of the Wilcoxon rank-sum distribution.