STK++ 0.9.13
STK_Basis_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::Regress
27 * created on: 23 juin 2011
28 * Purpose: num and other utilities for the Regress project..
29 * Author: iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
30 *
31 **/
32
39#ifndef STK_BASIS_UTIL_H
40#define STK_BASIS_UTIL_H
41
42#include <STKernel.h>
43
44namespace STK
45{
46
47namespace Basis
48{
49
68
69
79
87
94
102
109
110
111// implementation
112/* convert a String to a TypeReduction.
113 * @param type the type of reduction we want to define
114 * @return the TypeReduction represented by the String @c type. if the string
115 * does not match any known name, the @c unknown_regression_ type is returned.
116 **/
118{
119 if (toUpperString(type) == toUpperString(_T("uniform"))) return uniformKnotsPositions_;
120 if (toUpperString(type) == toUpperString(_T("periodic"))) return periodicKnotsPositions_;
121 if (toUpperString(type) == toUpperString(_T("density"))) return densityKnotsPositions_;
123}
124
125/* convert a TypeReduction to a String.
126 * @param type the type of reduction we want to convert
127 * @return the string associated to this type.
128 **/
130{
131 if (type == uniformKnotsPositions_) return String(_T("uniform"));
132 if (type == periodicKnotsPositions_) return String(_T("periodic"));
133 if (type == densityKnotsPositions_) return String(_T("density"));
134 return String(_T("unknown"));
135}
136
137/* @ingroup Regress
138 * convert a String to a TypeBasisFunction.
139 * @param type the type of TypeBasisFunction in a string
140 * @return the TypeBasisFunction represented by the String @c type. If the string
141 * does not match any known name, the @c unknown_basis_ type is returned.
142 **/
144{
145 if (toUpperString(type) == toUpperString(_T("bspline"))) return bspline_;
146 if (toUpperString(type) == toUpperString(_T("sines"))) return sines_;
147 if (toUpperString(type) == toUpperString(_T("cosines"))) return cosines_;
148 if (toUpperString(type) == toUpperString(_T("trigonometric"))) return trigonometric_;
149 if (toUpperString(type) == toUpperString(_T("chebyshev"))) return chebyshev_;
150 return unknown_basis_;
151}
152
153
154/* @ingroup Regress
155 * convert a TypeBasisFunction to a String.
156 * @param type the TypeBasisFunction we want to convert to a string
157 * @return the string associated to this TypeBasisFunction
158 **/
160{
161 if (type == bspline_) return String(_T("bspline"));
162 if (type == sines_) return String(_T("sines"));
163 if (type == cosines_) return String(_T("cosines"));
164 if (type == trigonometric_) return String(_T("trigonometric"));
165 if (type == chebyshev_) return String(_T("chebyshev"));
166 return String(_T("unknown"));
167}
168
169
170} // namespace Basis
171
172} //namespace STK
173
174#endif /* STK_BASIS_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
TypeBasisFunction
function basis function to use for functional and non-linear regression
TypeBasisFunction stringToTypeBasisFunction(String const &type)
convert a String to a TypeBasisFunction.
KnotsPosition stringToKnotsPosition(String const &type)
convert a String to a KnotsPosition.
String typeBasisFunctionToString(TypeBasisFunction const &type)
convert a TypeBasisFunction to a String.
KnotsPosition
Method to use for positioning the knots in BSpline basis.
String knotsPositionToString(KnotsPosition const &type)
convert a KnotsPosition to a String.
@ trigonometric_
Chebyshev basis.
@ bspline_
BSpline basis.
@ cosines_
trigonometric basis (sines and cosines)
@ chebyshev_
unknown basis
@ sines_
cosines basis
@ unknown_Knots_Position_
unknown positions
@ uniformKnotsPositions_
uniform knots
@ periodicKnotsPositions_
periodic knots
@ densityKnotsPositions_
knots using density of the data
std::basic_string< Char > String
STK fundamental type of a String.
The namespace STK is the main domain space of the Statistical ToolKit project.