BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
NumRecipes Class Reference

#include <NumRecipes.h>

Static Public Member Functions

static double gammln (double x)
 
static double gammq (double a, double x)
 
static double gammp (double a, double x)
 
static void gcf (double *gammcf, double a, double x, double *gln)
 
static void gser (double *gamser, double a, double x, double *gln)
 
static double gammln (double x)
 
static double gammq (double a, double x)
 
static double gammp (double a, double x)
 
static void gcf (double *gammcf, double a, double x, double *gln)
 
static void gser (double *gamser, double a, double x, double *gln)
 

Detailed Description

Member Function Documentation

◆ gammln() [1/2]

double NumRecipes::gammln ( double x)
static

Definition at line 40 of file NumRecipes.cxx.

41{
42 double x,y,tmp,ser;
43 static double cof[6]={76.18009172947146,-86.50532032941677,
44 24.01409824083091,-1.231739572450155,
45 0.1208650973866179e-2,-0.5395239384953e-5};
46 int j;
47
48 y=x=xx;
49 tmp=x+5.5;
50 tmp -= (x+0.5)*log(tmp);
51 ser=1.000000000190015;
52 for (j=0;j<=5;j++) ser += cof[j]/++y;
53 return -tmp+log(2.5066282746310005*ser/x);
54}
Double_t x[10]
double y[1000]

Referenced by ChisqConsistency::ChisqConsistency(), ChisqConsistency::ChisqConsistency(), gcf(), and gser().

◆ gammln() [2/2]

static double NumRecipes::gammln ( double x)
static

◆ gammp() [1/2]

double NumRecipes::gammp ( double a,
double x )
static

Definition at line 57 of file NumRecipes.cxx.

58{
59 double gamser,gammcf,gln;
60
61 if (x < 0.0 || a <= 0.0) std::cout<<"ErrMsg(error)" <<" Invalid arguments in routine gammp x=" << x << " a=" << a << endl;
62 if (x < (a+1.0)) {
63 gser(&gamser,a,x,&gln);
64 return gamser;
65 } else {
66 gcf(&gammcf,a,x,&gln);
67 return 1.0-gammcf;
68 }
69}
static void gser(double *gamser, double a, double x, double *gln)
static void gcf(double *gammcf, double a, double x, double *gln)

◆ gammp() [2/2]

static double NumRecipes::gammp ( double a,
double x )
static

◆ gammq() [1/2]

double NumRecipes::gammq ( double a,
double x )
static

Definition at line 72 of file NumRecipes.cxx.

73{
74 double gamser,gammcf,gln;
75
76 if (x < 0.0 || a <= 0.0) recipesErr(" Invalid arguments in routine GAMMQ");
77 if (x < (a+1.0)) {
78 gser(&gamser,a,x,&gln);
79 return 1.0-gamser;
80 } else {
81 gcf(&gammcf,a,x,&gln);
82 return gammcf;
83 }
84}

Referenced by ChisqConsistency::ChisqConsistency().

◆ gammq() [2/2]

static double NumRecipes::gammq ( double a,
double x )
static

◆ gcf() [1/2]

void NumRecipes::gcf ( double * gammcf,
double a,
double x,
double * gln )
static

Definition at line 86 of file NumRecipes.cxx.

87 {
88 int n;
89 double gold=0.0,g,fac=1.0,b1=1.0;
90 double b0=0.0,anf,ana,an,a1,a0=1.0;
91
92 *gln=gammln(a);
93 a1=x;
94 for (n=1;n<=NUMREC_ITMAX;n++) {
95 an=(double) n;
96 ana=an-a;
97 a0=(a1+a0*ana)*fac;
98 b0=(b1+b0*ana)*fac;
99 anf=an*fac;
100 a1=x*a0+anf*a1;
101 b1=x*b0+anf*b1;
102 if (a1) {
103 fac=1.0/a1;
104 g=b1*fac;
105 if (fabs((g-gold)/g) < NUMREC_EPS) {
106 *gammcf=exp(-x+a*log(x)-(*gln))*g;
107 return;
108 }
109 gold=g;
110 }
111 }
112 recipesErr(" a too large, NUMREC_ITMAX too small in routine GCF");
113 }
const Int_t n
EvtComplex exp(const EvtComplex &c)
static double gammln(double x)

Referenced by gammp(), and gammq().

◆ gcf() [2/2]

static void NumRecipes::gcf ( double * gammcf,
double a,
double x,
double * gln )
static

◆ gser() [1/2]

void NumRecipes::gser ( double * gamser,
double a,
double x,
double * gln )
static

Definition at line 115 of file NumRecipes.cxx.

116{
117 int n;
118 double sum,del,ap;
119
120 *gln=gammln(a);
121 if (x <= 0.0) {
122 if (x < 0.0) recipesErr(" x less than 0 in routine GSER");
123 *gamser=0.0;
124 return;
125 } else {
126 ap=a;
127 del=sum=1.0/a;
128 for (n=1;n<=NUMREC_ITMAX;n++) {
129 ap += 1.0;
130 del *= x/ap;
131 sum += del;
132 if (fabs(del) < fabs(sum)*NUMREC_EPS) {
133 *gamser=sum*exp(-x+a*log(x)-(*gln));
134 return;
135 }
136 }
137 recipesErr(" a too large, NUMREC_ITMAX too small in routine GSER");
138 return;
139 }
140}

Referenced by gammp(), and gammq().

◆ gser() [2/2]

static void NumRecipes::gser ( double * gamser,
double a,
double x,
double * gln )
static

The documentation for this class was generated from the following files: