queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
SampledScalarCdf.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008-2017 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef UQ_SAMPLED_SCALAR_CUMULATIVE_DISTRIBUTION_FUNCTION_H
26 #define UQ_SAMPLED_SCALAR_CUMULATIVE_DISTRIBUTION_FUNCTION_H
27 
28 #include <queso/StdOneDGrid.h>
29 #include <queso/Environment.h>
30 #include <queso/ScalarCdf.h>
31 #include <math.h>
32 
33 namespace QUESO {
34 
35 //*****************************************************
36 // Sampled cumulative distribution function class
37 //*****************************************************
45 template <class T>
46 class SampledScalarCdf : public BaseScalarCdf<T> {
47 public:
49 
50 
54  const char* prefix,
55  const BaseOneDGrid<T>& cdfGrid,
56  const std::vector<double>& cdfValues);
60 
62 
63  double value (T paramValue) const;
65 
67  T inverse (double cdfValue ) const;
68 
70  void getSupport (T& minHorizontal, T& maxHorizontal) const;
72 
74 
75  void print (std::ostream& os ) const;
77 
78 
80 
81  void subWriteContents(const std::string& varNamePrefix,
82  const std::string& fileName,
83  const std::string& fileType,
84  const std::set<unsigned int>& allowedSubEnvIds) const;
86 protected:
91 
93  const std::vector<double>& m_cdfValues;
94 //std::vector<double>& m_sortedCdfValues;
95 };
96 
97 } // End namespace QUESO
98 
99 #endif // UQ_SAMPLED_SCALAR_CUMULATIVE_DISTRIBUTION_FUNCTION_H
const BaseEnvironment & env() const
Environment. Access to private attribute m_env.
Definition: ScalarCdf.C:60
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:198
void subWriteContents(const std::string &varNamePrefix, const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds) const
Writes the CDF of an allowed sub-environment to a file.
void print(std::ostream &os) const
Prints the CDF (values of the grid points and of the CDF at such grid points).
const BaseOneDGrid< T > & m_cdfGrid
A class for handling sampled CDFs.
Base class for accommodating one-dimensional grids.
Definition: OneDGrid.h:46
A templated (base) class for handling CDFs.
Definition: ScalarCdf.h:49
const std::vector< double > & m_cdfValues
const std::string & prefix() const
Access to private attribute m_prefix.
Definition: ScalarCdf.C:67
double value(T paramValue) const
Returns the value of the CDF at paramValue.
void getSupport(T &minHorizontal, T &maxHorizontal) const
Returns the support (image) of the CDF between two horizontal values (domain).
T inverse(double cdfValue) const
Returns the position of a given value of CDF.
SampledScalarCdf(const BaseEnvironment &env, const char *prefix, const BaseOneDGrid< T > &cdfGrid, const std::vector< double > &cdfValues)
Default constructor.
~SampledScalarCdf()
Destructor.

Generated on Tue Jun 5 2018 19:48:55 for queso-0.57.1 by  doxygen 1.8.5