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