yat  0.13.2pre
Averager4.h
1 #ifndef _theplu_yat_statistics_averager4
2 #define _theplu_yat_statistics_averager4
3 
4 // $Id: Averager4.h 2809 2012-08-06 13:44:47Z 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 Averager4 : public averager_base4<Averager4>
37  {
38  public:
42  Averager4(void);
43 
47  //const Averager& averager(void) const;
48 
96  template<class Derived>
97  const Averager4& operator+=(const averager_base4<Derived>& rhs);
98  private:
99  friend class averager_base<Averager4>;
100  // static virtual function in averager_base
101  void add_impl(double, long int n);
102  void rescale_impl(double);
103 
104  // using compiler generated copy and assignment
105  // Averager4(const Averager4&)
106  // Averager4& operator=(const Averager4& rhs);
107  };
108 
109  template<class Derived>
111  {
112  this->add4(rhs.mean(), rhs.sum_xx_centered(),
113  rhs.sum_x3_centered(), rhs.sum_x4_centered(), rhs.n());
114  return *this;
115  }
116 
117 }}} // of namespace statistics, yat, and theplu
118 #endif
Definition: averager_base.h:370
void add4(double mean, double cm2, double cm3, double cm4, long int n)
Base class for averager classes.
Definition: averager_base.h:69
double sum_x3_centered(void) const
Definition: averager_base.h:336
long n(void) const
number of data points
Definition: averager_base.h:105
const Averager4 & operator+=(const averager_base4< Derived > &rhs)
Third central moment.
Definition: Averager4.h:110
double sum_x4_centered(void) const
sum quadrupled centered
Definition: averager_base.h:411
double mean(void) const
mean
Definition: averager_base.h:97
double sum_xx_centered(void) const
Definition: averager_base.h:225
class to calculate 1st, 2nd, 3rd, and 4th central moments
Definition: Averager4.h:36
Averager4(void)
construct empty object

Generated on Wed Jan 4 2017 02:23:07 for yat by  doxygen 1.8.5