/usr/include/Rmath.h is in r-mathlib 3.1.1-1+deb8u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | /* -*- C -*-
* Mathlib : A C Library of Special Functions
* Copyright (C) 1998-2013 The R Core Team
* Copyright (C) 2004 The R Foundation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, a copy is available at
* http://www.r-project.org/Licenses/
*
* Rmath.h should contain ALL headers from R's C code in `src/nmath'
------- such that ``the Math library'' can be used by simply
``#include <Rmath.h> ''
and nothing else.
It is part of the API and supports 'standalone Rmath'.
*/
#ifndef RMATH_H
#define RMATH_H
/* Note that on some systems we need to include math.h before the
defines below. */
#ifndef NO_C_HEADERS
# define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
# include <math.h>
#endif
/*-- Mathlib as part of R -- define this for standalone : */
/* #undef MATHLIB_STANDALONE */
#define R_VERSION_STRING "3.1.1"
#ifndef HAVE_EXPM1
# define HAVE_EXPM1 1
#endif
#ifndef HAVE_HYPOT
# define HAVE_HYPOT 1
#endif
#ifndef HAVE_LOG1P
# define HAVE_LOG1P 1
#endif
#ifndef HAVE_WORKING_LOG1P
# define HAVE_WORKING_LOG1P 1
#endif
#if defined(HAVE_LOG1P) && !defined(HAVE_WORKING_LOG1P)
/* remap to avoid problems with getting the right entry point */
double Rlog1p(double);
#define log1p Rlog1p
#endif
/* Undo SGI Madness */
#ifdef __sgi
# ifdef ftrunc
# undef ftrunc
# endif
# ifdef qexp
# undef qexp
# endif
# ifdef qgamma
# undef qgamma
# endif
#endif
/* ----- The following constants and entry points are part of the R API ---- */
/* 30 Decimal-place constants */
/* Computed with bc -l (scale=32; proper round) */
/* SVID & X/Open Constants */
/* Names from Solaris math.h */
#ifndef M_E
#define M_E 2.718281828459045235360287471353 /* e */
#endif
#ifndef M_LOG2E
#define M_LOG2E 1.442695040888963407359924681002 /* log2(e) */
#endif
#ifndef M_LOG10E
#define M_LOG10E 0.434294481903251827651128918917 /* log10(e) */
#endif
#ifndef M_LN2
#define M_LN2 0.693147180559945309417232121458 /* ln(2) */
#endif
#ifndef M_LN10
#define M_LN10 2.302585092994045684017991454684 /* ln(10) */
#endif
#ifndef M_PI
#define M_PI 3.141592653589793238462643383280 /* pi */
#endif
#ifndef M_2PI
#define M_2PI 6.283185307179586476925286766559 /* 2*pi */
#endif
#ifndef M_PI_2
#define M_PI_2 1.570796326794896619231321691640 /* pi/2 */
#endif
#ifndef M_PI_4
#define M_PI_4 0.785398163397448309615660845820 /* pi/4 */
#endif
#ifndef M_1_PI
#define M_1_PI 0.318309886183790671537767526745 /* 1/pi */
#endif
#ifndef M_2_PI
#define M_2_PI 0.636619772367581343075535053490 /* 2/pi */
#endif
#ifndef M_2_SQRTPI
#define M_2_SQRTPI 1.128379167095512573896158903122 /* 2/sqrt(pi) */
#endif
#ifndef M_SQRT2
#define M_SQRT2 1.414213562373095048801688724210 /* sqrt(2) */
#endif
#ifndef M_SQRT1_2
#define M_SQRT1_2 0.707106781186547524400844362105 /* 1/sqrt(2) */
#endif
/* R-Specific Constants */
#ifndef M_SQRT_3
#define M_SQRT_3 1.732050807568877293527446341506 /* sqrt(3) */
#endif
#ifndef M_SQRT_32
#define M_SQRT_32 5.656854249492380195206754896838 /* sqrt(32) */
#endif
#ifndef M_LOG10_2
#define M_LOG10_2 0.301029995663981195213738894724 /* log10(2) */
#endif
#ifndef M_SQRT_PI
#define M_SQRT_PI 1.772453850905516027298167483341 /* sqrt(pi) */
#endif
#ifndef M_1_SQRT_2PI
#define M_1_SQRT_2PI 0.398942280401432677939946059934 /* 1/sqrt(2pi) */
#endif
#ifndef M_SQRT_2dPI
#define M_SQRT_2dPI 0.797884560802865355879892119869 /* sqrt(2/pi) */
#endif
#ifndef M_LN_2PI
#define M_LN_2PI 1.837877066409345483560659472811 /* log(2*pi) */
#endif
#ifndef M_LN_SQRT_PI
#define M_LN_SQRT_PI 0.572364942924700087071713675677 /* log(sqrt(pi))
== log(pi)/2 */
#endif
#ifndef M_LN_SQRT_2PI
#define M_LN_SQRT_2PI 0.918938533204672741780329736406 /* log(sqrt(2*pi))
== log(2*pi)/2 */
#endif
#ifndef M_LN_SQRT_PId2
#define M_LN_SQRT_PId2 0.225791352644727432363097614947 /* log(sqrt(pi/2))
== log(pi/2)/2 */
#endif
#ifdef MATHLIB_STANDALONE
# ifndef R_EXT_BOOLEAN_H_
/* "copy-paste" R_ext/Boolean.h if not already included: */
#define R_EXT_BOOLEAN_H_
#undef FALSE
#undef TRUE
typedef enum { FALSE = 0, TRUE } Rboolean;
# endif
#else
# include <R_ext/Boolean.h>
#endif
#if !defined(MATHLIB_STANDALONE) && !defined(R_NO_REMAP_RMATH)
#define bessel_i Rf_bessel_i
#define bessel_j Rf_bessel_j
#define bessel_k Rf_bessel_k
#define bessel_y Rf_bessel_y
#define bessel_i_ex Rf_bessel_i_ex
#define bessel_j_ex Rf_bessel_j_ex
#define bessel_k_ex Rf_bessel_k_ex
#define bessel_y_ex Rf_bessel_y_ex
#define beta Rf_beta
#define choose Rf_choose
#define dbeta Rf_dbeta
#define dbinom Rf_dbinom
#define dcauchy Rf_dcauchy
#define dchisq Rf_dchisq
#define dexp Rf_dexp
#define df Rf_df
#define dgamma Rf_dgamma
#define dgeom Rf_dgeom
#define dhyper Rf_dhyper
#define digamma Rf_digamma
#define dlnorm Rf_dlnorm
#define dlogis Rf_dlogis
#define dnbeta Rf_dnbeta
#define dnbinom Rf_dnbinom
#define dnbinom_mu Rf_dnbinom_mu
#define dnchisq Rf_dnchisq
#define dnf Rf_dnf
#define dnorm4 Rf_dnorm4
#define dnt Rf_dnt
#define dpois Rf_dpois
#define dpsifn Rf_dpsifn
#define dsignrank Rf_dsignrank
#define dt Rf_dt
#define dtukey Rf_dtukey
#define dunif Rf_dunif
#define dweibull Rf_dweibull
#define dwilcox Rf_dwilcox
#define fmax2 Rf_fmax2
#define fmin2 Rf_fmin2
#define fprec Rf_fprec
#define fround Rf_fround
#define ftrunc Rf_ftrunc
#define fsign Rf_fsign
#define gammafn Rf_gammafn
#define imax2 Rf_imax2
#define imin2 Rf_imin2
#define lbeta Rf_lbeta
#define lchoose Rf_lchoose
#define lgammafn Rf_lgammafn
#define lgammafn_sign Rf_lgammafn_sign
#define lgamma1p Rf_lgamma1p
#define log1pmx Rf_log1pmx
#define logspace_add Rf_logspace_add
#define logspace_sub Rf_logspace_sub
#define pbeta Rf_pbeta
#define pbeta_raw Rf_pbeta_raw
#define pbinom Rf_pbinom
#define pcauchy Rf_pcauchy
#define pchisq Rf_pchisq
#define pentagamma Rf_pentagamma
#define pexp Rf_pexp
#define pf Rf_pf
#define pgamma Rf_pgamma
#define pgeom Rf_pgeom
#define phyper Rf_phyper
#define plnorm Rf_plnorm
#define plogis Rf_plogis
#define pnbeta Rf_pnbeta
#define pnbinom Rf_pnbinom
#define pnbinom_mu Rf_pnbinom_mu
#define pnchisq Rf_pnchisq
#define pnf Rf_pnf
#define pnorm5 Rf_pnorm5
#define pnorm_both Rf_pnorm_both
#define pnt Rf_pnt
#define ppois Rf_ppois
#define psignrank Rf_psignrank
#define psigamma Rf_psigamma
#define pt Rf_pt
#define ptukey Rf_ptukey
#define punif Rf_punif
#define pythag Rf_pythag
#define pweibull Rf_pweibull
#define pwilcox Rf_pwilcox
#define qbeta Rf_qbeta
#define qbinom Rf_qbinom
#define qcauchy Rf_qcauchy
#define qchisq Rf_qchisq
#define qchisq_appr Rf_qchisq_appr
#define qexp Rf_qexp
#define qf Rf_qf
#define qgamma Rf_qgamma
#define qgeom Rf_qgeom
#define qhyper Rf_qhyper
#define qlnorm Rf_qlnorm
#define qlogis Rf_qlogis
#define qnbeta Rf_qnbeta
#define qnbinom Rf_qnbinom
#define qnbinom_mu Rf_qnbinom_mu
#define qnchisq Rf_qnchisq
#define qnf Rf_qnf
#define qnorm5 Rf_qnorm5
#define qnt Rf_qnt
#define qpois Rf_qpois
#define qsignrank Rf_qsignrank
#define qt Rf_qt
#define qtukey Rf_qtukey
#define qunif Rf_qunif
#define qweibull Rf_qweibull
#define qwilcox Rf_qwilcox
#define rbeta Rf_rbeta
#define rbinom Rf_rbinom
#define rcauchy Rf_rcauchy
#define rchisq Rf_rchisq
#define rexp Rf_rexp
#define rf Rf_rf
#define rgamma Rf_rgamma
#define rgeom Rf_rgeom
#define rhyper Rf_rhyper
#define rlnorm Rf_rlnorm
#define rlogis Rf_rlogis
#define rnbeta Rf_rnbeta
#define rnbinom Rf_rnbinom
#define rnchisq Rf_rnchisq
#define rnf Rf_rnf
#define rnorm Rf_rnorm
#define rnt Rf_rnt
#define rpois Rf_rpois
#define rsignrank Rf_rsignrank
#define rt Rf_rt
#define rtukey Rf_rtukey
#define runif Rf_runif
#define rweibull Rf_rweibull
#define rwilcox Rf_rwilcox
#define sign Rf_sign
#define tetragamma Rf_tetragamma
#define trigamma Rf_trigamma
#endif
#define dnorm dnorm4
#define pnorm pnorm5
#define qnorm qnorm5
#ifdef __cplusplus
extern "C" {
#endif
/* R's versions with !R_FINITE checks */
double R_pow(double x, double y);
double R_pow_di(double, int);
/* Random Number Generators */
double norm_rand(void);
double unif_rand(void);
double exp_rand(void);
#ifdef MATHLIB_STANDALONE
void set_seed(unsigned int, unsigned int);
void get_seed(unsigned int *, unsigned int *);
#endif
/* Normal Distribution */
double dnorm(double, double, double, int);
double pnorm(double, double, double, int, int);
double qnorm(double, double, double, int, int);
double rnorm(double, double);
void pnorm_both(double, double *, double *, int, int);/* both tails */
/* Uniform Distribution */
double dunif(double, double, double, int);
double punif(double, double, double, int, int);
double qunif(double, double, double, int, int);
double runif(double, double);
/* Gamma Distribution */
double dgamma(double, double, double, int);
double pgamma(double, double, double, int, int);
double qgamma(double, double, double, int, int);
double rgamma(double, double);
double log1pmx(double);
double log1pexp(double); // <-- ../nmath/plogis.c
double lgamma1p(double);
double logspace_add(double, double);
double logspace_sub(double, double);
/* Beta Distribution */
double dbeta(double, double, double, int);
double pbeta(double, double, double, int, int);
double qbeta(double, double, double, int, int);
double rbeta(double, double);
/* Lognormal Distribution */
double dlnorm(double, double, double, int);
double plnorm(double, double, double, int, int);
double qlnorm(double, double, double, int, int);
double rlnorm(double, double);
/* Chi-squared Distribution */
double dchisq(double, double, int);
double pchisq(double, double, int, int);
double qchisq(double, double, int, int);
double rchisq(double);
/* Non-central Chi-squared Distribution */
double dnchisq(double, double, double, int);
double pnchisq(double, double, double, int, int);
double qnchisq(double, double, double, int, int);
double rnchisq(double, double);
/* F Distibution */
double df(double, double, double, int);
double pf(double, double, double, int, int);
double qf(double, double, double, int, int);
double rf(double, double);
/* Student t Distibution */
double dt(double, double, int);
double pt(double, double, int, int);
double qt(double, double, int, int);
double rt(double);
/* Binomial Distribution */
double dbinom(double, double, double, int);
double pbinom(double, double, double, int, int);
double qbinom(double, double, double, int, int);
double rbinom(double, double);
/* Multnomial Distribution */
void rmultinom(int, double*, int, int*);
/* Cauchy Distribution */
double dcauchy(double, double, double, int);
double pcauchy(double, double, double, int, int);
double qcauchy(double, double, double, int, int);
double rcauchy(double, double);
/* Exponential Distribution */
double dexp(double, double, int);
double pexp(double, double, int, int);
double qexp(double, double, int, int);
double rexp(double);
/* Geometric Distribution */
double dgeom(double, double, int);
double pgeom(double, double, int, int);
double qgeom(double, double, int, int);
double rgeom(double);
/* Hypergeometric Distibution */
double dhyper(double, double, double, double, int);
double phyper(double, double, double, double, int, int);
double qhyper(double, double, double, double, int, int);
double rhyper(double, double, double);
/* Negative Binomial Distribution */
double dnbinom(double, double, double, int);
double pnbinom(double, double, double, int, int);
double qnbinom(double, double, double, int, int);
double rnbinom(double, double);
double dnbinom_mu(double, double, double, int);
double pnbinom_mu(double, double, double, int, int);
double qnbinom_mu(double, double, double, int, int);
double rnbinom_mu(double, double);
/* Poisson Distribution */
double dpois(double, double, int);
double ppois(double, double, int, int);
double qpois(double, double, int, int);
double rpois(double);
/* Weibull Distribution */
double dweibull(double, double, double, int);
double pweibull(double, double, double, int, int);
double qweibull(double, double, double, int, int);
double rweibull(double, double);
/* Logistic Distribution */
double dlogis(double, double, double, int);
double plogis(double, double, double, int, int);
double qlogis(double, double, double, int, int);
double rlogis(double, double);
/* Non-central Beta Distribution */
double dnbeta(double, double, double, double, int);
double pnbeta(double, double, double, double, int, int);
double qnbeta(double, double, double, double, int, int);
double rnbeta(double, double, double);
/* Non-central F Distribution */
double dnf(double, double, double, double, int);
double pnf(double, double, double, double, int, int);
double qnf(double, double, double, double, int, int);
/* Non-central Student t Distribution */
double dnt(double, double, double, int);
double pnt(double, double, double, int, int);
double qnt(double, double, double, int, int);
/* Studentized Range Distribution */
double ptukey(double, double, double, double, int, int);
double qtukey(double, double, double, double, int, int);
/* Wilcoxon Rank Sum Distribution */
double dwilcox(double, double, double, int);
double pwilcox(double, double, double, int, int);
double qwilcox(double, double, double, int, int);
double rwilcox(double, double);
/* Wilcoxon Signed Rank Distribution */
double dsignrank(double, double, int);
double psignrank(double, double, int, int);
double qsignrank(double, double, int, int);
double rsignrank(double);
/* Gamma and Related Functions */
double gammafn(double);
double lgammafn(double);
double lgammafn_sign(double, int*);
void dpsifn(double, int, int, int, double*, int*, int*);
double psigamma(double, double);
double digamma(double);
double trigamma(double);
double tetragamma(double);
double pentagamma(double);
double beta(double, double);
double lbeta(double, double);
double choose(double, double);
double lchoose(double, double);
/* Bessel Functions */
double bessel_i(double, double, double);
double bessel_j(double, double);
double bessel_k(double, double, double);
double bessel_y(double, double);
double bessel_i_ex(double, double, double, double *);
double bessel_j_ex(double, double, double *);
double bessel_k_ex(double, double, double, double *);
double bessel_y_ex(double, double, double *);
/* General Support Functions */
#ifndef HAVE_HYPOT
double hypot(double, double);
#endif
double pythag(double, double);
#ifndef HAVE_EXPM1
double expm1(double); /* = exp(x)-1 {care for small x} */
#endif
#ifndef HAVE_LOG1P
double log1p(double); /* = log(1+x) {care for small x} */
#endif
int imax2(int, int);
int imin2(int, int);
double fmax2(double, double);
double fmin2(double, double);
double sign(double);
double fprec(double, double);
double fround(double, double);
double fsign(double, double);
double ftrunc(double);
double log1pmx(double); /* Accurate log(1+x) - x, {care for small x} */
double lgamma1p(double);/* accurate log(gamma(x+1)), small x (0 < x < 0.5) */
/* More accurate cos(pi*x), sin(pi*x), tan(pi*x)
In future these declarations could clash with system headers if
someone had already included math.h with
__STDC_WANT_IEC_60559_TYPES_EXT__ defined.
We can add a check for that via the value of
__STDC_IEC_60559_FUNCS__ (>= 201ymmL, exact value not yet known).
*/
double cospi(double);
double sinpi(double);
double tanpi(double);
/* Compute the log of a sum or difference from logs of terms, i.e.,
*
* log (exp (logx) + exp (logy))
* or log (exp (logx) - exp (logy))
*
* without causing overflows or throwing away too much accuracy:
*/
double logspace_add(double logx, double logy);
double logspace_sub(double logx, double logy);
/* ----------------- Private part of the header file ------------------- */
/* old-R Compatibility */
#ifdef OLD_RMATH_COMPAT
# define snorm norm_rand
# define sunif unif_rand
# define sexp exp_rand
#endif
#if defined(MATHLIB_STANDALONE) && !defined(MATHLIB_PRIVATE_H)
/* second is defined by nmath.h */
/* If isnan is a macro, as C99 specifies, the C++
math header will undefine it. This happens on OS X */
# ifdef __cplusplus
int R_isnancpp(double); /* in mlutils.c */
# define ISNAN(x) R_isnancpp(x)
# else
# define ISNAN(x) (isnan(x)!=0)
# endif
# define R_FINITE(x) R_finite(x)
int R_finite(double);
# ifdef _WIN32 /* not Win32 as no config information */
# ifdef RMATH_DLL
# define R_EXTERN extern __declspec(dllimport)
# else
# define R_EXTERN extern
# endif
R_EXTERN double NA_REAL;
R_EXTERN double R_PosInf;
R_EXTERN double R_NegInf;
R_EXTERN int N01_kind;
# undef R_EXTERN
#else
extern int N01_kind;
# endif
#endif /* MATHLIB_STANDALONE */
#ifdef __cplusplus
}
#endif
#endif /* RMATH_H */
|