27 #ifndef expModGaussian_hpp
28 #define expModGaussian_hpp
30 #include <boost/math/tools/minima.hpp>
53 template<
typename realT>
60 return (lambda/2)*exp((lambda/2)*(2*mu+lambda*
sigma*
sigma-2*x))*std::erfc((mu+lambda*
sigma*
sigma-x)/(root_two<realT>()*
sigma));
73 template<
typename realT>
78 return mu + 1.0/lambda;
91 template<
typename realT>
99 template<
typename realT>
106 realT operator()(
const realT & x)
122 template<
typename realT>
131 std::cerr << mn <<
" " << sd <<
"\n";
133 emgModeFunc<realT> mf;
138 uintmax_t maxit = 1000;
141 std::pair<realT,realT> brack;
142 brack = boost::math::tools::brent_find_minima<emgModeFunc<realT>, realT>(mf, mn-2*sd, mn+2*sd, std::numeric_limits<realT>::digits, maxit);
143 std::cerr << brack.first <<
" " << brack.second <<
" " << maxit <<
"\n";
149 std::cerr <<
"expModGaussianMode: No mode found\n";
150 return std::numeric_limits<realT>::quiet_NaN();
constexpr units::realT sigma()
Stefan-Boltzmann Constant.
realT expModGaussianVariance(realT sigma, realT lambda)
The Variance of the Exponentially Modified Gaussian.
realT expModGaussian(realT x, realT mu, realT sigma, realT lambda)
The Exponentially Modified Gaussian at a point.
realT expModGaussianMode(realT mu, realT sigma, realT lambda)
The Mode of the Exponentially Modified Gaussian.
realT expModGaussianMean(realT mu, realT lambda)
The Mean of the Exponentially Modified Gaussian.