CARMA C++
SimpleStatisticsAccumulators.h
1 #ifndef CARMA_UTIL_SIMPLESTATISTICSACCUMULATORS_H
2 #define CARMA_UTIL_SIMPLESTATISTICSACCUMULATORS_H
3 
4 #include <boost/accumulators/numeric/functional/complex.hpp>
5 #include <boost/accumulators/accumulators.hpp>
6 #include <boost/accumulators/statistics/count.hpp>
7 #include <boost/accumulators/statistics/max.hpp>
8 #include <boost/accumulators/statistics/mean.hpp>
9 #include <boost/accumulators/statistics/min.hpp>
10 #include <boost/accumulators/statistics/rolling_count.hpp>
11 #include <boost/accumulators/statistics/rolling_sum.hpp>
12 #include <boost/accumulators/statistics/rolling_mean.hpp>
13 #include <boost/accumulators/statistics/stats.hpp>
14 #include <boost/accumulators/statistics/error_of.hpp>
15 #include <boost/accumulators/statistics/error_of_mean.hpp>
16 #include <complex>
17 
18 namespace carma {
19 namespace util {
20 
21 
22 // See http://boost-sandbox.sourceforge.net/libs/accumulators/doc/html/accumulators/user_s_guide.html#accumulators.user_s_guide.the_accumulators_framework.using___accumulator_set___
23 // for examples of how to use these. They are very useful and convenient.
24 
25 typedef boost::accumulators::stats<
26  boost::accumulators::tag::count,
27  boost::accumulators::tag::max,
28  boost::accumulators::tag::min,
29  boost::accumulators::tag::mean,
30  boost::accumulators::tag::error_of<
31  boost::accumulators::tag::mean> > SimpleStats;
32 
33 typedef boost::accumulators::stats<
34  boost::accumulators::tag::rolling_count,
35  boost::accumulators::tag::rolling_sum,
36  boost::accumulators::tag::rolling_mean > RollingStats;
37 
38 typedef
39 boost::accumulators::accumulator_set< double, SimpleStats >
40 DoubleStatAccumulator;
41 
42 typedef
43 boost::accumulators::accumulator_set< double, RollingStats >
44 DoubleRollingStatAccumulator;
45 
46 typedef
47 boost::accumulators::accumulator_set< float, SimpleStats >
48 FloatStatAccumulator;
49 
50 typedef
51 boost::accumulators::accumulator_set< float, RollingStats >
52 FloatRollingStatAccumulator;
53 
54 typedef
55 boost::accumulators::accumulator_set< short, SimpleStats >
56 ShortStatAccumulator;
57 
58 typedef
59 boost::accumulators::accumulator_set< short, RollingStats >
60 ShortRollingStatAccumulator;
61 
62 typedef
63 boost::accumulators::accumulator_set< int, SimpleStats >
64 IntStatAccumulator;
65 
66 typedef
67 boost::accumulators::accumulator_set< int, RollingStats >
68 IntRollingStatAccumulator;
69 
70 typedef
71 boost::accumulators::accumulator_set< long, SimpleStats >
72 LongStatAccumulator;
73 
74 typedef
75 boost::accumulators::accumulator_set< long, RollingStats >
76 LongRollingStatAccumulator;
77 
78 typedef
79 boost::accumulators::accumulator_set< unsigned short, SimpleStats >
80 UnsignedShortStatAccumulator;
81 
82 typedef
83 boost::accumulators::accumulator_set< unsigned short, RollingStats >
84 UnsignedShortRollingStatAccumulator;
85 
86 typedef
87 boost::accumulators::accumulator_set< unsigned int, SimpleStats >
88 UnsignedIntStatAccumulator;
89 
90 typedef
91 boost::accumulators::accumulator_set< unsigned int, RollingStats >
92 UnsignedIntRollingStatAccumulator;
93 
94 typedef
95 boost::accumulators::accumulator_set< unsigned long, SimpleStats >
96 UnsignedLongStatAccumulator;
97 
98 typedef
99 boost::accumulators::accumulator_set< unsigned long, RollingStats >
100 UnsignedLongRollingStatAccumulator;
101 
102 typedef
103 boost::accumulators::accumulator_set< std::complex<double>, SimpleStats >
104 ComplexDoubleStatAccumulator;
105 
106 typedef
107 boost::accumulators::accumulator_set< std::complex< double >, RollingStats >
108 ComplexDoubleRollingStatAccumulator;
109 
110 typedef
111 boost::accumulators::accumulator_set< std::complex<float>, SimpleStats >
112 ComplexFloatStatAccumulator;
113 
114 typedef
115 boost::accumulators::accumulator_set< std::complex< float >, RollingStats >
116 ComplexFloatRollingStatAccumulator;
117 
118 }} // namespace carma::util
119 #endif