Skip to content

Commit

Permalink
add (non working) incompete gamma
Browse files Browse the repository at this point in the history
  • Loading branch information
karlnapf committed Mar 27, 2016
1 parent 6cff106 commit d69e52b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/shogun/mathematics/Statistics.cpp
Expand Up @@ -661,6 +661,12 @@ float64_t CStatistics::inverse_gamma_cdf(float64_t p, float64_t a,
return inverse_incomplete_gamma_completed(a, 1-p)*b;
}

float64_t CStatistics::incomplete_gamma(float64_t a, float64_t x)
{
SG_SERROR("NOT IMPLEMENTED");
return 0;
}

//float64_t CStatistics::incomplete_beta(float64_t a, float64_t b, float64_t x)
//{
// SG_SERROR("NOT IMPLEMENTED");
Expand Down
18 changes: 18 additions & 0 deletions src/shogun/mathematics/Statistics.h
Expand Up @@ -214,6 +214,24 @@ class CStatistics: public CSGObject
return ::tgamma((double) x);
}

/** Incomplete gamma integral
*
* Given \f$p\f$, the function finds \f$x\f$ such that
*
* \f[
* \text{incomplete\_gamma}(a,x)=\frac{1}{\Gamma(a)}}\int_0^x e^{-t} t^{a-1} dt.
* \f]
*
*
* In this implementation both arguments must be positive.
* The integral is evaluated by either a power series or
* continued fraction expansion, depending on the relative
* values of \f$a\f$ and \f$x\f$.
*
* Taken from ALGLIB under gpl2+
*/
static float64_t incomplete_gamma(float64_t a, float64_t x);

/** Evaluates the CDF of the gamma distribution with given parameters \f$a, b\f$
* at \f$x\f$.
*
Expand Down

0 comments on commit d69e52b

Please sign in to comment.