queso-0.53.0
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-2015 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
A templated (base) class for handling CDFs.
Definition: ScalarCdf.h:49
const std::vector< double > & m_cdfValues
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.
double value(T paramValue) const
Returns the value of the CDF at paramValue.
SampledScalarCdf(const BaseEnvironment &env, const char *prefix, const BaseOneDGrid< T > &cdfGrid, const std::vector< double > &cdfValues)
Default constructor.
const std::string & prefix() const
Access to private attribute m_prefix.
Definition: ScalarCdf.C:67
const BaseOneDGrid< T > & m_cdfGrid
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:193
void getSupport(T &minHorizontal, T &maxHorizontal) const
Returns the support (image) of the CDF between two horizontal values (domain).
Base class for accommodating one-dimensional grids.
Definition: OneDGrid.h:46
T inverse(double cdfValue) const
Returns the position of a given value of CDF.
A class for handling sampled CDFs.
~SampledScalarCdf()
Destructor.
void print(std::ostream &os) const
Prints the CDF (values of the grid points and of the CDF at such grid points).
const BaseEnvironment & env() const
Environment. Access to private attribute m_env.
Definition: ScalarCdf.C:60

Generated on Thu Jun 11 2015 13:52:32 for queso-0.53.0 by  doxygen 1.8.5