12 #include <gtest/gtest.h> 20 const double eps = 1e-12;
22 TEST(distributions, normalPDF_1d)
30 TEST(distributions, normalPDF_vector)
32 const double cov_vals[3 * 3] = {4.0, 2.0, 1.0, 2.0, 3.0,
34 const double x1_vals[3] = {1.0, 0.0, 0.0};
35 const double x2_vals[3] = {1.0, 2.0, 3.0};
43 normalPDF(x0, x0, COV), 0.02592116832548877620,
46 normalPDF(x2, x2, COV), 0.02592116832548877620,
50 normalPDF(x1, x0, COV), 0.02061240910323311470,
53 normalPDF(x2, x0, COV), 0.00008423820480102986,
57 normalPDF(x1, COV), 0.02061240910323311470,
60 normalPDF(x2, COV), 0.00008423820480102986,
66 const double eps2 = 1e-7;
68 EXPECT_NEAR(std::erfc(0), 1,
eps);
69 EXPECT_NEAR(std::erfc(1), 0.157299207050285, eps2);
70 EXPECT_NEAR(std::erfc(2), 0.004677734981047, eps2);
75 const double eps2 = 1e-7;
77 EXPECT_NEAR(std::erf(0), 0,
eps);
78 EXPECT_NEAR(std::erf(1), 0.842700792949715, eps2);
79 EXPECT_NEAR(std::erf(2), 0.995322265018953, eps2);
109 const double eps2 = 1e-7;
A namespace of pseudo-random numbers genrators of diferent distributions.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
TEST(distributions, normalPDF_1d)
double normalCDF(double p)
Evaluates the Gaussian cumulative density function.
This base provides a set of functions for maths stuff.
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...
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 normalPDF(double x, double mu, double std)
Evaluates the univariate normal (Gaussian) distribution at a given point "x".
double chi2PDF(unsigned int degreesOfFreedom, double arg, double accuracy=1e-7)