source: trunk/yat/statistics/Averager1.h @ 2810

Last change on this file since 2810 was 2810, checked in by Peter, 9 years ago

add missing files in r2809. refs #705

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
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
27namespace theplu {
28namespace yat {
29namespace statistics {
30
31  /**
32     \brief class to calculate mean
33
34     \since yat 0.9
35   */
36  class Averager1 : public averager_base<Averager1>
37  {
38  public:
39    /**
40       \brief construct empty object
41     */
42    Averager1(void);
43
44    /**
45       \brief plus and assign operator
46     */
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>
62  const Averager1& Averager1::operator+=(const averager_base<Derived>& rhs)
63  {
64    this->add1(rhs.mean(), rhs.n());
65    return *this;
66  }
67
68}}} // of namespace statistics, yat, and theplu
69#endif
Note: See TracBrowser for help on using the repository browser.