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> 78 void add(
const double d,
const double w=1);
85 double mean(
void)
const;
118 double std(
void)
const;
138 double sum_w(
void)
const;
143 double sum_ww(
void)
const;
150 double sum_wx(
void)
const;
168 double variance(
const double m)
const;
192 double sum_wwx(
void)
const;
197 double sum_wwxx(
void)
const;
221 template <
typename InputIterator>
225 BOOST_CONCEPT_ASSERT((boost_concepts::SinglePassIterator<InputIterator>));
227 for ( ; first != last; ++first)
247 template <
typename InputIterator1,
typename InputIterator2>
249 InputIterator2 first2)
251 BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIterator<InputIterator1>));
252 BOOST_CONCEPT_ASSERT((boost_concepts::SinglePassIterator<InputIterator1>));
253 BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIterator<InputIterator2>));
254 BOOST_CONCEPT_ASSERT((boost_concepts::SinglePassIterator<InputIterator2>));
258 for ( ; first1 != last1; ++first1, ++first2)
259 a.
add(*first1, *first2);
double n(void) const
Weighted version of number of data points.
Concept check for Data Iterator.
Definition: concept_check.h:240
data_reference data(Iter iter) const
Definition: iterator_traits.h:440
Definition: iterator_traits.h:412
The Department of Theoretical Physics namespace as we define it.
void add(AveragerWeighted &a, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
add values from two ranges to AveragerWeighted a
Definition: AveragerWeighted.h:248
double sum_ww(void) const
Class to calulate averages with weights.
Definition: AveragerWeighted.h:66
double standard_error(void) const
Calculates standard deviation of the mean().
void add(const double d, const double w=1)
double sum_wxx(void) const
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 variance(void) const
double std(void) const
The standard deviation is defined as the square root of the variance().
double sum_xx_centered(void) const
weight_reference weight(Iter iter) const
Definition: iterator_traits.h:446
double sum_wx(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:222
double mean(void) const
Calculate the weighted mean.
void rescale(double a)
Rescale object.