2799 |
28 Jul 12 |
peter |
// $Id$ |
2799 |
28 Jul 12 |
peter |
2 |
|
2799 |
28 Jul 12 |
peter |
3 |
/* |
2799 |
28 Jul 12 |
peter |
Copyright (C) 2012 Peter Johansson |
2799 |
28 Jul 12 |
peter |
5 |
|
2799 |
28 Jul 12 |
peter |
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 |
The yat library is free software; you can redistribute it and/or |
2799 |
28 Jul 12 |
peter |
modify it under the terms of the GNU General Public License as |
2799 |
28 Jul 12 |
peter |
published by the Free Software Foundation; either version 3 of the |
2799 |
28 Jul 12 |
peter |
License, or (at your option) any later version. |
2799 |
28 Jul 12 |
peter |
12 |
|
2799 |
28 Jul 12 |
peter |
The yat library is distributed in the hope that it will be useful, |
2799 |
28 Jul 12 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2799 |
28 Jul 12 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2799 |
28 Jul 12 |
peter |
General Public License for more details. |
2799 |
28 Jul 12 |
peter |
17 |
|
2799 |
28 Jul 12 |
peter |
You should have received a copy of the GNU General Public License |
2799 |
28 Jul 12 |
peter |
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 |