STK++ 0.9.13
STK_Law_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.org (see copyright for ...)
23*/
24
25/*
26 * Project: stkpp::STatistiK::Law
27 * created on: 2 sept. 2013
28 * Author: iovleff, serge.iovleff@stkpp.org
29 **/
30
37#ifndef STK_LAW_UTIL_H
38#define STK_LAW_UTIL_H
39
40#include "STK_RandBase.h"
41
42namespace STK
43{
44
45namespace Law
46{
47
49static RandBase generator;
50
78
79
109{
110 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("beta"))) return beta_;
111 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("binomial"))) return binomial_;
112 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("categorical"))) return categorical_;
113 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("cauchy"))) return cauchy_;
114 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("chisquared"))) return chisquared_;
115 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("exponential"))) return exponential_;
116 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("fishersnedecor"))) return fisher_snedecor_;
117 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("gamma"))) return gamma_;
118 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("geometric"))) return geometric_;
119 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("hypergeometric"))) return hypergeometric_;
120 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("logistic"))) return logistic_;
121 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("lognormal"))) return lognormal_;
122 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("negativebinomial"))) return negative_binomial_;
123 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("normal"))) return normal_;
124 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("poisson"))) return poisson_;
125 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("student"))) return student_;
126 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("uniform"))) return uniform_;
127 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("uniformdiscrete"))) return uniform_discrete_;
128 if (toUpperString(removeWhiteSpaces(dist)) == toUpperString(_T("weibull"))) return weibull_;
129#ifdef STK_STATISTIK_DEBUG
130 stk_cout << _T("In stringToUnivariateDistribution, dist ") << dist << _T(" not found.\n");
131#endif
133}
134
142{
143 if (type == beta_) return String(_T("beta"));
144 if (type == binomial_) return String(_T("binomial"));
145 if (type == categorical_) return String(_T("categorical"));
146 if (type == chisquared_) return String(_T("chi squared"));
147 if (type == cauchy_) return String(_T("cauchy"));
148 if (type == exponential_) return String(_T("exponential"));
149 if (type == fisher_snedecor_) return String(_T("fisher snedecor"));
150 if (type == gamma_) return String(_T("gamma"));
151 if (type == geometric_) return String(_T("geometric"));
152 if (type == hypergeometric_) return String(_T("hypergeometric"));
153 if (type == logistic_) return String(_T("logistic"));
154 if (type == lognormal_) return String(_T("lognormal"));
155 if (type == negative_binomial_) return String(_T("negative binomial"));
156 if (type == normal_) return String(_T("normal"));
157 if (type == poisson_) return String(_T("poisson"));
158 if (type == student_) return String(_T("student"));
159 if (type == uniform_) return String(_T("uniform"));
160 if (type == uniform_discrete_) return String(_T("uniform discrete"));
161 if (type == weibull_) return String(_T("weibull"));
162 return String(_T("unknown"));
163}
164
165
166
167} // namespace Law
168
169} // namespace STK
170
171#endif /* STK_LAW_UTIL_H */
Declaration of the RandBase class.
#define stk_cout
Standard stk output stream.
#define _T(x)
Let x unmodified.
Real dist(ExprBase< Container1D1 > const &x, ExprBase< Container1D2 > const &y)
Compute the distance between two vectors.
String const & toUpperString(String &s)
convert the characters of the String to upper case
Definition STK_String.h:134
String removeWhiteSpaces(String const &s)
convert the characters of the String to upper case
Definition STK_String.h:165
std::basic_string< Char > String
STK fundamental type of a String.
std::string univariateDistributionToString(UnivariateDistribution const &type)
convert a UnivariateDistribution to a String.
UnivariateDistribution
list of the univariate distribution laws
@ uniform_discrete_
@ negative_binomial_
@ unknown_univ_distribution_
@ fisher_snedecor_
@ hypergeometric_
UnivariateDistribution stringToUnivariateDistribution(std::string const &dist)
Convert a String to a UnivariateDistribution.
The namespace STK is the main domain space of the Statistical ToolKit project.