queso-0.53.0
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-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_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 
48 template <class T>
50 public:
52 
53 
55  BaseScalarCdf(const BaseEnvironment& env, const char* prefix);
56 
58  virtual ~BaseScalarCdf();
60 
62 
63  const BaseEnvironment& env () const;
65 
67  const std::string& prefix () const;
69 
71 
72  virtual double value (T paramValue ) const = 0;
74 
76  virtual T inverse (double cdfValue ) const = 0;
77 
79  virtual void getSupport (T& minHorizontal, T& maxHorizontal) const = 0;
81 
83  virtual void print (std::ostream& os ) const = 0;
85  friend std::ostream& operator<< (std::ostream& os,
86  const BaseScalarCdf<T>& obj) {
87  obj.print(os);
88  return os;
89  }
90 
92 
93  virtual void subWriteContents(const std::string& varNamePrefix,
94  const std::string& fileName,
95  const std::string& fileType,
96  const std::set<unsigned int>& allowedSubEnvIds) const;
98 protected:
100  std::string m_prefix;
101  mutable T m_minHorizontal;
102  mutable T m_maxHorizontal;
103 };
104 
105 //---------------------------------------------------
106 // Method outside either class definition------------
107 //---------------------------------------------------
108 
109 //*****************************************************
110 // Horizontal distance
111 //*****************************************************
112 
114 template <class T>
115 double
117  const BaseScalarCdf<T>& cdf2,
118  double epsilon);
119 
120 } // End namespace QUESO
121 
122 #endif // UQ_SCALAR_CUMULATIVE_DISTRIBUTION_FUNCTION_H
A templated (base) class for handling CDFs.
Definition: ScalarCdf.h:49
const BaseEnvironment & m_env
Definition: ScalarCdf.h:99
virtual ~BaseScalarCdf()
Virtual destructor.
Definition: ScalarCdf.C:54
BaseScalarCdf(const BaseEnvironment &env, const char *prefix)
Default constructor.
Definition: ScalarCdf.C:31
double epsilon
Definition: ann_test.cpp:484
friend std::ostream & operator<<(std::ostream &os, const BaseScalarCdf< T > &obj)
Definition: ScalarCdf.h:85
std::string m_prefix
Definition: ScalarCdf.h:100
virtual void print(std::ostream &os) const =0
Prints the CDF. See template specialization.
const std::string & prefix() const
Access to private attribute m_prefix.
Definition: ScalarCdf.C:67
virtual void getSupport(T &minHorizontal, T &maxHorizontal) const =0
Returns the support (image) of the CDF between two horizontal values (domain). See template specializ...
virtual T inverse(double cdfValue) const =0
Returns the position of a given value of CDF. See template specialization.
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:193
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 double value(T paramValue) const =0
Returns the value of the CDF at paramValue. See template specialization.
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
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