Opened 13 years ago
Closed 13 years ago
#3038 closed Bugs (wontfix)
[accumulators] Empty histogram
| Reported by: | Owned by: | Eric Niebler | |
|---|---|---|---|
| Milestone: | Boost 1.40.0 | Component: | accumulator |
| Version: | Boost 1.38.0 | Severity: | Problem |
| Keywords: | histogram density | Cc: |
Description
When the number of samples entered is lower than the cache_size parameter, histogram is not initialized. Example:
typedef iterator_range<std::vector<std::pair<double, double> >::iterator > histogram_type;
accumulator_set<double, features<tag::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);
// 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;
Change History (2)
comment:1 by , 13 years ago
| Component: | None → accumulator |
|---|---|
| Status: | new → assigned |
comment:2 by , 13 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.

According to Matthias Troyer:
Therefore, this is not a bug by by design. I have now documented the precondition on density result extraction, both in the code and in the users' guide (see changelist [53405]).