statistics_fwd.hpp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // statistics_fwd.hpp
  3. //
  4. // Copyright 2005 Eric Niebler. Distributed under the Boost
  5. // Software License, Version 1.0. (See accompanying file
  6. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. #ifndef BOOST_ACCUMULATORS_STATISTICS_STATISTICS_FWD_HPP_EAN_23_11_2005
  8. #define BOOST_ACCUMULATORS_STATISTICS_STATISTICS_FWD_HPP_EAN_23_11_2005
  9. #include <boost/mpl/apply_fwd.hpp> // for mpl::na
  10. #include <boost/mpl/print.hpp>
  11. #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
  12. #include <boost/accumulators/accumulators_fwd.hpp>
  13. #include <boost/accumulators/framework/depends_on.hpp>
  14. #include <boost/accumulators/framework/extractor.hpp>
  15. namespace boost { namespace accumulators
  16. {
  17. ///////////////////////////////////////////////////////////////////////////////
  18. // base struct and base extractor for quantiles
  19. namespace tag
  20. {
  21. struct quantile
  22. : depends_on<>
  23. {
  24. typedef mpl::print<class ____MISSING_SPECIFIC_QUANTILE_FEATURE_IN_ACCUMULATOR_SET____ > impl;
  25. };
  26. }
  27. namespace extract
  28. {
  29. extractor<tag::quantile> const quantile = {};
  30. BOOST_ACCUMULATORS_IGNORE_GLOBAL(quantile)
  31. }
  32. using extract::quantile;
  33. ///////////////////////////////////////////////////////////////////////////////
  34. // base struct and base extractor for *coherent* tail means
  35. namespace tag
  36. {
  37. struct tail_mean
  38. : depends_on<>
  39. {
  40. typedef mpl::print<class ____MISSING_SPECIFIC_TAIL_MEAN_FEATURE_IN_ACCUMULATOR_SET____ > impl;
  41. };
  42. }
  43. namespace extract
  44. {
  45. extractor<tag::tail_mean> const tail_mean = {};
  46. BOOST_ACCUMULATORS_IGNORE_GLOBAL(tail_mean)
  47. }
  48. using extract::tail_mean;
  49. namespace tag
  50. {
  51. ///////////////////////////////////////////////////////////////////////////////
  52. // Variates tags
  53. struct weights;
  54. struct covariate1;
  55. struct covariate2;
  56. ///////////////////////////////////////////////////////////////////////////////
  57. // Statistic tags
  58. struct count;
  59. template<typename VariateType, typename VariateTag>
  60. struct covariance;
  61. struct density;
  62. template<typename Feature>
  63. struct error_of;
  64. struct extended_p_square;
  65. struct extended_p_square_quantile;
  66. struct extended_p_square_quantile_quadratic;
  67. struct kurtosis;
  68. struct max;
  69. struct mean;
  70. struct immediate_mean;
  71. struct mean_of_weights;
  72. struct immediate_mean_of_weights;
  73. template<typename VariateType, typename VariateTag>
  74. struct mean_of_variates;
  75. template<typename VariateType, typename VariateTag>
  76. struct immediate_mean_of_variates;
  77. struct median;
  78. struct with_density_median;
  79. struct with_p_square_cumulative_distribution_median;
  80. struct min;
  81. template<int N>
  82. struct moment;
  83. template<typename LeftRight>
  84. struct peaks_over_threshold;
  85. template<typename LeftRight>
  86. struct peaks_over_threshold_prob;
  87. template<typename LeftRight>
  88. struct pot_tail_mean;
  89. template<typename LeftRight>
  90. struct pot_tail_mean_prob;
  91. template<typename LeftRight>
  92. struct pot_quantile;
  93. template<typename LeftRight>
  94. struct pot_quantile_prob;
  95. struct p_square_cumulative_distribution;
  96. struct p_square_quantile;
  97. struct p_square_quantile_for_median;
  98. struct skewness;
  99. struct sum;
  100. struct sum_of_weights;
  101. template<typename VariateType, typename VariateTag>
  102. struct sum_of_variates;
  103. struct sum_kahan;
  104. struct sum_of_weights_kahan;
  105. template<typename VariateType, typename VariateTag>
  106. struct sum_of_variates_kahan;
  107. template<typename LeftRight>
  108. struct tail;
  109. template<typename LeftRight>
  110. struct coherent_tail_mean;
  111. template<typename LeftRight>
  112. struct non_coherent_tail_mean;
  113. template<typename LeftRight>
  114. struct tail_quantile;
  115. template<typename VariateType, typename VariateTag, typename LeftRight>
  116. struct tail_variate;
  117. template<typename LeftRight>
  118. struct tail_weights;
  119. template<typename VariateType, typename VariateTag, typename LeftRight>
  120. struct right_tail_variate;
  121. template<typename VariateType, typename VariateTag, typename LeftRight>
  122. struct left_tail_variate;
  123. template<typename LeftRight, typename VariateType, typename VariateTag>
  124. struct tail_variate_means;
  125. template<typename LeftRight, typename VariateType, typename VariateTag>
  126. struct absolute_tail_variate_means;
  127. template<typename LeftRight, typename VariateType, typename VariateTag>
  128. struct relative_tail_variate_means;
  129. struct lazy_variance;
  130. struct variance;
  131. template<typename VariateType, typename VariateTag>
  132. struct weighted_covariance;
  133. struct weighted_density;
  134. struct weighted_kurtosis;
  135. struct weighted_mean;
  136. struct immediate_weighted_mean;
  137. template<typename VariateType, typename VariateTag>
  138. struct weighted_mean_of_variates;
  139. template<typename VariateType, typename VariateTag>
  140. struct immediate_weighted_mean_of_variates;
  141. struct weighted_median;
  142. struct with_density_weighted_median;
  143. struct with_p_square_cumulative_distribution_weighted_median;
  144. struct weighted_extended_p_square;
  145. struct weighted_extended_p_square_quantile;
  146. struct weighted_extended_p_square_quantile_quadratic;
  147. template<int N>
  148. struct weighted_moment;
  149. template<typename LeftRight>
  150. struct weighted_peaks_over_threshold;
  151. template<typename LeftRight>
  152. struct weighted_peaks_over_threshold_prob;
  153. template<typename LeftRight>
  154. struct weighted_pot_quantile;
  155. template<typename LeftRight>
  156. struct weighted_pot_quantile_prob;
  157. template<typename LeftRight>
  158. struct weighted_pot_tail_mean;
  159. template<typename LeftRight>
  160. struct weighted_pot_tail_mean_prob;
  161. struct weighted_p_square_cumulative_distribution;
  162. struct weighted_p_square_quantile;
  163. struct weighted_p_square_quantile_for_median;
  164. struct weighted_skewness;
  165. template<typename LeftRight>
  166. struct weighted_tail_quantile;
  167. template<typename LeftRight>
  168. struct non_coherent_weighted_tail_mean;
  169. template<typename LeftRight>
  170. struct weighted_tail_quantile;
  171. template<typename LeftRight, typename VariateType, typename VariateTag>
  172. struct weighted_tail_variate_means;
  173. template<typename LeftRight, typename VariateType, typename VariateTag>
  174. struct absolute_weighted_tail_variate_means;
  175. template<typename LeftRight, typename VariateType, typename VariateTag>
  176. struct relative_weighted_tail_variate_means;
  177. struct lazy_weighted_variance;
  178. struct weighted_variance;
  179. struct weighted_sum;
  180. template<typename VariateType, typename VariateTag>
  181. struct weighted_sum_of_variates;
  182. struct rolling_window_plus1;
  183. struct rolling_window;
  184. struct rolling_sum;
  185. struct rolling_count;
  186. struct rolling_mean;
  187. } // namespace tag
  188. namespace impl
  189. {
  190. ///////////////////////////////////////////////////////////////////////////////
  191. // Statistics impls
  192. struct count_impl;
  193. template<typename Sample, typename VariateType, typename VariateTag>
  194. struct covariance_impl;
  195. template<typename Sample>
  196. struct density_impl;
  197. template<typename Sample, typename Feature>
  198. struct error_of_impl;
  199. template<typename Sample, typename Variance>
  200. struct error_of_mean_impl;
  201. template<typename Sample>
  202. struct extended_p_square_impl;
  203. template<typename Sample, typename Impl1, typename Impl2>
  204. struct extended_p_square_quantile_impl;
  205. template<typename Sample>
  206. struct kurtosis_impl;
  207. template<typename Sample>
  208. struct max_impl;
  209. template<typename Sample>
  210. struct median_impl;
  211. template<typename Sample>
  212. struct with_density_median_impl;
  213. template<typename Sample>
  214. struct with_p_square_cumulative_distribution_median_impl;
  215. template<typename Sample>
  216. struct min_impl;
  217. template<typename Sample, typename SumFeature = tag::sum>
  218. struct mean_impl;
  219. template<typename Sample, typename Tag = tag::sample>
  220. struct immediate_mean_impl;
  221. template<typename N, typename Sample>
  222. struct moment_impl;
  223. template<typename Sample, typename LeftRight>
  224. struct peaks_over_threshold_prob_impl;
  225. template<typename Sample, typename Impl, typename LeftRight>
  226. struct pot_quantile_impl;
  227. template<typename Sample, typename Impl, typename LeftRight>
  228. struct pot_tail_mean_impl;
  229. template<typename Sample>
  230. struct p_square_cumulative_distribution_impl;
  231. template<typename Sample, typename Impl>
  232. struct p_square_quantile_impl;
  233. template<typename Sample>
  234. struct skewness_impl;
  235. template<typename Sample, typename Tag = tag::sample>
  236. struct sum_impl;
  237. template<typename Sample, typename Tag>
  238. struct sum_kahan_impl;
  239. template<typename Sample, typename LeftRight>
  240. struct tail_impl;
  241. template<typename Sample, typename LeftRight>
  242. struct coherent_tail_mean_impl;
  243. template<typename Sample, typename LeftRight>
  244. struct non_coherent_tail_mean_impl;
  245. template<typename Sample, typename LeftRight>
  246. struct tail_quantile_impl;
  247. template<typename VariateType, typename VariateTag, typename LeftRight>
  248. struct tail_variate_impl;
  249. template<typename Sample, typename Impl, typename LeftRight, typename VariateTag>
  250. struct tail_variate_means_impl;
  251. template<typename Sample, typename MeanFeature>
  252. struct lazy_variance_impl;
  253. template<typename Sample, typename MeanFeature, typename Tag>
  254. struct variance_impl;
  255. template<typename Sample, typename Weight, typename VariateType, typename VariateTag>
  256. struct weighted_covariance_impl;
  257. template<typename Sample, typename Weight>
  258. struct weighted_density_impl;
  259. template<typename Sample, typename Weight>
  260. struct weighted_kurtosis_impl;
  261. template<typename Sample>
  262. struct weighted_median_impl;
  263. template<typename Sample>
  264. struct with_density_weighted_median_impl;
  265. template<typename Sample, typename Weight>
  266. struct with_p_square_cumulative_distribution_weighted_median_impl;
  267. template<typename Sample, typename Weight, typename Tag>
  268. struct weighted_mean_impl;
  269. template<typename Sample, typename Weight, typename Tag>
  270. struct immediate_weighted_mean_impl;
  271. template<typename Sample, typename Weight, typename LeftRight>
  272. struct weighted_peaks_over_threshold_impl;
  273. template<typename Sample, typename Weight, typename LeftRight>
  274. struct weighted_peaks_over_threshold_prob_impl;
  275. template<typename Sample, typename Weight>
  276. struct with_p_square_cumulative_distribution_weighted_median_impl;
  277. template<typename Sample, typename Weight>
  278. struct weighted_extended_p_square_impl;
  279. template<typename N, typename Sample, typename Weight>
  280. struct weighted_moment_impl;
  281. template<typename Sample, typename Weight>
  282. struct weighted_p_square_cumulative_distribution_impl;
  283. template<typename Sample, typename Weight, typename Impl>
  284. struct weighted_p_square_quantile_impl;
  285. template<typename Sample, typename Weight>
  286. struct weighted_skewness_impl;
  287. template<typename Sample, typename Weight, typename Tag>
  288. struct weighted_sum_impl;
  289. template<typename Sample, typename Weight, typename Tag>
  290. struct weighted_sum_kahan_impl;
  291. template<typename Sample, typename Weight, typename LeftRight>
  292. struct non_coherent_weighted_tail_mean_impl;
  293. template<typename Sample, typename Weight, typename LeftRight>
  294. struct weighted_tail_quantile_impl;
  295. template<typename Sample, typename Weight, typename Impl, typename LeftRight, typename VariateType>
  296. struct weighted_tail_variate_means_impl;
  297. template<typename Sample, typename Weight, typename MeanFeature>
  298. struct lazy_weighted_variance_impl;
  299. template<typename Sample, typename Weight, typename MeanFeature, typename Tag>
  300. struct weighted_variance_impl;
  301. template<typename Sample>
  302. struct rolling_window_plus1_impl;
  303. template<typename Sample>
  304. struct rolling_window_impl;
  305. template<typename Sample>
  306. struct rolling_sum_impl;
  307. template<typename Sample>
  308. struct rolling_count_impl;
  309. template<typename Sample>
  310. struct rolling_mean_impl;
  311. } // namespace impl
  312. ///////////////////////////////////////////////////////////////////////////////
  313. // stats
  314. // A more descriptive name for an MPL sequence of statistics.
  315. template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature, mpl::na)>
  316. struct stats;
  317. template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature, mpl::na)>
  318. struct with_error;
  319. // modifiers for the mean and variance stats
  320. struct lazy {};
  321. struct immediate {};
  322. // modifiers for the variance stat
  323. // struct fast {};
  324. // struct accurate {};
  325. // modifiers for order
  326. struct right {};
  327. struct left {};
  328. // typedef right default_order_tag_type;
  329. // modifiers for the tail_variate_means stat
  330. struct absolute {};
  331. struct relative {};
  332. // modifiers for median and weighted_median stats
  333. struct with_density {};
  334. struct with_p_square_cumulative_distribution {};
  335. struct with_p_square_quantile {};
  336. // modifiers for peaks_over_threshold stat
  337. struct with_threshold_value {};
  338. struct with_threshold_probability {};
  339. // modifiers for extended_p_square_quantile and weighted_extended_p_square_quantile stats
  340. struct weighted {};
  341. struct unweighted {};
  342. struct linear {};
  343. struct quadratic {};
  344. // modifiers for p_square_quantile
  345. struct regular {};
  346. struct for_median {};
  347. // modifier for sum_kahan, sum_of_weights_kahan, sum_of_variates_kahan, weighted_sum_kahan
  348. struct kahan {};
  349. }} // namespace boost::accumulators
  350. #endif