Skip to content

Commit

Permalink
Merge pull request #677 from karlnapf/master
Browse files Browse the repository at this point in the history
added inverse gamma cdf to statistics
  • Loading branch information
karlnapf committed Jul 25, 2012
2 parents a88feed + adc555a commit 0f8b2a9
Show file tree
Hide file tree
Showing 7 changed files with 336 additions and 55 deletions.
23 changes: 23 additions & 0 deletions examples/undocumented/libshogun/statistics.cpp
Expand Up @@ -178,6 +178,28 @@ void test_error_function_complement()
ASSERT(difference<=10E-16);
}

void test_inverse_gamma_cdf()
{
/* some tests for high precision MATLAB comparison */
float64_t difference=CStatistics::inverse_gamma_cdf(0.5, 1.0, 1.0);
SG_SPRINT("inverse_gamma_cdf(0.5, 1.0, 1.0)=%f\n", difference);
difference-=0.693147180559945;
difference=CMath::abs(difference);
ASSERT(difference<=10E-16);

difference=CStatistics::inverse_gamma_cdf(0.5, 0.5, 0.3);
SG_SPRINT("inverse_gamma_cdf(0.5, 0.5, 0.3)=%f\n", difference);
difference-= 0.068240463467936;
difference=CMath::abs(difference);
ASSERT(difference<=10E-16);

difference=CStatistics::inverse_gamma_cdf(0.8, 0.1, 0.3);
SG_SPRINT("inverse_gamma_cdf(0.8, 0.1, 0.3)=%f\n", difference);
difference-=0.020816964971992;
difference=CMath::abs(difference);
ASSERT(difference<=10E-16);
}

#ifdef HAVE_LAPACK
void test_covariance_matrix()
{
Expand All @@ -204,6 +226,7 @@ int main(int argc, char **argv)
test_inverse_student_t();
test_incomplete_gamma();
test_gamma_cdf();
test_inverse_gamma_cdf();
test_normal();
test_error_function();
test_error_function_complement();
Expand Down

0 comments on commit 0f8b2a9

Please sign in to comment.