yat  0.12.3pre
Averager3.h
1 #ifndef _theplu_yat_statistics_averager3
2 #define _theplu_yat_statistics_averager3
3 
4 // $Id: Averager3.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 Averager3 : public averager_base3<Averager3>
37  {
38  public:
42  Averager3(void);
43 
47  template<class Derived>
48  const Averager3& operator+=(const averager_base3<Derived>& rhs);
49  private:
50  friend class averager_base<Averager3>;
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  // Averager4(const Averager4&)
57  // Averager4& operator=(const Averager4& rhs);
58  };
59 
60  template<class Derived>
62  {
63  this->add3(rhs.mean(), rhs.sum_xx_centered(), rhs.sum_x3_centered(),
64  rhs.n());
65  return *this;
66  }
67 
68 }}} // of namespace statistics, yat, and theplu
69 #endif
const Averager3 & operator+=(const averager_base3< Derived > &rhs)
plus and assign operator
Definition: Averager3.h:61
Definition: averager_base.h:296
Base class for averager classes.
Definition: averager_base.h:69
Averager3(void)
construct empty object
double sum_x3_centered(void) const
Definition: averager_base.h:336
long n(void) const
number of data points
Definition: averager_base.h:105
class to calculate 1st, 2nd, and 3rd central moments
Definition: Averager3.h:36
double mean(void) const
mean
Definition: averager_base.h:97
double sum_xx_centered(void) const
Definition: averager_base.h:225
void add3(double mean, double cm2, double cm3, long int n)

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