STK++ 0.9.13
STK_Regress_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_REGRESS_UTIL_H
40#define STK_REGRESS_UTIL_H
41
42#include <STKernel.h>
43
44namespace STK
45{
46
47namespace Regress
48{
49
69
83
91
98
109
116
123
124
125
126//
127// implementation
128/* convert a String to a TypeReduction.
129 * @param type the type of reduction we want to define
130 * @return the TypeReduction represented by the String @c type. if the string
131 * does not match any known name, the @c unknown_regression_ type is returned.
132 **/
134{
135 if (toUpperString(type) == toUpperString(_T("uniform"))) return uniformKnotsPositions_;
136 if (toUpperString(type) == toUpperString(_T("periodic"))) return periodicKnotsPositions_;
137 if (toUpperString(type) == toUpperString(_T("density"))) return densityKnotsPositions_;
139}
140
141/* convert a TypeReduction to a String.
142 * @param type the type of reduction we want to convert
143 * @return the string associated to this type.
144 **/
146{
147 if (type == uniformKnotsPositions_) return String(_T("uniform"));
148 if (type == periodicKnotsPositions_) return String(_T("periodic"));
149 if (type == densityKnotsPositions_) return String(_T("density"));
150 return String(_T("unknown"));
151}
152
153/* convert a String to a TypeRegression.
154 * @param type the type of regression we want to define
155 * @return the TypeRegression represented by the String @c type. if the string
156 * does not match any known name, the @c unknown_regression_ type is returned.
157 **/
159{
160 if (toUpperString(type) == toUpperString(_T("unknown"))) return unknown_regression_;
161 if (toUpperString(type) == toUpperString(_T("linear"))) return linear_;
162 if (toUpperString(type) == toUpperString(_T("additiveBSpline"))) return additiveBSpline_;
163 if (toUpperString(type) == toUpperString(_T("adaptiveBSpline"))) return adaptiveBSpline_;
164 return unknown_regression_;
165}
166
167/* convert a TypeRegression to a String.
168 * @param type the type of regression we want to convert
169 * @return the string associated to this type.
170 **/
172{
173 if (type == linear_) return String(_T("linear"));
174 if (type == additiveBSpline_) return String(_T("additiveBSpline"));
175 if (type == adaptiveBSpline_) return String(_T("adaptiveBSpline"));
176 return String(_T("unknown"));
177}
178
179} // namespace Regress
180
181} //namespace STK
182
183#endif /* STK_REGRESS_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
KnotsPosition
Method to use for positioning the knots for BSpline basis.
TypeRegression
Regression method to use.
TypeBasisFunction
functional basis coefficients to use for fonctional and non-linear regression
String knotsPositionToString(KnotsPosition const &type)
convert a KnotsPosition to a String.
TypeRegression stringToTypeRegression(String const &type)
Convert a String to a TypeRegression.
String typeRegressionToString(TypeRegression const &type)
Convert a TypeRegression to a String.
@ uniformKnotsPositions_
uniform knots
@ densityKnotsPositions_
knots using density of the data
@ unknown_Knots_Position_
unknown positions
@ periodicKnotsPositions_
periodic knots
@ linear_
additive BSpline regression
@ unknown_regression_
unknown regression
@ additiveBSpline_
adaptive BSpline regression
@ trigonometric_
Chebyshev coefficients.
@ sines_
cosines coefficients
@ unknown_basis_
unknown coefficients
@ cosines_
trigonometric coefficients (sines and cosines)
@ bspline_
Sines coefficients.
std::basic_string< Char > String
STK fundamental type of a String.
KnotsPosition stringToKnotsPosition(String const &type)
convert a String to a KnotsPosition.
The namespace STK is the main domain space of the Statistical ToolKit project.