yat  0.12.3pre
Averager1.h
1 #ifndef _theplu_yat_statistics_averager1
2 #define _theplu_yat_statistics_averager1
3 
4 // $Id: Averager1.h 2810 2012-08-07 08:43:11Z peter $
5 
6 /*
7  Copyright (C) 2012 Peter Johansson
8 
9  This file is part of the yat library, http://dev.thep.lu.se/yat
10 
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15 
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with yat. If not, see <http://www.gnu.org/licenses/>.
23 */
24 
25 #include "averager_base.h"
26 
27 namespace theplu {
28 namespace yat {
29 namespace statistics {
30 
36  class Averager1 : public averager_base<Averager1>
37  {
38  public:
42  Averager1(void);
43 
47  template<class Derived>
48  const Averager1& operator+=(const averager_base<Derived>& rhs);
49  private:
50  friend class averager_base<Averager1>;
51  // static virtual function in averager_base
52  void add_impl(double, long int n);
53  void rescale_impl(double);
54 
55  // using compiler generated copy and assignment
56  // Averager1(const Averager1&)
57  // Averager1& operator=(const Averager1& rhs);
58  };
59 
60 
61  template<class Derived>
63  {
64  this->add1(rhs.mean(), rhs.n());
65  return *this;
66  }
67 
68 }}} // of namespace statistics, yat, and theplu
69 #endif
Base class for averager classes.
Definition: averager_base.h:69
const Averager1 & operator+=(const averager_base< Derived > &rhs)
plus and assign operator
Definition: Averager1.h:62
Averager1(void)
construct empty object
class to calculate mean
Definition: Averager1.h:36
long n(void) const
number of data points
Definition: averager_base.h:105
double mean(void) const
mean
Definition: averager_base.h:97

Generated on Mon Jun 1 2015 12:29:52 for yat by  doxygen 1.8.5