queso-0.50.1
ConcatenatedVectorRV.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,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 #include <queso/ConcatenatedVectorRV.h>
26 #include <queso/GslVector.h>
27 #include <queso/GslMatrix.h>
28 
29 namespace QUESO {
30 
31 // Constructor -------------------------------------
32 template<class V, class M>
34  const char* prefix,
35  const BaseVectorRV<V,M>& rv1,
36  const BaseVectorRV<V,M>& rv2,
37  const VectorSet<V,M>& imageSet)
38  :
39  BaseVectorRV<V,M>(((std::string)(prefix)+"concat").c_str(),imageSet),
40  m_rvs (2,(const BaseVectorRV <V,M>*) NULL),
41  m_pdfs (2,(const BaseJointPdf <V,M>*) NULL),
42  m_realizers (2,(const BaseVectorRealizer<V,M>*) NULL)
43 {
44  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
45  *m_env.subDisplayFile() << "Entering ConcatenatedVectorRV<V,M>::constructor(1)"
46  << ": prefix = " << m_prefix
47  << std::endl;
48  }
49 
50  m_rvs[0] = &rv1;
51  m_rvs[1] = &rv2;
52  m_pdfs[0] = &(m_rvs[0]->pdf());
53  m_pdfs[1] = &(m_rvs[1]->pdf());
54  m_realizers[0] = &(m_rvs[0]->realizer());
55  m_realizers[1] = &(m_rvs[1]->realizer());
56 
58  *(m_pdfs[0]),
59  *(m_pdfs[1]),
60  m_imageSet);
61 
63  *(m_realizers[0]),
64  *(m_realizers[1]),
65  m_imageSet);
66  m_subCdf = NULL; // FIX ME: complete code
67  m_unifiedCdf = NULL; // FIX ME: complete code
68  m_mdf = NULL; // FIX ME: complete code
69 
70  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
71  *m_env.subDisplayFile() << "Leaving ConcatenatedVectorRV<V,M>::constructor(1)"
72  << ": prefix = " << m_prefix
73  << std::endl;
74  }
75 }
76 // Constructor -------------------------------------
77 template<class V, class M>
79  const char* prefix,
80  const std::vector<const BaseVectorRV<V,M>* >& rvs,
81  const VectorSet<V,M>& imageSet)
82  :
83  BaseVectorRV<V,M>(((std::string)(prefix)+"concat").c_str(),imageSet),
84  m_rvs (rvs.size(),(const BaseVectorRV <V,M>*) NULL),
85  m_pdfs (rvs.size(),(const BaseJointPdf <V,M>*) NULL),
86  m_realizers (rvs.size(),(const BaseVectorRealizer<V,M>*) NULL)
87 {
88  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
89  *m_env.subDisplayFile() << "Entering ConcatenatedVectorRV<V,M>::constructor(2)"
90  << ": prefix = " << m_prefix
91  << std::endl;
92  }
93 
94  for (unsigned int i = 0; i < m_rvs.size(); ++i) {
95  m_rvs [i] = rvs[i];
96  m_pdfs[i] = &(m_rvs[i]->pdf());
97  m_realizers[i] = &(m_rvs[i]->realizer());
98  }
99 
101  m_pdfs,
102  m_imageSet);
103 
104  unsigned int minPeriod = m_realizers[0]->subPeriod();
105  for (unsigned int i = 0; i < m_realizers.size(); ++i) {
106  if (minPeriod > m_realizers[i]->subPeriod()) {
107  minPeriod = m_realizers[i]->subPeriod();
108  }
109  }
110 
112  m_realizers,
113  minPeriod,
114  m_imageSet);
115  m_subCdf = NULL; // FIX ME: complete code
116  m_unifiedCdf = NULL; // FIX ME: complete code
117  m_mdf = NULL; // FIX ME: complete code
118 
119  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
120  *m_env.subDisplayFile() << "Leaving ConcatenatedVectorRV<V,M>::constructor(2)"
121  << ": prefix = " << m_prefix
122  << std::endl;
123  }
124 }
125 // Destructor --------------------------------------
126 template<class V, class M>
128 {
129  delete m_mdf;
130  delete m_unifiedCdf;
131  delete m_subCdf;
132  delete m_realizer;
133  delete m_pdf;
134 }
135 //--------------------------------------------------
136 template <class V, class M>
137 void
138 ConcatenatedVectorRV<V,M>::print(std::ostream& os) const
139 {
140  os << "ConcatenatedVectorRV<V,M>::print() says, 'Please implement me.'" << std::endl;
141  return;
142 }
143 
144 } // End namespace QUESO
145 
const BaseVectorCdf< V, M > * m_unifiedCdf
Definition: VectorRV.h:136
A class representing concatenated vector RVs.
A templated base class for handling vector RV.
Definition: VectorRV.h:69
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:305
virtual ~ConcatenatedVectorRV()
Virtual destructor.
const BaseEnvironment & m_env
Definition: VectorRV.h:130
const VectorSet< V, M > & m_imageSet
Definition: VectorRV.h:132
A class for handling sampling from concatenated probability density distributions.
const BaseVectorCdf< V, M > * m_subCdf
Definition: VectorRV.h:135
BaseVectorRealizer< V, M > * m_realizer
Definition: VectorRV.h:134
A templated (base) class for handling sampling from vector RVs.
A templated class for handling sets.
Definition: VectorSet.h:49
std::vector< const BaseVectorRV< V, M > * > m_rvs
void print(std::ostream &os) const
TODO: Prints the vector RV.
const BaseVectorMdf< V, M > * m_mdf
Definition: VectorRV.h:137
std::vector< const BaseVectorRealizer< V, M > * > m_realizers
std::vector< const BaseJointPdf< V, M > * > m_pdfs
A class for handling concatenated PDFs.
std::string m_prefix
Definition: VectorRV.h:131
BaseJointPdf< V, M > * m_pdf
Definition: VectorRV.h:133
unsigned int displayVerbosity() const
Definition: Environment.C:436
ConcatenatedVectorRV(const char *prefix, const BaseVectorRV< V, M > &rv1, const BaseVectorRV< V, M > &rv2, const VectorSet< V, M > &imageSet)
Constructor.
A templated (base) class for handling joint PDFs.
Definition: JointPdf.h:60

Generated on Thu Apr 23 2015 19:18:34 for queso-0.50.1 by  doxygen 1.8.5