17 #include <type_traits> 19 #include <boost/math/special_functions/pow.hpp> 20 #include <boost/math/constants/constants.hpp> 21 #include <boost/math/distributions/normal.hpp> 26 namespace constants = boost::math::double_constants;
31 using boost::math::pow;
36 class =
typename std::enable_if<std::is_integral<T>::value>::type>
37 bool isOdd(
const T& v);
40 class =
typename std::enable_if<std::is_integral<T>::value>::type>
41 bool isEven(
const T& v);
44 inline T& constrain(T& input,
const T& min,
const T& max);
47 inline T constrain(T&& input,
const T& min,
const T& max);
56 double normalPDF(
double x,
double mean = 0.0,
double sigma = 1.0);
69 double biVariateNormalPDF(
double x1,
double x2,
double mean1 = 0.0,
double mean2 = 0.0,
double sigma1 = 1.0,
double sigma2 = 1.0,
double corr = 0.0);
71 double normal1SidedCDF(
double nSigmas = 1.0);
72 double normal1SidedQuantile(
double prob = 0.682689);
74 double chiSquareQuantile(
double prob,
size_t nParams);
75 double chiSquareQuantileFromSigmas(
double nSigmas,
size_t nParams);
77 double chiSquareCDF(
double value,
size_t nParams);
78 double chiSquareToSigmas(
double value,
size_t nParams);
83 inline double normalPDF(
double x,
double mean,
double sigma)
85 return boost::math::pdf( boost::math::normal(mean, sigma), x );
88 template <
typename T,
class>
89 inline bool isOdd(
const T& v)
94 template <
typename T,
class>
95 inline bool isEven(
const T& v)
100 template <
typename T>
101 inline T& constrain(T& input,
const T& min,
const T& max)
108 else if (input > max)
114 template <
typename T>
115 inline T constrain(T&& input,
const T& min,
const T& max)
118 constrain(result, min, max);
Definition: algorithm.cpp:28
double normalPDF(double x, double mean=0.0, double sigma=1.0)
A standard normal (Gaussian) distribution.
Definition: math.hpp:83
double biVariateNormalPDF(double x1, double x2, double mean1, double mean2, double sigma1, double sigma2, double corr)
A 2-dimensional normal distribution.
Definition: math.cpp:27