queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
VectorCdf.C
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 #include <queso/VectorCdf.h>
26 
27 namespace QUESO {
28 
29 // Default constructor -----------------------------
30 template<class V, class M>
32  const char* prefix,
33  const VectorSet<V,M>& pdfSupport)
34  :
35  m_env (pdfSupport.env()),
36  m_prefix ((std::string)(prefix)+"Cdf_"),
37  m_pdfSupport(pdfSupport)
38 {
39  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
40  *m_env.subDisplayFile() << "Entering BaseVectorCdf<V,M>::constructor()"
41  << ": prefix = " << m_prefix
42  << std::endl;
43  }
44 
45  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
46  *m_env.subDisplayFile() << "Leaving BaseVectorCdf<V,M>::constructor()"
47  << ": prefix = " << m_prefix
48  << std::endl;
49  }
50 }
51 // Destructor ---------------------------------------
52 template<class V, class M>
54 {
55 }
56 // Math methods--------------------------------------
57 template<class V, class M>
58 const VectorSet<V,M>&
60 {
61  return m_pdfSupport;
62 }
63 // I/O methods---------------------------------------
64 template<class V, class M>
65 void
67  const std::string& /* varNamePrefix */,
68  const std::string& /* fileName */,
69  const std::string& /* fileType */,
70  const std::set<unsigned int>& /* allowedSubEnvIds */) const
71 {
72  std::cerr << "WARNING: BaseVectorCdf<V,M>::subWriteContents() being used..."
73  << std::endl;
74  return;
75 }
76 
77 //---------------------------------------------------
78 // Method outside either class definition------------
79 //---------------------------------------------------
81 //
82 template <class V, class M>
83 void
85  const BaseVectorCdf<V,M>& cdf2,
86  const V& epsilonVec,
87  V& distances)
88 {
89  for (unsigned int i = 0; i < cdf1.pdfSupport().vectorSpace().dimLocal(); ++i) {
90  distances[i] = horizontalDistance(cdf1.cdf(i),
91  cdf2.cdf(i),
92  epsilonVec[i]);
93  }
94 
95  return;
96 }
97 
98 } // End namespace QUESO
BaseVectorCdf(const char *prefix, const VectorSet< V, M > &pdfSupport)
Default constructor.
Definition: VectorCdf.C:31
void horizontalDistances(const BaseVectorCdf< V, M > &cdf1, const BaseVectorCdf< V, M > &cdf2, const V &epsilonVec, V &distances)
It calculated the maximum horizontal distances between two vector CDFs.
Definition: VectorCdf.C:84
std::string m_prefix
Definition: VectorCdf.h:99
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 const BaseScalarCdf< double > & cdf(unsigned int rowId) const =0
A templated (base) class for handling CDFs of vector functions.
Definition: VectorCdf.h:53
A templated class for handling sets.
Definition: VectorSet.h:52
virtual ~BaseVectorCdf()
Virtual destructor.
Definition: VectorCdf.C:53
const BaseEnvironment & m_env
Definition: VectorCdf.h:98
const VectorSet< V, M > & pdfSupport() const
Returns the image set (support) of the PDF; access to protected attribute m_pdfSupport.
Definition: VectorCdf.C:59
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: VectorCdf.C:66
unsigned int displayVerbosity() const
Definition: Environment.C:450
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320

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