yat/statistics/Averager4.cc

Code
Comments
Other
Rev Date Author Line
2799 28 Jul 12 peter 1 // $Id$
2799 28 Jul 12 peter 2
2799 28 Jul 12 peter 3 /*
2799 28 Jul 12 peter 4   Copyright (C) 2012 Peter Johansson
2799 28 Jul 12 peter 5
2799 28 Jul 12 peter 6   This file is part of the yat library, http://dev.thep.lu.se/yat
2799 28 Jul 12 peter 7
2799 28 Jul 12 peter 8   The yat library is free software; you can redistribute it and/or
2799 28 Jul 12 peter 9   modify it under the terms of the GNU General Public License as
2799 28 Jul 12 peter 10   published by the Free Software Foundation; either version 3 of the
2799 28 Jul 12 peter 11   License, or (at your option) any later version.
2799 28 Jul 12 peter 12
2799 28 Jul 12 peter 13   The yat library is distributed in the hope that it will be useful,
2799 28 Jul 12 peter 14   but WITHOUT ANY WARRANTY; without even the implied warranty of
2799 28 Jul 12 peter 15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2799 28 Jul 12 peter 16   General Public License for more details.
2799 28 Jul 12 peter 17
2799 28 Jul 12 peter 18   You should have received a copy of the GNU General Public License
2799 28 Jul 12 peter 19   along with yat. If not, see <http://www.gnu.org/licenses/>.
2799 28 Jul 12 peter 20 */
2799 28 Jul 12 peter 21
2881 18 Nov 12 peter 22 #include <config.h>
2881 18 Nov 12 peter 23
2799 28 Jul 12 peter 24 #include "Averager4.h"
2799 28 Jul 12 peter 25
2799 28 Jul 12 peter 26 #include <cassert>
2799 28 Jul 12 peter 27 #include <cmath>
2799 28 Jul 12 peter 28
2799 28 Jul 12 peter 29 namespace theplu {
2799 28 Jul 12 peter 30 namespace yat {
2799 28 Jul 12 peter 31 namespace statistics {
2799 28 Jul 12 peter 32
2799 28 Jul 12 peter 33   Averager4::Averager4(void)
2809 06 Aug 12 peter 34     : averager_base4<Averager4>() {}
2799 28 Jul 12 peter 35
2799 28 Jul 12 peter 36
2809 06 Aug 12 peter 37   void Averager4::rescale_impl(double x)
2799 28 Jul 12 peter 38   {
2809 06 Aug 12 peter 39     this->rescale4(x);
2799 28 Jul 12 peter 40   }
2799 28 Jul 12 peter 41
2799 28 Jul 12 peter 42
2809 06 Aug 12 peter 43   void Averager4::add_impl(double x, long int n)
2799 28 Jul 12 peter 44   {
2809 06 Aug 12 peter 45     if (n==1)
2809 06 Aug 12 peter 46       add4(x - this->mean_);
2809 06 Aug 12 peter 47     else
2809 06 Aug 12 peter 48       add4(x, 0, 0, 0, n);
2809 06 Aug 12 peter 49     assert(this->n_>=0);
2799 28 Jul 12 peter 50   }
2799 28 Jul 12 peter 51
2799 28 Jul 12 peter 52 }}} // of namespace statistics, yat, and theplu