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 std::size_t, const RealType &, const RealType &);

  // public member functions
  void operator()(const RealType &);
  template<typename T> mean & operator+=(const mean< T > &);
  mean & operator *=(const RealType &);
  template<typename T> bool operator==(const mean< T > &) const noexcept;
  template<typename T> bool operator!=(const mean< T > &) const noexcept;
  std::size_t count() const noexcept;
  const RealType & value() const noexcept;
  RealType variance() const;
  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 std::size_t n, const RealType & mean, const RealType & variance);

mean public member functions

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

PrevUpHomeNext