STK++ 0.9.13
STK_Kernel_Util.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------*/
2/* Copyright (C) 2004-2016 Serge Iovleff, Université Lille 1, Inria
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this program; if not, write to the
16 Free Software Foundation, Inc.,
17 59 Temple Place,
18 Suite 330,
19 Boston, MA 02111-1307
20 USA
21
22 Contact : S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
23*/
24
25/*
26 * Project: stkpp::STatitiK
27 * created on: 5 avr. 2015
28 * Author: iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 **/
30
36#ifndef STK_KERNEL_UTIL_H
37#define STK_KERNEL_UTIL_H
38
39#include <STKernel.h>
40
41namespace STK
42{
43
44namespace Kernel
45{
60
76inline kernelType stringToKernelType( std::string const& type)
77{
78 if (toUpperString(type) == toUpperString(_T("Laplace"))) return laplace_;
79 if (toUpperString(type) == toUpperString(_T("Exponential"))) return exponential_;
80 if (toUpperString(type) == toUpperString(_T("Gaussian"))) return gaussian_;
81 if (toUpperString(type) == toUpperString(_T("Linear"))) return linear_;
82 if (toUpperString(type) == toUpperString(_T("Polynomial"))) return polynomial_;
83 if (toUpperString(type) == toUpperString(_T("RationalQuadratic"))) return rationalQuadratic_;
84 if (toUpperString(type) == toUpperString(_T("Hamming"))) return hamming_;
85 return unknown_kernel_;
86}
87
94{
95 if (type == exponential_) return String(_T("Exponential")); // deprecated
96 if (type == laplace_) return String(_T("Laplace"));
97 if (type == gaussian_) return String(_T("Gaussian"));
98 if (type == linear_) return String(_T("Linear"));
99 if (type == polynomial_) return String(_T("Polynomial"));
100 if (type == rationalQuadratic_) return String(_T("RationalQuadratic"));
101 if (type == hamming_) return String(_T("Hamming"));
102 return String(_T("unknown"));
103}
104
105} // namespace Kernel
106
107} // namespace STK
108
109#endif /* STK_KERNEL_UTIL_H */
#define _T(x)
Let x unmodified.
This file include all the header files of the project STKernel.
String const & toUpperString(String &s)
convert the characters of the String to upper case
Definition STK_String.h:134
kernelType stringToKernelType(std::string const &type)
Convert a String to a kernelType.
String kernelTypeToString(kernelType const &type)
convert a kernelType to a String.
kernelType
kernel types.
std::basic_string< Char > String
STK fundamental type of a String.
The namespace STK is the main domain space of the Statistical ToolKit project.