Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Struct template weighted_density_impl

boost::accumulators::impl::weighted_density_impl — Histogram density estimator for weighted samples.


// In header: <boost/accumulators/statistics_fwd.hpp>

template<typename Sample, typename Weight> 
struct weighted_density_impl : public accumulator_base {
  // construct/copy/destruct
  template<typename Args> weighted_density_impl(Args const &);

  // public member functions
  template<typename Args> void operator()(Args const &);
  template<typename Args> result_type result(Args const &) const;
  template<typename Archive> void serialize(Archive &, const unsigned int);


The histogram density estimator returns a histogram of the sample distribution. The positions and sizes of the bins are determined using a specifiable number of cached samples (cache_size). The range between the minimum and the maximum of the cached samples is subdivided into a specifiable number of bins (num_bins) of same size. Additionally, an under- and an overflow bin is added to capture future under- and overflow samples. Once the bins are determined, the cached samples and all subsequent samples are added to the correct bins. At the end, a range of std::pair is returned, where each pair contains the position of the bin (lower bound) and the sum of the weights (normalized with the sum of all weights).

weighted_density_impl public construct/copy/destruct

  1. template<typename Args> weighted_density_impl(Args const & args);

weighted_density_impl public member functions

  1. template<typename Args> void operator()(Args const & args);
  2. template<typename Args> result_type result(Args const & args) const;
  3. template<typename Archive> 
      void serialize(Archive & ar, const unsigned int file_version);