yat/normalizer/Centralizer.h

Code
Comments
Other
Rev Date Author Line
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 4 // $Id$
1576 14 Oct 08 jari 5
1445 27 Aug 08 peter 6 /*
2119 12 Dec 09 peter 7   Copyright (C) 2008 Jari Häkkinen, Peter Johansson
3999 08 Oct 20 peter 8   Copyright (C) 2009, 2010, 2011, 2014, 2016, 2020 Peter Johansson
1445 27 Aug 08 peter 9
1445 27 Aug 08 peter 10   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 12   The yat library is free software; you can redistribute it and/or
1445 27 Aug 08 peter 13   modify it under the terms of the GNU General Public License as
1486 09 Sep 08 jari 14   published by the Free Software Foundation; either version 3 of the
1445 27 Aug 08 peter 15   License, or (at your option) any later version.
1445 27 Aug 08 peter 16
1445 27 Aug 08 peter 17   The yat library is distributed in the hope that it will be useful,
1445 27 Aug 08 peter 18   but WITHOUT ANY WARRANTY; without even the implied warranty of
1445 27 Aug 08 peter 19   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1445 27 Aug 08 peter 20   General Public License for more details.
1445 27 Aug 08 peter 21
1445 27 Aug 08 peter 22   You should have received a copy of the GNU General Public License
1487 10 Sep 08 jari 23   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 37      \brief Centralize a range
1445 27 Aug 08 peter 38
2415 22 Jan 11 peter 39      The class centralizes a range <tt> [first, last) </tt> in two
2415 22 Jan 11 peter 40      steps. First, the center value is calculaterd using the functor
2415 22 Jan 11 peter 41      \c UnaryFunction to calculate the center. Second, the center
2415 22 Jan 11 peter 42      value is subtracted from each element in range <tt> [first, last)
2415 22 Jan 11 peter 43      </tt>. \c UnaryFunction must be a functor that has an operator:
1445 27 Aug 08 peter 44
3281 08 Jul 14 peter 45      \code
2415 22 Jan 11 peter 46      return_type operator()(InputIterator, InputIterator) const
3281 08 Jul 14 peter 47      \endcode
2283 26 Jun 10 peter 48
2415 22 Jan 11 peter 49      where \c return_type must be convertible to \c value_type of \c
2415 22 Jan 11 peter 50      InputIterator. By default the center value is calculated as the
2415 22 Jan 11 peter 51      arithmetic mean via class statistics::Average, but this can be
2415 22 Jan 11 peter 52      changed using an alternative functor such as
2415 22 Jan 11 peter 53      statistics::Percentiler.
2415 22 Jan 11 peter 54
1445 27 Aug 08 peter 55      \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