1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-09-20 05:25:37 +01:00

Math: chi^2 p-value function from GSL

This commit is contained in:
Antonin Portelli 2015-11-02 16:17:59 +00:00 committed by Antonin Portelli
parent 7561d419a3
commit f251769a1c
2 changed files with 18 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include <LatAnalyze/Math.hpp>
#include <LatAnalyze/includes.hpp>
#include <gsl/gsl_cdf.h>
using namespace std;
using namespace Latan;
@ -90,3 +91,11 @@ DEF_STD_FUNC_2ARG(fmin)
// Absolute value
DEF_STD_FUNC_1ARG(fabs)
// p-value
auto chi2PValueVecFunc = [](const double arg[2])
{
return gsl_cdf_chisq_Q(arg[0], arg[1]);
};
DoubleFunction MATH_NAMESPACE::chi2PValue(chi2PValueVecFunc, 2);

View File

@ -141,6 +141,15 @@ DECL_STD_FUNC(fmin)
// Absolute value
DECL_STD_FUNC(fabs)
/******************************************************************************
* Other functions *
******************************************************************************/
// p-value
namespace MATH_NAMESPACE
{
extern DoubleFunction chi2PValue;
}
END_LATAN_NAMESPACE
#endif // Latan_Math_hpp_