34 |
#include "gamma.h" |
#include "gamma.h" |
35 |
#include "error.h" |
#include "error.h" |
36 |
|
|
|
/* |
|
|
* Wrapper for the functions that do the work. |
|
|
*/ |
|
|
int gsl_cdf_gamma_e ( double x, double alpha, |
|
|
double beta, gsl_cdf_tail_t tail, gsl_cdf_result *result) |
|
|
{ |
|
|
int rc = 0; |
|
|
if( beta <= 0.0 ) |
|
|
{ |
|
|
DOMAIN_ERROR(result); |
|
|
} |
|
|
else if ( tail == GSL_CDF_LOWER ) |
|
|
{ |
|
|
rc = gamma_inc_P_e ( alpha, (x/beta), result); |
|
|
} |
|
|
else if (tail == GSL_CDF_UPPER ) |
|
|
{ |
|
|
rc = gamma_inc_Q_e ( alpha, (x/beta), result); |
|
|
} |
|
|
return rc; |
|
|
} |
|
|
|
|
37 |
/* The dominant part, |
/* The dominant part, |
38 |
* D(a,x) := x^a e^(-x) / Gamma(a+1) |
* D(a,x) := x^a e^(-x) / Gamma(a+1) |
39 |
*/ |
*/ |
518 |
} |
} |
519 |
} |
} |
520 |
|
|
|
|
|
521 |
/*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/ |
/*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/ |
522 |
|
|
523 |
#include "eval.h" |
#include "eval.h" |
531 |
{ |
{ |
532 |
EVAL_RESULT(gamma_inc_Q_e(a, x, &result)); |
EVAL_RESULT(gamma_inc_Q_e(a, x, &result)); |
533 |
} |
} |
534 |
|
|
535 |
|
/* |
536 |
|
* Wrapper for the functions that do the work. |
537 |
|
*/ |
538 |
|
int gsl_cdf_gamma_e ( double x, double scale, double shape, |
539 |
|
gsl_cdf_tail_t tail, gsl_cdf_result *result) |
540 |
|
{ |
541 |
|
int rc = 0; |
542 |
|
if( shape <= 0.0 ) |
543 |
|
{ |
544 |
|
DOMAIN_ERROR(result); |
545 |
|
} |
546 |
|
else if ( tail == GSL_CDF_LOWER ) |
547 |
|
{ |
548 |
|
rc = gamma_inc_P_e ( scale, (x/shape), result); |
549 |
|
} |
550 |
|
else if (tail == GSL_CDF_UPPER ) |
551 |
|
{ |
552 |
|
rc = gamma_inc_Q_e ( scale, (x/shape), result); |
553 |
|
} |
554 |
|
return rc; |
555 |
|
} |
556 |
|
|
557 |
|
/* |
558 |
|
* No error code. |
559 |
|
*/ |
560 |
|
double gsl_cdf_gamma ( double x, double scale, |
561 |
|
double shape, gsl_cdf_tail_t tail ) |
562 |
|
{ |
563 |
|
EVAL_RESULT ( gsl_cdf_gamma_e ( x, scale, shape, tail, &result)); |
564 |
|
} |