Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
CommonTools
Statistics
src
GammaContinuedFraction.cc
Go to the documentation of this file.
1
#include "
CommonTools/Statistics/src/GammaContinuedFraction.h
"
2
#include <cmath>
3
#include <iostream>
4
5
#define ITMAX 100 // maximum allowed number of iterations
6
#define EPS 3.0e-7 // relative accuracy
7
#define FPMIN 1.0e-30 // number near the smallest representable floating-point number
8
9
float
GammaContinuedFraction
(
float
a
,
float
x
) {
10
int
i
;
11
float
an, del;
12
13
/* Set up for evaluating continued fraction by modified Lentz's method (par.5.2
14
in Numerical Recipes in C) with b_0 = 0 */
15
double
b
= x + 1.0 -
a
;
16
double
c
= 1.0 /
FPMIN
;
17
double
d
= 1.0 /
b
;
18
double
h
=
d
;
19
for
(i = 1; i <=
ITMAX
; i++) {
20
an = -i * (i -
a
);
21
b += 2.0;
22
d = an * d +
b
;
23
if
(fabs(d) <
FPMIN
)
24
d =
FPMIN
;
25
c = b + an /
c
;
26
if
(fabs(c) <
FPMIN
)
27
c =
FPMIN
;
28
d = 1.0 /
d
;
29
del = d *
c
;
30
h *= del;
31
if
(fabs(del - 1.0) <
EPS
)
32
break
;
33
}
34
if
(i >
ITMAX
)
35
std::cerr
<<
"GammaContinuedFraction::a too large, "
36
<<
"ITMAX too small"
<< std::endl;
37
return
h
;
38
}
39
#undef ITMAX
40
#undef EPS
41
#undef FPMIN
42
/* (C) Copr. 1986-92 Numerical Recipes Software B2.. */
c
const edm::EventSetup & c
Definition:
SiStripLAProfileBooker.cc:66
mps_fire.i
i
Definition:
mps_fire.py:428
EPS
#define EPS
Definition:
GammaContinuedFraction.cc:6
ztail.d
tuple d
Definition:
ztail.py:151
gpuClustering::x
uint16_t const *__restrict__ x
Definition:
gpuClustering.h:39
FPMIN
#define FPMIN
Definition:
GammaContinuedFraction.cc:7
GammaContinuedFraction.h
b
double b
Definition:
hdecay.h:118
GammaContinuedFraction
float GammaContinuedFraction(float a, float x)
Definition:
GammaContinuedFraction.cc:9
a
double a
Definition:
hdecay.h:119
h
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition:
Activities.doc:4
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
tuple cerr
Definition:
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
ITMAX
#define ITMAX
Definition:
GammaContinuedFraction.cc:5
Generated for CMSSW Reference Manual by
1.8.5