25 #ifndef ALEXANDRIA_HISTOGRAM_BINNING_SCOTT_H
26 #define ALEXANDRIA_HISTOGRAM_BINNING_SCOTT_H
31 #include <boost/accumulators/accumulators.hpp>
32 #include <boost/accumulators/statistics/stats.hpp>
33 #include <boost/accumulators/statistics/max.hpp>
34 #include <boost/accumulators/statistics/min.hpp>
35 #include <boost/accumulators/statistics/variance.hpp>
53 template<
typename VarType>
57 template<
typename Iterator>
59 using namespace boost::accumulators;
61 accumulator_set<VarType, stats<tag::variance, tag::max, tag::min>> acc;
64 size_t n = end - begin;
67 VarType h = 3.5 * sigma /
std::pow(n, 1. / 3.);
68 VarType vmin = min(acc);
69 VarType vmax = max(acc);
77 VarType range = vmax - vmin;
109 #endif // ALEXANDRIA_HISTOGRAM_BINNING_SCOTT_H