24 #ifndef Rcpp__stats__gamma_h
25 #define Rcpp__stats__gamma_h
30 inline double dgamma_1(
double x,
double shape,
int log_p){
33 if (ISNAN(x) || ISNAN(shape) )
34 return x + shape + 1.0 ;
36 if (shape < 0)
return R_NaN ;
43 if (shape > 1)
return R_D__0;
45 return log_p ? 0.0 : 1.0 ;
49 pr = ::Rf_dpois(shape, x, log_p);
50 return log_p ? pr +
::log(shape/x) : pr*shape/x;
53 pr = ::Rf_dpois(shape-1, x, log_p);
56 inline double pgamma_1(
double x,
double alph,
int lower_tail,
int log_p){
57 return ::Rf_pgamma(x, alph, 1.0, lower_tail, log_p) ;
59 inline double qgamma_1(
double p,
double alpha,
int lower_tail,
int log_p){
60 return ::Rf_qgamma(p, alpha, 1.0, lower_tail, log_p );
71 RCPP_DPQ_2(gamma,::Rf_dgamma,::Rf_pgamma,::Rf_qgamma)
#define RCPP_DPQ_2(__NAME__, __D__, __P__, __Q__)
#define RCPP_DPQ_1(__NAME__, __D__, __P__, __Q__)
void log(InputIterator begin, InputIterator end, OutputIterator out)
double pgamma_1(double x, double alph, int lower_tail, int log_p)
double dgamma_1(double x, double shape, int log_p)
double qgamma_1(double p, double alpha, int lower_tail, int log_p)