CMS 3D CMS Logo

IncompleteGammaComplement.cc
Go to the documentation of this file.
5 
7 
8 #include <iostream>
9 #include <cmath>
10 
11 float IncompleteGammaComplement::value(float a, float x) {
12  if (x < 0.0 || a <= 0.0)
13  edm::LogInfo("IncompleteGammaComplement") << "IncompleteGammaComplement::invalid arguments";
14  if (x < (a + 1.0))
15  // take the complement of the series representation
16  return 1. - GammaSeries(a, x) * (exp(-x + a * log(x) - GammaLn(a)));
17  else
18  // use the continued fraction representation
19  return GammaContinuedFraction(a, x) * (exp(-x + a * log(x) - GammaLn(a)));
20 }
21 
22 float IncompleteGammaComplement::ln(float a, float x) {
23  if (x < 0.0 || a <= 0.0)
24  edm::LogInfo("IncompleteGammaComplement") << "IncompleteGammaComplement::invalid arguments";
25  if (x < (a + 1.0))
26  // take the complement of the series representation
27  return log(1. - GammaSeries(a, x) * (exp(-x + a * log(x) - GammaLn(a))));
28  else
29  // use the continued fraction representation
30  return log(GammaContinuedFraction(a, x)) - x + a * log(x) - GammaLn(a);
31 }
float GammaLn(float z)
Definition: GammaLn.cc:4
Log< level::Info, false > LogInfo
float GammaContinuedFraction(float a, float x)
double a
Definition: hdecay.h:121
static float value(float a, float x)
float x
float GammaSeries(float a, float x)
Definition: GammaSeries.cc:8
static float ln(float a, float x)