1 #ifndef _theplu_yat_statistics_averagerweighted_
2 #define _theplu_yat_statistics_averagerweighted_
28 #include "yat/utility/concept_check.h"
29 #include "yat/utility/iterator_traits.h"
31 #include <boost/concept_check.hpp>
83 void add(
const double d,
const double w=1);
90 double mean(
void)
const;
103 double n(
void)
const;
123 double std(
void)
const;
143 double sum_w(
void)
const;
148 double sum_ww(
void)
const;
155 double sum_wx(
void)
const;
173 double variance(
const double m)
const;
197 double sum_wwx(
void)
const;
202 double sum_wwxx(
void)
const;
226 template <
typename InputIterator>
230 BOOST_CONCEPT_ASSERT((boost_concepts::SinglePassIterator<InputIterator>));
232 for ( ; first != last; ++first)
252 template <
typename InputIterator1,
typename InputIterator2>
254 InputIterator2 first2)
256 BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIterator<InputIterator1>));
257 BOOST_CONCEPT_ASSERT((boost_concepts::SinglePassIterator<InputIterator1>));
258 BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIterator<InputIterator2>));
259 BOOST_CONCEPT_ASSERT((boost_concepts::SinglePassIterator<InputIterator2>));
263 for ( ; first1 != last1; ++first1, ++first2)
264 a.
add(*first1, *first2);
double sum_ww(void) const
data_reference data(Iter iter) const
Definition: iterator_traits.h:440
Concept check for Data Iterator.
Definition: concept_check.h:228
double sum_xx_centered(void) const
Definition: iterator_traits.h:412
double mean(void) const
Calculate the weighted mean.
double standard_error(void) const
Calculates standard deviation of the mean().
void add(AveragerWeighted &a, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
add values from two ranges to AveragerWeighted a
Definition: AveragerWeighted.h:253
Class to calulate averages with weights.
Definition: AveragerWeighted.h:66
void add(const double d, const double w=1)
double std(void) const
The standard deviation is defined as the square root of the variance().
double sum_wx(void) const
double n(void) const
Weighted version of number of data points.
void check_iterator_is_unweighted(Iter iter)
check (at compile time) that iterator is unweighted.
Definition: iterator_traits.h:200
void reset(void)
Reset everything to zero.
const AveragerWeighted & operator+=(const AveragerWeighted &)
double sum_wxx(void) const
weight_reference weight(Iter iter) const
Definition: iterator_traits.h:446
double variance(void) const
AveragerWeighted(void)
The default constructor.
void add(AveragerWeighted &a, InputIterator first, InputIterator last)
adding a range of values to AveragerWeighted a
Definition: AveragerWeighted.h:227
void rescale(double a)
Rescale object.