12 #include <gtest/gtest.h> 19 const double eps = 1e-12;
21 TEST(distributions, normalPDF_1d)
29 TEST(distributions, normalPDF_vector)
31 const double cov_vals[3 * 3] = {4.0, 2.0, 1.0, 2.0, 3.0,
33 const double x1_vals[3] = {1.0, 0.0, 0.0};
34 const double x2_vals[3] = {1.0, 2.0, 3.0};
42 normalPDF(x0, x0, COV), 0.02592116832548877620,
45 normalPDF(x2, x2, COV), 0.02592116832548877620,
49 normalPDF(x1, x0, COV), 0.02061240910323311470,
52 normalPDF(x2, x0, COV), 0.00008423820480102986,
56 normalPDF(x1, COV), 0.02061240910323311470,
59 normalPDF(x2, COV), 0.00008423820480102986,
65 const double eps2 = 1e-7;
67 EXPECT_NEAR(std::erfc(0), 1,
eps);
68 EXPECT_NEAR(std::erfc(1), 0.157299207050285, eps2);
69 EXPECT_NEAR(std::erfc(2), 0.004677734981047, eps2);
74 const double eps2 = 1e-7;
76 EXPECT_NEAR(std::erf(0), 0,
eps);
77 EXPECT_NEAR(std::erf(1), 0.842700792949715, eps2);
78 EXPECT_NEAR(std::erf(2), 0.995322265018953, eps2);
108 const double eps2 = 1e-7;
A namespace of pseudo-random numbers generators of diferent distributions.
TEST(distributions, normalPDF_1d)
double normalCDF(double p)
Evaluates the Gaussian cumulative density function.
This base provides a set of functions for maths stuff.
std::pair< double, double > noncentralChi2PDF_CDF(unsigned int degreesOfFreedom, double noncentrality, double arg, double eps=1e-7)
Returns the 'exact' PDF (first) and CDF (second) of a Non-central chi-squared probability distributio...
double chi2PDF(unsigned int degreesOfFreedom, double arg, double accuracy=1e-7)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
double chi2inv(double P, unsigned int dim=1)
The "quantile" of the Chi-Square distribution, for dimension "dim" and probability 0<P<1 (the inverse...
double normalPDF(double x, double mu, double std)
Evaluates the univariate normal (Gaussian) distribution at a given point "x".