Boost C++ Libraries

...one 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.
PrevUpHomeNext

Class template mean

boost::histogram::accumulators::mean — Calculates mean and variance of sample.

Synopsis

// In header: <boost/histogram/accumulators/mean.hpp>

template<typename RealType> 
class mean {
public:
  // construct/copy/destruct
  mean() = default;
  mean(const RealType &, const RealType &, const RealType &) noexcept;

  // public member functions
  void operator()(const RealType &) noexcept;
  void operator()(const weight_type< RealType > &, const RealType &) noexcept;
  template<typename T> mean & operator+=(const mean< T > &) noexcept;
  mean & operator *=(const RealType &) noexcept;
  template<typename T> bool operator==(const mean< T > &) const noexcept;
  template<typename T> bool operator!=(const mean< T > &) const noexcept;
  const RealType & count() const noexcept;
  const RealType & value() const noexcept;
  RealType variance() const noexcept;
  template<typename Archive> void serialize(Archive &, unsigned);
};

Description

Uses Welfords's incremental algorithm to improve the numerical stability of mean and variance computation.

mean public construct/copy/destruct

  1. mean() = default;
  2. mean(const RealType & n, const RealType & mean, const RealType & variance) noexcept;

mean public member functions

  1. void operator()(const RealType & x) noexcept;
  2. void operator()(const weight_type< RealType > & w, const RealType & x) noexcept;
  3. template<typename T> mean & operator+=(const mean< T > & rhs) noexcept;
  4. mean & operator *=(const RealType & s) noexcept;
  5. template<typename T> bool operator==(const mean< T > & rhs) const noexcept;
  6. template<typename T> bool operator!=(const mean< T > & rhs) const noexcept;
  7. const RealType & count() const noexcept;
  8. const RealType & value() const noexcept;
  9. RealType variance() const noexcept;
  10. template<typename Archive> void serialize(Archive & ar, unsigned version);

PrevUpHomeNext