queso-0.53.0
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-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 #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 
75  if (&varNamePrefix) {}; // just to remove compiler warning
76  if (&fileName) {}; // just to remove compiler warning
77  if (&fileType) {}; // just to remove compiler warning
78  if (&allowedSubEnvIds) {}; // just to remove compiler warning
79  return;
80 }
81 
82 //---------------------------------------------------
83 // Method outside either class definition------------
84 //---------------------------------------------------
86 //
87 template <class V, class M>
88 void
90  const BaseVectorCdf<V,M>& cdf2,
91  const V& epsilonVec,
92  V& distances)
93 {
94  for (unsigned int i = 0; i < cdf1.pdfSupport().vectorSpace().dimLocal(); ++i) {
95  distances[i] = horizontalDistance(cdf1.cdf(i),
96  cdf2.cdf(i),
97  epsilonVec[i]);
98  }
99 
100  return;
101 }
102 
103 } // End namespace QUESO
unsigned int displayVerbosity() const
Definition: Environment.C:396
const VectorSet< V, M > & pdfSupport() const
Returns the image set (support) of the PDF; access to protected attribute m_pdfSupport.
Definition: VectorCdf.C:59
A templated class for handling sets.
Definition: VectorSet.h:52
A templated (base) class for handling CDFs of vector functions.
Definition: VectorCdf.h:53
BaseVectorCdf(const char *prefix, const VectorSet< V, M > &pdfSupport)
Default constructor.
Definition: VectorCdf.C:31
std::string m_prefix
Definition: VectorCdf.h:99
virtual const BaseScalarCdf< double > & cdf(unsigned int rowId) const =0
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
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
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
const BaseEnvironment & m_env
Definition: VectorCdf.h:98
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:89
virtual ~BaseVectorCdf()
Virtual destructor.
Definition: VectorCdf.C:53

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