Opened 13 years ago

Closed 13 years ago

#3039 closed Bugs (duplicate)

[accumulators] Empty histogram

Reported by: Robert Kubrick <robertkubrick@…> 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 (1)

comment:1 by anonymous, 13 years ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.