I have the following program:
#include <iostream>
#include
#include
#include
using namespace boost;
using namespace boost::accumulators;
int main()
{
typedef iterator_range >::iterator > histogram_type;
accumulator_settag::density > acc(tag::density::num_bins = 20,
tag::density::cache_size = 10);
// push in some data ...
acc(0.1);
acc(1.2);
acc(2.3);
acc(3.4);
acc(4.5);
acc(5.4);
acc(5.5);
acc(5.5);
acc(10);
// Display the results ...
histogram_type hist = density(acc);
for( int i = 0; i < hist.size(); i++ )
std::cout << "Bin lower bound: " << hist[i].first << ", Value: " << hist[i].second << std::endl;
return 0;
}
Bin values and indexes don't seem to be initialized:
$ acc_dist
Bin lower bound: 0, Value: 0
Bin lower bound: 0, Value: 0
Bin lower bound: 0, Value: 0
Bin lower bound: 0, Value: 0
Bin lower bound: 0, Value: 0
Bin lower bound: 0, Value: 0
...