hyperexponential.hpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. // Copyright 2014 Marco Guazzone (marco.guazzone@gmail.com)
  2. //
  3. // Use, modification and distribution are subject to the
  4. // Boost Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // This module implements the Hyper-Exponential distribution.
  8. //
  9. // References:
  10. // - "Queueing Theory in Manufacturing Systems Analysis and Design" by H.T. Papadopolous, C. Heavey and J. Browne (Chapman & Hall/CRC, 1993)
  11. // - http://reference.wolfram.com/language/ref/HyperexponentialDistribution.html
  12. // - http://en.wikipedia.org/wiki/Hyperexponential_distribution
  13. //
  14. #ifndef BOOST_MATH_DISTRIBUTIONS_HYPEREXPONENTIAL_HPP
  15. #define BOOST_MATH_DISTRIBUTIONS_HYPEREXPONENTIAL_HPP
  16. #include <boost/config.hpp>
  17. #include <boost/math/tools/cxx03_warn.hpp>
  18. #include <boost/math/distributions/complement.hpp>
  19. #include <boost/math/distributions/detail/common_error_handling.hpp>
  20. #include <boost/math/distributions/exponential.hpp>
  21. #include <boost/math/policies/policy.hpp>
  22. #include <boost/math/special_functions/fpclassify.hpp>
  23. #include <boost/math/tools/precision.hpp>
  24. #include <boost/math/tools/roots.hpp>
  25. #include <boost/range/begin.hpp>
  26. #include <boost/range/end.hpp>
  27. #include <boost/range/size.hpp>
  28. #include <boost/type_traits/has_pre_increment.hpp>
  29. #include <cstddef>
  30. #include <iterator>
  31. #include <limits>
  32. #include <numeric>
  33. #include <utility>
  34. #include <vector>
  35. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  36. # include <initializer_list>
  37. #endif
  38. #ifdef _MSC_VER
  39. # pragma warning (push)
  40. # pragma warning(disable:4127) // conditional expression is constant
  41. # pragma warning(disable:4389) // '==' : signed/unsigned mismatch in test_tools
  42. #endif // _MSC_VER
  43. namespace boost { namespace math {
  44. namespace detail {
  45. template <typename Dist>
  46. typename Dist::value_type generic_quantile(const Dist& dist, const typename Dist::value_type& p, const typename Dist::value_type& guess, bool comp, const char* function);
  47. } // Namespace detail
  48. template <typename RealT, typename PolicyT>
  49. class hyperexponential_distribution;
  50. namespace /*<unnamed>*/ { namespace hyperexp_detail {
  51. template <typename T>
  52. void normalize(std::vector<T>& v)
  53. {
  54. if(!v.size())
  55. return; // Our error handlers will get this later
  56. const T sum = std::accumulate(v.begin(), v.end(), static_cast<T>(0));
  57. T final_sum = 0;
  58. const typename std::vector<T>::iterator end = --v.end();
  59. for (typename std::vector<T>::iterator it = v.begin();
  60. it != end;
  61. ++it)
  62. {
  63. *it /= sum;
  64. final_sum += *it;
  65. }
  66. *end = 1 - final_sum; // avoids round off errors, ensures the probs really do sum to 1.
  67. }
  68. template <typename RealT, typename PolicyT>
  69. bool check_probabilities(char const* function, std::vector<RealT> const& probabilities, RealT* presult, PolicyT const& pol)
  70. {
  71. BOOST_MATH_STD_USING
  72. const std::size_t n = probabilities.size();
  73. RealT sum = 0;
  74. for (std::size_t i = 0; i < n; ++i)
  75. {
  76. if (probabilities[i] < 0
  77. || probabilities[i] > 1
  78. || !(boost::math::isfinite)(probabilities[i]))
  79. {
  80. *presult = policies::raise_domain_error<RealT>(function,
  81. "The elements of parameter \"probabilities\" must be >= 0 and <= 1, but at least one of them was: %1%.",
  82. probabilities[i],
  83. pol);
  84. return false;
  85. }
  86. sum += probabilities[i];
  87. }
  88. //
  89. // We try to keep phase probabilities correctly normalized in the distribution constructors,
  90. // however in practice we have to allow for a very slight divergence from a sum of exactly 1:
  91. //
  92. if (fabs(sum - 1) > tools::epsilon<RealT>() * 2)
  93. {
  94. *presult = policies::raise_domain_error<RealT>(function,
  95. "The elements of parameter \"probabilities\" must sum to 1, but their sum is: %1%.",
  96. sum,
  97. pol);
  98. return false;
  99. }
  100. return true;
  101. }
  102. template <typename RealT, typename PolicyT>
  103. bool check_rates(char const* function, std::vector<RealT> const& rates, RealT* presult, PolicyT const& pol)
  104. {
  105. const std::size_t n = rates.size();
  106. for (std::size_t i = 0; i < n; ++i)
  107. {
  108. if (rates[i] <= 0
  109. || !(boost::math::isfinite)(rates[i]))
  110. {
  111. *presult = policies::raise_domain_error<RealT>(function,
  112. "The elements of parameter \"rates\" must be > 0, but at least one of them is: %1%.",
  113. rates[i],
  114. pol);
  115. return false;
  116. }
  117. }
  118. return true;
  119. }
  120. template <typename RealT, typename PolicyT>
  121. bool check_dist(char const* function, std::vector<RealT> const& probabilities, std::vector<RealT> const& rates, RealT* presult, PolicyT const& pol)
  122. {
  123. BOOST_MATH_STD_USING
  124. if (probabilities.size() != rates.size())
  125. {
  126. *presult = policies::raise_domain_error<RealT>(function,
  127. "The parameters \"probabilities\" and \"rates\" must have the same length, but their size differ by: %1%.",
  128. fabs(static_cast<RealT>(probabilities.size())-static_cast<RealT>(rates.size())),
  129. pol);
  130. return false;
  131. }
  132. return check_probabilities(function, probabilities, presult, pol)
  133. && check_rates(function, rates, presult, pol);
  134. }
  135. template <typename RealT, typename PolicyT>
  136. bool check_x(char const* function, RealT x, RealT* presult, PolicyT const& pol)
  137. {
  138. if (x < 0 || (boost::math::isnan)(x))
  139. {
  140. *presult = policies::raise_domain_error<RealT>(function, "The random variable must be >= 0, but is: %1%.", x, pol);
  141. return false;
  142. }
  143. return true;
  144. }
  145. template <typename RealT, typename PolicyT>
  146. bool check_probability(char const* function, RealT p, RealT* presult, PolicyT const& pol)
  147. {
  148. if (p < 0 || p > 1 || (boost::math::isnan)(p))
  149. {
  150. *presult = policies::raise_domain_error<RealT>(function, "The probability be >= 0 and <= 1, but is: %1%.", p, pol);
  151. return false;
  152. }
  153. return true;
  154. }
  155. template <typename RealT, typename PolicyT>
  156. RealT quantile_impl(hyperexponential_distribution<RealT, PolicyT> const& dist, RealT const& p, bool comp)
  157. {
  158. // Don't have a closed form so try to numerically solve the inverse CDF...
  159. typedef typename policies::evaluation<RealT, PolicyT>::type value_type;
  160. typedef typename policies::normalise<PolicyT,
  161. policies::promote_float<false>,
  162. policies::promote_double<false>,
  163. policies::discrete_quantile<>,
  164. policies::assert_undefined<> >::type forwarding_policy;
  165. static const char* function = comp ? "boost::math::quantile(const boost::math::complemented2_type<boost::math::hyperexponential_distribution<%1%>, %1%>&)"
  166. : "boost::math::quantile(const boost::math::hyperexponential_distribution<%1%>&, %1%)";
  167. RealT result = 0;
  168. if (!check_probability(function, p, &result, PolicyT()))
  169. {
  170. return result;
  171. }
  172. const std::size_t n = dist.num_phases();
  173. const std::vector<RealT> probs = dist.probabilities();
  174. const std::vector<RealT> rates = dist.rates();
  175. // A possible (but inaccurate) approximation is given below, where the
  176. // quantile is given by the weighted sum of exponential quantiles:
  177. RealT guess = 0;
  178. if (comp)
  179. {
  180. for (std::size_t i = 0; i < n; ++i)
  181. {
  182. const exponential_distribution<RealT,PolicyT> exp(rates[i]);
  183. guess += probs[i]*quantile(complement(exp, p));
  184. }
  185. }
  186. else
  187. {
  188. for (std::size_t i = 0; i < n; ++i)
  189. {
  190. const exponential_distribution<RealT,PolicyT> exp(rates[i]);
  191. guess += probs[i]*quantile(exp, p);
  192. }
  193. }
  194. // Fast return in case the Hyper-Exponential is essentially an Exponential
  195. if (n == 1)
  196. {
  197. return guess;
  198. }
  199. value_type q;
  200. q = detail::generic_quantile(hyperexponential_distribution<RealT,forwarding_policy>(probs, rates),
  201. p,
  202. guess,
  203. comp,
  204. function);
  205. result = policies::checked_narrowing_cast<RealT,forwarding_policy>(q, function);
  206. return result;
  207. }
  208. }} // Namespace <unnamed>::hyperexp_detail
  209. template <typename RealT = double, typename PolicyT = policies::policy<> >
  210. class hyperexponential_distribution
  211. {
  212. public: typedef RealT value_type;
  213. public: typedef PolicyT policy_type;
  214. public: hyperexponential_distribution()
  215. : probs_(1, 1),
  216. rates_(1, 1)
  217. {
  218. RealT err;
  219. hyperexp_detail::check_dist("boost::math::hyperexponential_distribution<%1%>::hyperexponential_distribution",
  220. probs_,
  221. rates_,
  222. &err,
  223. PolicyT());
  224. }
  225. // Four arg constructor: no ambiguity here, the arguments must be two pairs of iterators:
  226. public: template <typename ProbIterT, typename RateIterT>
  227. hyperexponential_distribution(ProbIterT prob_first, ProbIterT prob_last,
  228. RateIterT rate_first, RateIterT rate_last)
  229. : probs_(prob_first, prob_last),
  230. rates_(rate_first, rate_last)
  231. {
  232. hyperexp_detail::normalize(probs_);
  233. RealT err;
  234. hyperexp_detail::check_dist("boost::math::hyperexponential_distribution<%1%>::hyperexponential_distribution",
  235. probs_,
  236. rates_,
  237. &err,
  238. PolicyT());
  239. }
  240. // Two arg constructor from 2 ranges, we SFINAE this out of existence if
  241. // either argument type is incrementable as in that case the type is
  242. // probably an iterator:
  243. public: template <typename ProbRangeT, typename RateRangeT>
  244. hyperexponential_distribution(ProbRangeT const& prob_range,
  245. RateRangeT const& rate_range,
  246. typename boost::disable_if_c<boost::has_pre_increment<ProbRangeT>::value || boost::has_pre_increment<RateRangeT>::value>::type* = 0)
  247. : probs_(boost::begin(prob_range), boost::end(prob_range)),
  248. rates_(boost::begin(rate_range), boost::end(rate_range))
  249. {
  250. hyperexp_detail::normalize(probs_);
  251. RealT err;
  252. hyperexp_detail::check_dist("boost::math::hyperexponential_distribution<%1%>::hyperexponential_distribution",
  253. probs_,
  254. rates_,
  255. &err,
  256. PolicyT());
  257. }
  258. // Two arg constructor for a pair of iterators: we SFINAE this out of
  259. // existence if neither argument types are incrementable.
  260. // Note that we allow different argument types here to allow for
  261. // construction from an array plus a pointer into that array.
  262. public: template <typename RateIterT, typename RateIterT2>
  263. hyperexponential_distribution(RateIterT const& rate_first,
  264. RateIterT2 const& rate_last,
  265. typename std::enable_if<boost::has_pre_increment<RateIterT>::value || boost::has_pre_increment<RateIterT2>::value>::type* = 0)
  266. : probs_(std::distance(rate_first, rate_last), 1), // will be normalized below
  267. rates_(rate_first, rate_last)
  268. {
  269. hyperexp_detail::normalize(probs_);
  270. RealT err;
  271. hyperexp_detail::check_dist("boost::math::hyperexponential_distribution<%1%>::hyperexponential_distribution",
  272. probs_,
  273. rates_,
  274. &err,
  275. PolicyT());
  276. }
  277. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  278. // Initializer list constructor: allows for construction from array literals:
  279. public: hyperexponential_distribution(std::initializer_list<RealT> l1, std::initializer_list<RealT> l2)
  280. : probs_(l1.begin(), l1.end()),
  281. rates_(l2.begin(), l2.end())
  282. {
  283. hyperexp_detail::normalize(probs_);
  284. RealT err;
  285. hyperexp_detail::check_dist("boost::math::hyperexponential_distribution<%1%>::hyperexponential_distribution",
  286. probs_,
  287. rates_,
  288. &err,
  289. PolicyT());
  290. }
  291. public: hyperexponential_distribution(std::initializer_list<RealT> l1)
  292. : probs_(l1.size(), 1),
  293. rates_(l1.begin(), l1.end())
  294. {
  295. hyperexp_detail::normalize(probs_);
  296. RealT err;
  297. hyperexp_detail::check_dist("boost::math::hyperexponential_distribution<%1%>::hyperexponential_distribution",
  298. probs_,
  299. rates_,
  300. &err,
  301. PolicyT());
  302. }
  303. #endif // !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  304. // Single argument constructor: argument must be a range.
  305. public: template <typename RateRangeT>
  306. hyperexponential_distribution(RateRangeT const& rate_range)
  307. : probs_(boost::size(rate_range), 1), // will be normalized below
  308. rates_(boost::begin(rate_range), boost::end(rate_range))
  309. {
  310. hyperexp_detail::normalize(probs_);
  311. RealT err;
  312. hyperexp_detail::check_dist("boost::math::hyperexponential_distribution<%1%>::hyperexponential_distribution",
  313. probs_,
  314. rates_,
  315. &err,
  316. PolicyT());
  317. }
  318. public: std::vector<RealT> probabilities() const
  319. {
  320. return probs_;
  321. }
  322. public: std::vector<RealT> rates() const
  323. {
  324. return rates_;
  325. }
  326. public: std::size_t num_phases() const
  327. {
  328. return rates_.size();
  329. }
  330. private: std::vector<RealT> probs_;
  331. private: std::vector<RealT> rates_;
  332. }; // class hyperexponential_distribution
  333. // Convenient type synonym for double.
  334. typedef hyperexponential_distribution<double> hyperexponential;
  335. // Range of permissible values for random variable x
  336. template <typename RealT, typename PolicyT>
  337. std::pair<RealT,RealT> range(hyperexponential_distribution<RealT,PolicyT> const&)
  338. {
  339. if (std::numeric_limits<RealT>::has_infinity)
  340. {
  341. return std::make_pair(static_cast<RealT>(0), std::numeric_limits<RealT>::infinity()); // 0 to +inf.
  342. }
  343. return std::make_pair(static_cast<RealT>(0), tools::max_value<RealT>()); // 0 to +<max value>
  344. }
  345. // Range of supported values for random variable x.
  346. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
  347. template <typename RealT, typename PolicyT>
  348. std::pair<RealT,RealT> support(hyperexponential_distribution<RealT,PolicyT> const&)
  349. {
  350. return std::make_pair(tools::min_value<RealT>(), tools::max_value<RealT>()); // <min value> to +<max value>.
  351. }
  352. template <typename RealT, typename PolicyT>
  353. RealT pdf(hyperexponential_distribution<RealT, PolicyT> const& dist, RealT const& x)
  354. {
  355. BOOST_MATH_STD_USING
  356. RealT result = 0;
  357. if (!hyperexp_detail::check_x("boost::math::pdf(const boost::math::hyperexponential_distribution<%1%>&, %1%)", x, &result, PolicyT()))
  358. {
  359. return result;
  360. }
  361. const std::size_t n = dist.num_phases();
  362. const std::vector<RealT> probs = dist.probabilities();
  363. const std::vector<RealT> rates = dist.rates();
  364. for (std::size_t i = 0; i < n; ++i)
  365. {
  366. const exponential_distribution<RealT,PolicyT> exp(rates[i]);
  367. result += probs[i]*pdf(exp, x);
  368. //result += probs[i]*rates[i]*exp(-rates[i]*x);
  369. }
  370. return result;
  371. }
  372. template <typename RealT, typename PolicyT>
  373. RealT cdf(hyperexponential_distribution<RealT, PolicyT> const& dist, RealT const& x)
  374. {
  375. RealT result = 0;
  376. if (!hyperexp_detail::check_x("boost::math::cdf(const boost::math::hyperexponential_distribution<%1%>&, %1%)", x, &result, PolicyT()))
  377. {
  378. return result;
  379. }
  380. const std::size_t n = dist.num_phases();
  381. const std::vector<RealT> probs = dist.probabilities();
  382. const std::vector<RealT> rates = dist.rates();
  383. for (std::size_t i = 0; i < n; ++i)
  384. {
  385. const exponential_distribution<RealT,PolicyT> exp(rates[i]);
  386. result += probs[i]*cdf(exp, x);
  387. }
  388. return result;
  389. }
  390. template <typename RealT, typename PolicyT>
  391. RealT quantile(hyperexponential_distribution<RealT, PolicyT> const& dist, RealT const& p)
  392. {
  393. return hyperexp_detail::quantile_impl(dist, p , false);
  394. }
  395. template <typename RealT, typename PolicyT>
  396. RealT cdf(complemented2_type<hyperexponential_distribution<RealT,PolicyT>, RealT> const& c)
  397. {
  398. RealT const& x = c.param;
  399. hyperexponential_distribution<RealT,PolicyT> const& dist = c.dist;
  400. RealT result = 0;
  401. if (!hyperexp_detail::check_x("boost::math::cdf(boost::math::complemented2_type<const boost::math::hyperexponential_distribution<%1%>&, %1%>)", x, &result, PolicyT()))
  402. {
  403. return result;
  404. }
  405. const std::size_t n = dist.num_phases();
  406. const std::vector<RealT> probs = dist.probabilities();
  407. const std::vector<RealT> rates = dist.rates();
  408. for (std::size_t i = 0; i < n; ++i)
  409. {
  410. const exponential_distribution<RealT,PolicyT> exp(rates[i]);
  411. result += probs[i]*cdf(complement(exp, x));
  412. }
  413. return result;
  414. }
  415. template <typename RealT, typename PolicyT>
  416. RealT quantile(complemented2_type<hyperexponential_distribution<RealT, PolicyT>, RealT> const& c)
  417. {
  418. RealT const& p = c.param;
  419. hyperexponential_distribution<RealT,PolicyT> const& dist = c.dist;
  420. return hyperexp_detail::quantile_impl(dist, p , true);
  421. }
  422. template <typename RealT, typename PolicyT>
  423. RealT mean(hyperexponential_distribution<RealT, PolicyT> const& dist)
  424. {
  425. RealT result = 0;
  426. const std::size_t n = dist.num_phases();
  427. const std::vector<RealT> probs = dist.probabilities();
  428. const std::vector<RealT> rates = dist.rates();
  429. for (std::size_t i = 0; i < n; ++i)
  430. {
  431. const exponential_distribution<RealT,PolicyT> exp(rates[i]);
  432. result += probs[i]*mean(exp);
  433. }
  434. return result;
  435. }
  436. template <typename RealT, typename PolicyT>
  437. RealT variance(hyperexponential_distribution<RealT, PolicyT> const& dist)
  438. {
  439. RealT result = 0;
  440. const std::size_t n = dist.num_phases();
  441. const std::vector<RealT> probs = dist.probabilities();
  442. const std::vector<RealT> rates = dist.rates();
  443. for (std::size_t i = 0; i < n; ++i)
  444. {
  445. result += probs[i]/(rates[i]*rates[i]);
  446. }
  447. const RealT mean = boost::math::mean(dist);
  448. result = 2*result-mean*mean;
  449. return result;
  450. }
  451. template <typename RealT, typename PolicyT>
  452. RealT skewness(hyperexponential_distribution<RealT,PolicyT> const& dist)
  453. {
  454. BOOST_MATH_STD_USING
  455. const std::size_t n = dist.num_phases();
  456. const std::vector<RealT> probs = dist.probabilities();
  457. const std::vector<RealT> rates = dist.rates();
  458. RealT s1 = 0; // \sum_{i=1}^n \frac{p_i}{\lambda_i}
  459. RealT s2 = 0; // \sum_{i=1}^n \frac{p_i}{\lambda_i^2}
  460. RealT s3 = 0; // \sum_{i=1}^n \frac{p_i}{\lambda_i^3}
  461. for (std::size_t i = 0; i < n; ++i)
  462. {
  463. const RealT p = probs[i];
  464. const RealT r = rates[i];
  465. const RealT r2 = r*r;
  466. const RealT r3 = r2*r;
  467. s1 += p/r;
  468. s2 += p/r2;
  469. s3 += p/r3;
  470. }
  471. const RealT s1s1 = s1*s1;
  472. const RealT num = (6*s3 - (3*(2*s2 - s1s1) + s1s1)*s1);
  473. const RealT den = (2*s2 - s1s1);
  474. return num / pow(den, static_cast<RealT>(1.5));
  475. }
  476. template <typename RealT, typename PolicyT>
  477. RealT kurtosis(hyperexponential_distribution<RealT,PolicyT> const& dist)
  478. {
  479. const std::size_t n = dist.num_phases();
  480. const std::vector<RealT> probs = dist.probabilities();
  481. const std::vector<RealT> rates = dist.rates();
  482. RealT s1 = 0; // \sum_{i=1}^n \frac{p_i}{\lambda_i}
  483. RealT s2 = 0; // \sum_{i=1}^n \frac{p_i}{\lambda_i^2}
  484. RealT s3 = 0; // \sum_{i=1}^n \frac{p_i}{\lambda_i^3}
  485. RealT s4 = 0; // \sum_{i=1}^n \frac{p_i}{\lambda_i^4}
  486. for (std::size_t i = 0; i < n; ++i)
  487. {
  488. const RealT p = probs[i];
  489. const RealT r = rates[i];
  490. const RealT r2 = r*r;
  491. const RealT r3 = r2*r;
  492. const RealT r4 = r3*r;
  493. s1 += p/r;
  494. s2 += p/r2;
  495. s3 += p/r3;
  496. s4 += p/r4;
  497. }
  498. const RealT s1s1 = s1*s1;
  499. const RealT num = (24*s4 - 24*s3*s1 + 3*(2*(2*s2 - s1s1) + s1s1)*s1s1);
  500. const RealT den = (2*s2 - s1s1);
  501. return num/(den*den);
  502. }
  503. template <typename RealT, typename PolicyT>
  504. RealT kurtosis_excess(hyperexponential_distribution<RealT,PolicyT> const& dist)
  505. {
  506. return kurtosis(dist) - 3;
  507. }
  508. template <typename RealT, typename PolicyT>
  509. RealT mode(hyperexponential_distribution<RealT,PolicyT> const& /*dist*/)
  510. {
  511. return 0;
  512. }
  513. }} // namespace boost::math
  514. #ifdef BOOST_MSVC
  515. #pragma warning (pop)
  516. #endif
  517. // This include must be at the end, *after* the accessors
  518. // for this distribution have been defined, in order to
  519. // keep compilers that support two-phase lookup happy.
  520. #include <boost/math/distributions/detail/derived_accessors.hpp>
  521. #include <boost/math/distributions/detail/generic_quantile.hpp>
  522. #endif // BOOST_MATH_DISTRIBUTIONS_HYPEREXPONENTIAL