STK++ 1.0
STK::Funct Namespace Reference

The namespace Funct enclose all usual and special functions. More...

Functions

Real betaRatio (Real const &a, Real const &b, Real const &x, bool lower_tail=true)
 Compute the incomplete beta function ratio.
Real factorial (Integer const &n)
 This function computes $ n! $ for Integer argument.
Real factorial (Real const &z)
 This function computes $ z! $ when z is an integer in a Real format.
Real factorialLn (Integer const &n)
 This function computes $ \ln(n!) $ for Integer argument.
Real factorialLn (Real const &z)
 This function computes $ \ln(z!) $ when z is an integer in a Real fromat.
Real gamma (Real const &z)
 This function computes the function $ \Gamma(z) $.
Real gammaLn (Real const &z)
 This function computes the function $ \ln(\Gamma(z)) $.
Real gammaLnStirlingError (Real const &z)
 Compute the error when we compute $ \ln(\Gamma(z)) $ using the Stirling's formula.
Real gammaLnStirlingError (Integer const &z)
 Compute the error when we compute $ \ln(\Gamma(z)) $ using the Stirling's formula and z is an Integer.
void stirlingCoefficients (STK::Vector &A)
 This function computes the n first coefficients of the Stirling's serie.
Real gammaRatio (Real const &a, Real const &x, const bool &lower_tail)
 Compute the incomplete gamma functions ratio.
Real gammaRatioQ (Real const &a, Real const &x)
 Compute the incomplete gamma function ratio Q(a,x).
Real gammaRatioP (Real const &a, Real const &x)
 Compute the incomplete gamma function ratio P(a,x).
Real poisson_pdf_raw (Real const &x, Real const &lambda)
 Compute the poisson density.
Real poisson_pdf_raw (Integer const &x, Real const &lambda)
 Compute the poisson density.
Real erf_raw (Real const &a)
 Compute the error fonction erf(a)
Real erfc_raw (Integer const &a)
 Compute the complementary error function erfc(a)
Real normal_cdf_raw (Real const &x)
 Compute the cumulative distribution function of the normal density.
Real normal_pdf_raw (Real const &x)
 compute the probability distribution function of the normal density
Real g0 (Real const &x)
 compute the partial deviance $g_0(x) = x\log(x)+ 1 - x$.
Real dev0 (Real const &a, Real const &b)
 compute the partial deviance $ d_0(a,b) = a\log(a/b)+ b - a $.
Real log1p (Real const &x)
 compute the fonction $ \log(1+x) $.
Real expm1 (Real const &x)
 compute the fonction $ \exp(x)-1 $.
static Real betaRatio_cf (Real const &a, Real const &b, Real const &x, bool lower_tail=true, Integer const &iterMax=1000)
 Compute the continued fraction of the beta function.
static Real betaRatio_ae (Real const &a, Real const &b, Real const &x, bool xm1, bool lower_tail)
 Compute the incomplete beta function ratio I_x(a,b) using its asymptotic expansion.
static Real serie_up (Real const &s, Real const &a, Real const &x, Integer const &n)
 Compute the recurrence formula of the incomplete beta ratio function.
static Real betaRatio_up (Real const &a, Real const &b, Real const &x, bool xm1, bool lower_tail)
 Compute the incomplete beta function ratio I_x(a,b) using its recurrence formula and its asymptotic expansion.
static Real betaRatio_sr (Real const &a, Real const &b, Real const &x, bool lower_tail)
 Compute the incomplete beta function ratio I_x(a,b) using its series representation.
static Real coefs_odd_se (Real const &std, Real const &qmp, Vector &A)
 compute the odd coefs of the beta Ratio function serie expansion.
static Real coefs_even_se (Real const &std, Real const &qmp, Vector &A)
 compute the even coefs of the beta Ratio function serie expansion.
static Real betaRatio_se (Real const &a, Real const &b, Real const &x, bool xm1, bool lower_tail, Integer const &iterMax=20)
 Compute the incomplete beta function ratio I_x(a,b) using its serie expansion.
static Real polevl (Real const &x, Real coef[], Integer const &N)
static Real p1evl (Real const &x, Real coef[], Integer const &N)
Real erfc_raw (Real const &a)
 Compute the function

\[ \mathrm{erfc}(a) = \frac{2}{\sqrt{\pi}} \int_a^{+\infty} e^{-t^2} dt \]

.

static Real lanczosSerie (Real const &z)
 Compute the Lanzcos correction serie for the gamma function with n = 21 terms.
static Real gammaLanczos (Real const &z)
 Compute the gamma function using the Lanzcos expansion using n = 21 terms and r= 22.618910.
static double stirlingSerie (Real const &z)
 Compute the Stirling's serie for the gammaLn function.
static Real gammaStirling (Real const &z)
 This function computes the gamma function using the Stirling approximation.
static Real gammaLnStirling (Real const &z)
 This function computes the log gamma function using the Stirling approximation.
static Real apois (Real const &a, Real const &b)
 Compute the poisson density up to a factor.
static Real gammaRatio_dl (Real const &a, Real const &x, const bool &lower_tail)
 Compute the incomplete gamma function ratio Q(a,x) using the Taylor serie development representation

\[ Q(a, x) = 1- \frac{x^a}{\Gamma(a+1)} - \frac{x^a}{\Gamma(a)} \sum_{n=1}^\infty (-1)^n\frac{x^n}{(a+n)n!} \]

.

static Real gammaRatio_cf (Real const &a, Real const &x, const bool lower_tail)
 Compute the incomplete gamma function ratio Q(a, x) using its continued fraction representation.
static Real gammaRatio_sr (Real const &a, Real const &x, const bool &lower_tail)
 Compute the incomplete gamma function ratio P(a,x) using the serie development representation.
static Real gammaRatio_ae (Real const &a, Real const &x, const bool &lower_tail)
 Compute the incomplete gamma function ratio Q(a,x) using its asymptotic expansion.
static Real poisson_ae (Real const &a1, Real const &apd, const bool &lower_tail=true)
 Compute the incomplete gamma function ratio P(a,x) using the Poisson asymptotic expansion.

Variables

static Real P [9]
static Real Q [8]
static Real R [6]
static Real S [6]
static Real T [5]
static Real U [5]
static const Real factorialArray [51]
 array for the 51th fisrt factorial elements.
static const Real factorialLnArray [51]
 array for the 51th fisrt ln factorial elements.
static const Real factorialHalvesArray [50]
 array for the 51th fisrt halves factorial elements.
static const Real factorialLnHalvesArray [50]
 array for the 51th fisrt halves ln factorial elements.
static const Real gammaLnStirlingErrorArray [100]
 array of the gammaLnStirlingError approximation for the values $ n=1, 2, 3, \ldots, 99 $.
static const Real gammaLnStirlingErrorHalvesArray [100]
 array of the gammaLnStirlingError for the values $ z=0.5, 1.5, , \ldots, 99.5 $.
static const Real lanczosCoefArray [21]
 array of the Lanzcos coefficients.
static const Real stirlingCoefArray [9]
 array of the Stirling coefficients.

Detailed Description

The namespace Funct enclose all usual and special functions.

The namespace Funct is the domain space of the special function like gamma function, beta function, incomplete gamma function, incomplete beta function... It include also some useful raw functions like log1p...


Function Documentation

static Real STK::Funct::polevl ( Real const &  x,
Real  coef[],
Integer const &  N 
) [inline, static]

Definition at line 123 of file STK_Funct_erf_raw.cpp.

References STK::sum().

Referenced by erf_raw(), and erfc_raw().

{
  Real *p = coef;

  Integer i = N;
  Real sum = *p++;
  do
    sum = sum * x + *p++;
  while ( --i);

  return ( sum );
}

Here is the call graph for this function:

static Real STK::Funct::p1evl ( Real const &  x,
Real  coef[],
Integer const &  N 
) [inline, static]

Definition at line 136 of file STK_Funct_erf_raw.cpp.

References STK::sum().

Referenced by erf_raw(), and erfc_raw().

{
  Real *p = coef;

  Integer i = N-1;
  Real sum = x + *p++;
  do
    sum = sum * x + *p++;
  while ( --i);
  
  return ( sum );
}

Here is the call graph for this function:


Variable Documentation

Real STK::Funct::P[9] [static]
Initial value:
{ 2.46196981473530512524E-10,
  5.64189564831068821977E-1,
  7.46321056442269912687E0,
  4.86371970985681366614E1,
  1.96520832956077098242E2,
  5.26445194995477358631E2,
  9.34528527171957607540E2,
  1.02755188689515710272E3,
  5.57535335369399327526E2
}

Definition at line 59 of file STK_Funct_erf_raw.cpp.

Referenced by STK::Svd::bidiag(), STK::Qr::compQ(), STK::Svd::compU(), erfc_raw(), STK::LocalVariance::minimalDistance(), and STK::LocalVariance::prim().

Real STK::Funct::Q[8] [static]
Initial value:
{
  
  1.32281951154744992508E1,
  8.67072140885989742329E1,
  3.54937778887819891062E2,
  9.75708501743205489753E2,
  1.82390916687909736289E3,
  2.24633760818710981792E3,
  1.65666309194161350182E3,
  5.57535340817727675546E2
}

Definition at line 71 of file STK_Funct_erf_raw.cpp.

Referenced by erfc_raw(), and STK::transpose().

Real STK::Funct::R[6] [static]
Initial value:
{ 5.64189583547755073984E-1,
  1.27536670759978104416E0,
  5.01905042251180477414E0,
  6.16021097993053585195E0,
  7.40974269950448939160E0,
  2.97886665372100240670E0
}

Definition at line 84 of file STK_Funct_erf_raw.cpp.

Referenced by erfc_raw(), STK::multLeftTranspose(), STK::multRightTranspose(), and STK::transpose().

Real STK::Funct::S[6] [static]
Initial value:
{
  
  2.26052863220117276590E0,
  9.39603524938001434673E0,
  1.20489539808096656605E1,
  1.70814450747565897222E1,
  9.60896809063285878198E0,
  3.36907645100081516050E0
}

Definition at line 93 of file STK_Funct_erf_raw.cpp.

Referenced by erfc_raw().

Real STK::Funct::T[5] [static]
Initial value:
{ 9.60497373987051638749E0,
  9.00260197203842689217E1,
  2.23200534594684319226E3,
  7.00332514112805075473E3,
  5.55923013010394962768E4
}

Definition at line 104 of file STK_Funct_erf_raw.cpp.

Referenced by STK::applySort(), STK::CArray2D< TYPE >::CArray2D(), erf_raw(), STK::MatrixSquare::operator=(), and STK::ITArray2DBase< TYPE, TYPE *, TArray2D >::pushBackByTransfer().

Real STK::Funct::U[5] [static]
Initial value:
{
  
  3.35617141647503099647E1,
  5.21357949780152679795E2,
  4.59432382970980127987E3,
  2.26290000613890934246E4,
  4.92673942608635921086E4
}

Definition at line 112 of file STK_Funct_erf_raw.cpp.

Referenced by erf_raw(), and MTRand::hash().