Revision 795 branches/replacement/src/linad99/vgamdev.cpp

vgamdev.cpp (revision 795)
4 4
 * Author: David Fournier
5 5
 * Copyright (c) 2008, 2009 Regents of the University of California 
6 6
 */
7
/**
8
 * \file
9
 * This file deals with the Incomplete Gamma Functions
10
 * of constant types. All supporting mathematical functions
11
 * required to compute the Inmomplete Gamma Function
12
 * are included. They being: log gamma,
13
 * and some polynomial evaluation functions.
14
 */
15
/**
16
 * \defgroup gammafunc
17
 */
7 18

  
8 19
#include <fvar.hpp>
9
//#include "mconf.h"
10
//#define ITMAX 100
11
//#define EPS 1.0e-9
12
//#define FPMIN 1.0e-30
13
//static void gcf(double& gammcf,double a,double x,double &gln);
14
//static void gser(double& gamser,double a,double x,double& gln);
15 20

  
16
namespace Cephes
17
{
18
   extern const double A[];
19
   extern const double B[];
20
   extern const double C[];
21
   extern int sgngam;
22
   extern const double MAXLOG;
23
   extern const double MAXNUM;
24
   extern const double PI;
25
   extern const double LOGPI;
26
   extern const double big;
27
   extern const double biginv;
28
   extern const double MACHEP;
29
   extern const double MYINF;
30
   extern const double SQTPI;
31
   extern const double MAXLGM;
32
   extern const double LS2PI;
33
   extern const double MAXSTIR;
34

  
35
   double polevl(double x, void *_coef, int N);
36
   double p1evl(double x, void *_coef, int N);
37

  
38
   /**
39
    * \ingroup gammafunc
40
    * Polynomial evaluation
41
    * \param x \f$x\f$
42
    * \param _coef The coefficents of the polynomial
43
    * \param N \f$N\f$ The degree of the polynomial
44
    * \return The polynomial evaluated at \f$x\f$
45
    * 
46
    * \n\n Cephes Math Library Release 2.1:  December, 1988
47
    * Copyright 1984, 1987, 1988 by Stephen L. Moshier 
48
    * Direct inquiries to 30 Frost Street, Cambridge, MA 02140
49
    */
50
   double polevl(double x, void *_coef, int N)
51
   {
52
      double *coef = (double *) (_coef);
53
      double ans;
54
      int i;
55
      double *p;
56

  
57
       p = coef;
58
       ans = *p++;
59
       i = N;
60

  
61
      do
62
	  ans = ans * x + *p++;
63
      while (--i);
64

  
65
       return (ans);
66
   }
67

  
68

  
69
   /**
70
    * \ingroup gammafunc
71
    * Polynomial evaluation when leading coefficent is 1
72
    * (i.e. leading term is \f$x^N\f$)
73
    * \param x \f$x\f$
74
    * \param _coef The coefficents of the polynomial
75
    * \param N \f$N\f$ The degree of the polynomial
76
    * \return The polynomial evaluated at \f$x\f$
77
    * 
78
    * \n\n Cephes Math Library Release 2.1:  December, 1988
79
    * Copyright 1984, 1987, 1988 by Stephen L. Moshier 
80
    * Direct inquiries to 30 Frost Street, Cambridge, MA 02140
81
    */
82
   double p1evl(double x, void *_coef, int N)
83
   {
84
      double *coef = (double *) (_coef);
85
      double ans;
86
      double *p;
87
      int i;
88

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff