/[gsl]/gsl/cdf/cdf_gamma.c
ViewVC logotype

Diff of /gsl/cdf/cdf_gamma.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.4 by jstover, Fri Jan 3 04:29:41 2003 UTC revision 1.1.2.5 by jstover, Thu Jan 9 03:02:37 2003 UTC
# Line 34  Line 34 
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   */   */
# Line 540  static int gamma_inc_P_e(const double a, Line 518  static int gamma_inc_P_e(const double a,
518    }    }
519  }  }
520    
   
521  /*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/  /*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/
522    
523  #include "eval.h"  #include "eval.h"
# Line 554  double gsl_cdf_gamma_inc_Q(const double Line 531  double gsl_cdf_gamma_inc_Q(const double
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    }

Legend:
Removed from v.1.1.2.4  
changed lines
  Added in v.1.1.2.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26