source: trunk/yat/normalizer/Centralizer.h

Last change on this file was 3999, checked in by Peter, 12 months ago

update copyright years

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1#ifndef _theplu_yat_normalizer_centralizer_
2#define _theplu_yat_normalizer_centralizer_
3
4// $Id: Centralizer.h 3999 2020-10-08 23:22:32Z peter $
5
6/*
7  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2009, 2010, 2011, 2014, 2016, 2020 Peter Johansson
9
10  This file is part of the yat library, http://dev.thep.lu.se/yat
11
12  The yat library is free software; you can redistribute it and/or
13  modify it under the terms of the GNU General Public License as
14  published by the Free Software Foundation; either version 3 of the
15  License, or (at your option) any later version.
16
17  The yat library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  General Public License for more details.
21
22  You should have received a copy of the GNU General Public License
23  along with yat. If not, see <http://www.gnu.org/licenses/>.
24*/
25
26#include "RangeNormalizer.h"
27
28#include "yat/statistics/Average.h"
29
30#include <functional>
31
32namespace theplu {
33namespace yat {
34namespace normalizer {
35
36  /**
37     \brief Centralize a range
38
39     The class centralizes a range <tt> [first, last) </tt> in two
40     steps. First, the center value is calculaterd using the functor
41     \c UnaryFunction to calculate the center. Second, the center
42     value is subtracted from each element in range <tt> [first, last)
43     </tt>. \c UnaryFunction must be a functor that has an operator:
44
45     \code
46     return_type operator()(InputIterator, InputIterator) const
47     \endcode
48
49     where \c return_type must be convertible to \c value_type of \c
50     InputIterator. By default the center value is calculated as the
51     arithmetic mean via class statistics::Average, but this can be
52     changed using an alternative functor such as
53     statistics::Percentiler.
54
55     \since New in yat 0.5
56   */
57  template<typename T = statistics::Average>
58  using Centralizer = RangeNormalizer<T, std::minus<double>>;
59
60}}} // end of namespace normalizer, yat and thep
61#endif
Note: See TracBrowser for help on using the repository browser.