queso-0.51.1
ScalarCdf.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,2009,2010,2011,2012,2013 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_SCALAR_CUMULATIVE_DISTRIBUTION_FUNCTION_H
26 #define UQ_SCALAR_CUMULATIVE_DISTRIBUTION_FUNCTION_H
27 
28 #include <queso/StdOneDGrid.h>
29 #include <queso/Environment.h>
30 #include <math.h>
31 
32 namespace QUESO {
33 
34 //*****************************************************
35 // Classes to accommodate a cumulative distribution function
36 //*****************************************************
37 
38 //*****************************************************
39 // Base class
40 //*****************************************************
55 template<class T>
57 public:
59 
60 
62  BaseScalarCdf(const BaseEnvironment& env, const char* prefix);
63 
65  virtual ~BaseScalarCdf();
67 
69 
70  const BaseEnvironment& env () const;
72 
74  const std::string& prefix () const;
76 
78 
79  virtual double value (T paramValue ) const = 0;
81 
83  virtual T inverse (double cdfValue ) const = 0;
84 
86  virtual void getSupport (T& minHorizontal, T& maxHorizontal) const = 0;
88 
90  virtual void print (std::ostream& os ) const = 0;
92  friend std::ostream& operator<< (std::ostream& os,
93  const BaseScalarCdf<T>& obj) {
94  obj.print(os);
95  return os;
96  }
97 
99 
100  virtual void subWriteContents(const std::string& varNamePrefix,
101  const std::string& fileName,
102  const std::string& fileType,
103  const std::set<unsigned int>& allowedSubEnvIds) const;
105 protected:
107  std::string m_prefix;
108  mutable T m_minHorizontal;
109  mutable T m_maxHorizontal;
110 };
111 
112 //---------------------------------------------------
113 // Method outside either class definition------------
114 //---------------------------------------------------
115 
116 //*****************************************************
117 // Horizontal distance
118 //*****************************************************
119 
121 template <class T>
122 double
124  const BaseScalarCdf<T>& cdf2,
125  double epsilon);
126 
127 } // End namespace QUESO
128 
129 #endif // UQ_SCALAR_CUMULATIVE_DISTRIBUTION_FUNCTION_H
const std::string & prefix() const
Access to private attribute m_prefix.
Definition: ScalarCdf.C:67
virtual 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.
Definition: ScalarCdf.C:74
A templated (base) class for handling CDFs.
Definition: ScalarCdf.h:56
double horizontalDistance(const BaseScalarCdf< T > &cdf1, const BaseScalarCdf< T > &cdf2, double epsilon)
It calculated the maximum horizontal distance between two CDFs.
Definition: ScalarCdf.C:96
virtual void print(std::ostream &os) const =0
Prints the CDF. See template specialization.
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:187
virtual T inverse(double cdfValue) const =0
Returns the position of a given value of CDF. See template specialization.
virtual ~BaseScalarCdf()
Virtual destructor.
Definition: ScalarCdf.C:54
const BaseEnvironment & env() const
Environment. Access to private attribute m_env.
Definition: ScalarCdf.C:60
friend std::ostream & operator<<(std::ostream &os, const BaseScalarCdf< T > &obj)
Definition: ScalarCdf.h:92
BaseScalarCdf(const BaseEnvironment &env, const char *prefix)
Default constructor.
Definition: ScalarCdf.C:31
const BaseEnvironment & m_env
Definition: ScalarCdf.h:106
virtual double value(T paramValue) const =0
Returns the value of the CDF at paramValue. See template specialization.
virtual void getSupport(T &minHorizontal, T &maxHorizontal) const =0
Returns the support (image) of the CDF between two horizontal values (domain). See template specializ...
std::string m_prefix
Definition: ScalarCdf.h:107

Generated on Thu Apr 23 2015 19:26:15 for queso-0.51.1 by  doxygen 1.8.5