yat/regression/TukeyBiweight.cc

Code
Comments
Other
Rev Date Author Line
2508 08 Jul 11 peter 1 // $Id$
2508 08 Jul 11 peter 2
2508 08 Jul 11 peter 3 /*
2919 19 Dec 12 peter 4   Copyright (C) 2011, 2012 Peter Johansson
2508 08 Jul 11 peter 5
2508 08 Jul 11 peter 6   This file is part of the yat library, http://dev.thep.lu.se/yat
2508 08 Jul 11 peter 7
2508 08 Jul 11 peter 8   The yat library is free software; you can redistribute it and/or
2508 08 Jul 11 peter 9   modify it under the terms of the GNU General Public License as
2508 08 Jul 11 peter 10   published by the Free Software Foundation; either version 3 of the
2508 08 Jul 11 peter 11   License, or (at your option) any later version.
2508 08 Jul 11 peter 12
2508 08 Jul 11 peter 13   The yat library is distributed in the hope that it will be useful,
2508 08 Jul 11 peter 14   but WITHOUT ANY WARRANTY; without even the implied warranty of
2508 08 Jul 11 peter 15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2508 08 Jul 11 peter 16   General Public License for more details.
2508 08 Jul 11 peter 17
2508 08 Jul 11 peter 18   You should have received a copy of the GNU General Public License
2508 08 Jul 11 peter 19   along with yat. If not, see <http://www.gnu.org/licenses/>.
2508 08 Jul 11 peter 20 */
2508 08 Jul 11 peter 21
2881 18 Nov 12 peter 22 #include <config.h>
2881 18 Nov 12 peter 23
2508 08 Jul 11 peter 24 #include "TukeyBiweight.h"
2508 08 Jul 11 peter 25
2508 08 Jul 11 peter 26 namespace theplu {
2508 08 Jul 11 peter 27 namespace yat {
2508 08 Jul 11 peter 28 namespace regression {
2508 08 Jul 11 peter 29
2508 08 Jul 11 peter 30   double TukeyBiweight::operator()(const double x) const
2508 08 Jul 11 peter 31   {
2508 08 Jul 11 peter 32     if (x>1 || x<-1)
2508 08 Jul 11 peter 33       return 0.0;
2508 08 Jul 11 peter 34     double result = 1-x*x;
2508 08 Jul 11 peter 35     result *= result;
2508 08 Jul 11 peter 36     return result;
2508 08 Jul 11 peter 37   }
2508 08 Jul 11 peter 38
2508 08 Jul 11 peter 39 }}} // of namespaces regression, yat, and theplu