25 #ifndef ALEXANDRIA_HISTOGRAM_BINNING_SCOTT_H
26 #define ALEXANDRIA_HISTOGRAM_BINNING_SCOTT_H
29 #include <boost/accumulators/accumulators.hpp>
30 #include <boost/accumulators/statistics/max.hpp>
31 #include <boost/accumulators/statistics/min.hpp>
32 #include <boost/accumulators/statistics/stats.hpp>
33 #include <boost/accumulators/statistics/variance.hpp>
53 template <
typename VarType>
56 template <
typename Iterator>
58 using namespace boost::accumulators;
60 accumulator_set<VarType, stats<tag::variance, tag::max, tag::min>> acc;
63 size_t n = end - begin;
66 VarType h = 3.5 * sigma /
std::pow(n, 1. / 3.);
67 VarType vmin = min(acc);
68 VarType vmax = max(acc);
76 VarType range = vmax - vmin;
108 #endif // ALEXANDRIA_HISTOGRAM_BINNING_SCOTT_H