Doxygen 1.9.8
Toolkit for Adaptive Stochastic Modeling and Non-Intrusive ApproximatioN: Tasmanian v8.2
 
Loading...
Searching...
No Matches
tsgDreamEnumerates.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017, Miroslav Stoyanov
3 *
4 * This file is part of
5 * Toolkit for Adaptive Stochastic Modeling And Non-Intrusive ApproximatioN: TASMANIAN
6 *
7 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
12 * and the following disclaimer in the documentation and/or other materials provided with the distribution.
13 *
14 * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
20 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
21 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * UT-BATTELLE, LLC AND THE UNITED STATES GOVERNMENT MAKE NO REPRESENTATIONS AND DISCLAIM ALL WARRANTIES, BOTH EXPRESSED AND IMPLIED.
25 * THERE ARE NO EXPRESS OR IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE ANY PATENT,
26 * COPYRIGHT, TRADEMARK, OR OTHER PROPRIETARY RIGHTS, OR THAT THE SOFTWARE WILL ACCOMPLISH THE INTENDED RESULTS OR THAT THE SOFTWARE OR ITS USE WILL NOT RESULT IN INJURY OR DAMAGE.
27 * THE USER ASSUMES RESPONSIBILITY FOR ALL LIABILITIES, PENALTIES, FINES, CLAIMS, CAUSES OF ACTION, AND COSTS AND EXPENSES, CAUSED BY, RESULTING FROM OR ARISING OUT OF,
28 * IN WHOLE OR IN PART THE USE, STORAGE OR DISPOSAL OF THE SOFTWARE.
29 */
30
31#ifndef __TASMANIAN_DREAM_ENUMERATES_HPP
32#define __TASMANIAN_DREAM_ENUMERATES_HPP
33
34#include <random>
35
37
57namespace TasDREAM{
58
75namespace Utils{
82}
83
86
97
100
124
132namespace IO{
140 inline TypeSamplingForm intToForm(int form){ return (form == 0) ? regform : logform; }
141
149 inline std::map<std::string, TypeDistribution> getStringRuleMap(){
150 return std::initializer_list<std::pair<std::string const, TypeDistribution>>{
151 {"null", dist_null},
152 {"none", dist_none},
153 {"uniform", dist_uniform},
154 {"gaussian", dist_gaussian},
155 {"exponential", dist_exponential},
156 {"beta", dist_beta},
157 {"gamma", dist_gamma}};
158 }
159
167 inline TypeDistribution getDistributionString(std::string const &name){
168 try{
169 return getStringRuleMap().at(name);
170 }catch(std::out_of_range &){
171 return dist_null;
172 }
173 }
174}
175
176namespace DreamMaths{
184constexpr double pi = TasGrid::Maths::pi;
185}
186
187}
188
189#endif
Main header for the Sparse Grid module.
Wraps around a C-style of an array and mimics 2D data-structure.
Definition tsgUtils.hpp:127
TypeDistribution
Indicates a specific probability distribution for the associated function.
Definition tsgDreamEnumerates.hpp:102
TypeSamplingForm
Describes whether sampling should be done with the regular or logarithm form of the probability densi...
Definition tsgDreamEnumerates.hpp:90
constexpr double pi
Dream copy of TasGrid::Maths::pi.
Definition tsgDreamEnumerates.hpp:184
@ dist_null
Indicates I/O error or unspecified distribution.
Definition tsgDreamEnumerates.hpp:122
@ dist_gaussian
Gaussian or Normal distribution defined by mean and variance.
Definition tsgDreamEnumerates.hpp:107
@ dist_exponential
Exponential distribution (i.e., special case of the Gamma distribution).
Definition tsgDreamEnumerates.hpp:110
@ dist_beta
Beta distribution, corresponds to Gauss-Jacobi sparse grid rule TasGrid::rule_gaussjacobi.
Definition tsgDreamEnumerates.hpp:113
@ dist_gamma
Gamma distribution, corresponds to Gauss-Laguerre sparse grid rule TasGrid::rule_gausslaguerre.
Definition tsgDreamEnumerates.hpp:116
@ dist_uniform
Uniform distribution.
Definition tsgDreamEnumerates.hpp:104
@ dist_none
Indicates a no-distribution (no correction).
Definition tsgDreamEnumerates.hpp:119
@ regform
Use the standard form for the probability density.
Definition tsgDreamEnumerates.hpp:92
@ logform
Use the logarithm form for the probability density.
Definition tsgDreamEnumerates.hpp:95
TypeSamplingForm intToForm(int form)
Converts an integer to TypeSamplingForm, synced with the Python interface.
Definition tsgDreamEnumerates.hpp:140
TypeDistribution getDistributionString(std::string const &name)
Map the string distribution name to the enumerate, used by python.
Definition tsgDreamEnumerates.hpp:167
std::map< std::string, TypeDistribution > getStringRuleMap()
Returns the map from a string to a distribution type.
Definition tsgDreamEnumerates.hpp:149
constexpr double pi
Half-period of the std::sin() and std::cos() functions.
Definition tsgMathUtils.hpp:117
size_t size_mult(IntA a, IntB b)
Converts two integer-like variables to size_t and returns the product..
Definition tsgUtils.hpp:82
std::vector< typename std::remove_const< T >::type > copyArray(T *x, I size)
Copies an array into a vector, returns empty vector if the input is nullpntr.
Definition tsgUtils.hpp:92
Encapsulates the Tasmanian DREAM module.
Definition TasmanianDREAM.hpp:80