1497 |
12 Sep 08 |
peter |
1 |
#ifndef _theplu_yat_normalizer_centralizer_ |
1497 |
12 Sep 08 |
peter |
2 |
#define _theplu_yat_normalizer_centralizer_ |
1445 |
27 Aug 08 |
peter |
3 |
|
1576 |
14 Oct 08 |
jari |
// $Id$ |
1576 |
14 Oct 08 |
jari |
5 |
|
1445 |
27 Aug 08 |
peter |
6 |
/* |
2119 |
12 Dec 09 |
peter |
Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
3999 |
08 Oct 20 |
peter |
Copyright (C) 2009, 2010, 2011, 2014, 2016, 2020 Peter Johansson |
1445 |
27 Aug 08 |
peter |
9 |
|
1445 |
27 Aug 08 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
1445 |
27 Aug 08 |
peter |
11 |
|
1445 |
27 Aug 08 |
peter |
The yat library is free software; you can redistribute it and/or |
1445 |
27 Aug 08 |
peter |
modify it under the terms of the GNU General Public License as |
1486 |
09 Sep 08 |
jari |
published by the Free Software Foundation; either version 3 of the |
1445 |
27 Aug 08 |
peter |
License, or (at your option) any later version. |
1445 |
27 Aug 08 |
peter |
16 |
|
1445 |
27 Aug 08 |
peter |
The yat library is distributed in the hope that it will be useful, |
1445 |
27 Aug 08 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1445 |
27 Aug 08 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1445 |
27 Aug 08 |
peter |
General Public License for more details. |
1445 |
27 Aug 08 |
peter |
21 |
|
1445 |
27 Aug 08 |
peter |
You should have received a copy of the GNU General Public License |
1487 |
10 Sep 08 |
jari |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
1445 |
27 Aug 08 |
peter |
24 |
*/ |
1445 |
27 Aug 08 |
peter |
25 |
|
3953 |
22 Jul 20 |
peter |
26 |
#include "RangeNormalizer.h" |
2283 |
26 Jun 10 |
peter |
27 |
|
1445 |
27 Aug 08 |
peter |
28 |
#include "yat/statistics/Average.h" |
1445 |
27 Aug 08 |
peter |
29 |
|
1445 |
27 Aug 08 |
peter |
30 |
#include <functional> |
1445 |
27 Aug 08 |
peter |
31 |
|
1445 |
27 Aug 08 |
peter |
32 |
namespace theplu { |
1445 |
27 Aug 08 |
peter |
33 |
namespace yat { |
1497 |
12 Sep 08 |
peter |
34 |
namespace normalizer { |
1445 |
27 Aug 08 |
peter |
35 |
|
1445 |
27 Aug 08 |
peter |
36 |
/** |
1445 |
27 Aug 08 |
peter |
\brief Centralize a range |
1445 |
27 Aug 08 |
peter |
38 |
|
2415 |
22 Jan 11 |
peter |
The class centralizes a range <tt> [first, last) </tt> in two |
2415 |
22 Jan 11 |
peter |
steps. First, the center value is calculaterd using the functor |
2415 |
22 Jan 11 |
peter |
\c UnaryFunction to calculate the center. Second, the center |
2415 |
22 Jan 11 |
peter |
value is subtracted from each element in range <tt> [first, last) |
2415 |
22 Jan 11 |
peter |
</tt>. \c UnaryFunction must be a functor that has an operator: |
1445 |
27 Aug 08 |
peter |
44 |
|
3281 |
08 Jul 14 |
peter |
\code |
2415 |
22 Jan 11 |
peter |
return_type operator()(InputIterator, InputIterator) const |
3281 |
08 Jul 14 |
peter |
\endcode |
2283 |
26 Jun 10 |
peter |
48 |
|
2415 |
22 Jan 11 |
peter |
where \c return_type must be convertible to \c value_type of \c |
2415 |
22 Jan 11 |
peter |
InputIterator. By default the center value is calculated as the |
2415 |
22 Jan 11 |
peter |
arithmetic mean via class statistics::Average, but this can be |
2415 |
22 Jan 11 |
peter |
changed using an alternative functor such as |
2415 |
22 Jan 11 |
peter |
statistics::Percentiler. |
2415 |
22 Jan 11 |
peter |
54 |
|
1445 |
27 Aug 08 |
peter |
\since New in yat 0.5 |
1445 |
27 Aug 08 |
peter |
56 |
*/ |
3953 |
22 Jul 20 |
peter |
57 |
template<typename T = statistics::Average> |
3953 |
22 Jul 20 |
peter |
58 |
using Centralizer = RangeNormalizer<T, std::minus<double>>; |
1445 |
27 Aug 08 |
peter |
59 |
|
1497 |
12 Sep 08 |
peter |
60 |
}}} // end of namespace normalizer, yat and thep |
1445 |
27 Aug 08 |
peter |
61 |
#endif |