STK++ 0.9.13
STK_Reduct_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::Reduct
27 * created on: 23 juin 2011
28 * Purpose: enum and other utilities for the Reduct project.
29 * Author: iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
30 *
31 **/
32
38#ifndef STK_REDUCT_UTIL_H_
39#define STK_REDUCT_UTIL_H_
40
41#include <STKernel.h>
42
43namespace STK
44{
45
46namespace Reduct
47{
48
63
71
78
103} // namespace Reduct
104
105namespace Reduct
106{
107
108/* convert a String to a TypeReduction.
109 * @param type the type of reduction we want to define
110 * @return the TypeReduction represented by the String @c type. if the string
111 * does not match any known name, the @c unknown_ type is returned.
112 **/
114{
115 if (toUpperString(type) == toUpperString(_T("totalVariance"))) return totalVariance_;
116 if (toUpperString(type) == toUpperString(_T("localVariance"))) return localVariance_;
117 if (toUpperString(type) == toUpperString(_T("mds"))) return mds_;
118 return unknown_reduction_;
119}
120
121/* convert a TypeReduction to a String.
122 * @param type the type of reduction we want to convert
123 * @return the string associated to this type.
124 **/
126{
127 if (type == totalVariance_) return String(_T("totalVariance"));
128 if (type == localVariance_) return String(_T("localVariance"));
129 if (type == mds_) return String(_T("mds"));
130 return String(_T("unknown"));
131}
132
133/* convert a String to a TypeReduction.
134 * @param type the type of reduction we want to define
135 * @return the TypeReduction represented by the String @c type. if the string
136 * does not match any known name, the @c unknown_ type is returned.
137 **/
139{
140 if (toUpperString(type) == toUpperString(_T("prim"))) return prim_;
141 if (toUpperString(type) == toUpperString(_T("minimalDistance"))) return distance_;
142 return unknown_graph_;
143}
144
145/* convert a TypeReduction to a String.
146 * @param type the type of reduction we want to convert
147 * @return the string associated to this type.
148 **/
150{
151 if (type == prim_) return String(_T("prim"));
152 if (type == distance_) return String(_T("minimalDistance"));
153 return String(_T("unknown"));
154}
155
156} // namespace Reduct
157
158} // namespace STK
159
160#endif /* STK_REDUCT_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
String typeReductionToString(TypeReduction const &type)
convert a TypeReduction to a String.
TypeReduction
dimension reduction we can apply to the original data set.
TypeReduction stringToTypeReduction(String const &type)
convert a String to a TypeReduction.
@ totalVariance_
multidimensional scaling
@ localVariance_
total projected variance (pca)
@ unknown_reduction_
unknown reduction
std::basic_string< Char > String
STK fundamental type of a String.
TypeGraph stringToTypeGraph(String const &type)
convert a String to a TypeGraph.
String typeGraphToString(TypeGraph const &type)
convert a TypeGraph to a String.
TypeGraph
Type of proximity graph to used in order to compute the local variance:
The namespace STK is the main domain space of the Statistical ToolKit project.