queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
QUESO::ConcatenatedVectorRV< V, M > Class Template Reference

A class representing concatenated vector RVs. More...

#include <ConcatenatedVectorRV.h>

Inheritance diagram for QUESO::ConcatenatedVectorRV< V, M >:
QUESO::BaseVectorRV< V, M >

Public Member Functions

Constructor/Destructor methods
 ConcatenatedVectorRV (const char *prefix, const BaseVectorRV< V, M > &rv1, const BaseVectorRV< V, M > &rv2, const VectorSet< V, M > &imageSet)
 Constructor. More...
 
 ConcatenatedVectorRV (const char *prefix, const std::vector< const BaseVectorRV< V, M > * > &rvs, const VectorSet< V, M > &imageSet)
 Constructor. More...
 
virtual ~ConcatenatedVectorRV ()
 Virtual destructor. More...
 
I/O methods
void print (std::ostream &os) const
 TODO: Prints the vector RV. More...
 
- Public Member Functions inherited from QUESO::BaseVectorRV< V, M >
virtual double estimateENT_ANN () const
 
 BaseVectorRV (const char *prefix, const VectorSet< V, M > &imageSet)
 Constructor. More...
 
virtual ~BaseVectorRV ()
 Virtual destructor. More...
 
const BaseEnvironmentenv () const
 QUESO environment; access to private attribute m_env. More...
 
const VectorSet< V, M > & imageSet () const
 Image set of the vector RV; access to private attribute m_imageSet. More...
 
const BaseJointPdf< V, M > & pdf () const
 Posterior Density Function of the vector RV; access to private attribute m_pdf. More...
 
bool has_realizer () const
 Returns true iff this RV has the ability to produce realizations (samples) More...
 
const BaseVectorRealizer< V, M > & realizer () const
 Finds a realization (sample) of the PDF of this vector RV; access to private attribute m_realizer. More...
 
const BaseVectorCdf< V, M > & subCdf () const
 Finds the Cumulative Distribution Function of this vector RV, considering only the sub-sequence of data; access to private attribute m_subCdf. More...
 
const BaseVectorCdf< V, M > & unifiedCdf () const
 Finds the Cumulative Distribution Function of this vector RV, considering the unified sequence of data; access to private attribute m_unifiedCdf. More...
 
const BaseVectorMdf< V, M > & mdf () const
 Finds the Marginal Density Function of this vector RV; access to private attribute m_mdf. More...
 

Private Attributes

std::vector< const
BaseVectorRV< V, M > * > 
m_rvs
 
std::vector< const
BaseJointPdf< V, M > * > 
m_pdfs
 
std::vector< const
BaseVectorRealizer< V, M > * > 
m_realizers
 

Additional Inherited Members

- Protected Attributes inherited from QUESO::BaseVectorRV< V, M >
const BaseEnvironmentm_env
 
std::string m_prefix
 
const VectorSet< V, M > & m_imageSet
 
BaseJointPdf< V, M > * m_pdf
 
BaseVectorRealizer< V, M > * m_realizer
 
const BaseVectorCdf< V, M > * m_subCdf
 
const BaseVectorCdf< V, M > * m_unifiedCdf
 
const BaseVectorMdf< V, M > * m_mdf
 

Detailed Description

template<class V = GslVector, class M = GslMatrix>
class QUESO::ConcatenatedVectorRV< V, M >

A class representing concatenated vector RVs.

This class allows the user to concatenate two vector RV of different types and to generate realizations (samples) from this concatenated vector RV. It is used, for instance, to concatenate priors from two or more RVs, where one of them has a uniform distribution whereas the other one(s) has a Gaussian distribution.

Definition at line 53 of file ConcatenatedVectorRV.h.

Constructor & Destructor Documentation

template<class V , class M >
QUESO::ConcatenatedVectorRV< V, M >::ConcatenatedVectorRV ( const char *  prefix,
const BaseVectorRV< V, M > &  rv1,
const BaseVectorRV< V, M > &  rv2,
const VectorSet< V, M > &  imageSet 
)

Constructor.

Concatenates two RVs: rv1 and rv2 into one vector RV, given a prefix and the image set of the vector RV.

Definition at line 37 of file ConcatenatedVectorRV.C.

References QUESO::BaseEnvironment::displayVerbosity(), QUESO::BaseVectorRV< V, M >::m_env, QUESO::BaseVectorRV< V, M >::m_imageSet, QUESO::BaseVectorRV< V, M >::m_mdf, QUESO::BaseVectorRV< V, M >::m_pdf, QUESO::ConcatenatedVectorRV< V, M >::m_pdfs, QUESO::BaseVectorRV< V, M >::m_prefix, QUESO::BaseVectorRV< V, M >::m_realizer, QUESO::ConcatenatedVectorRV< V, M >::m_realizers, QUESO::ConcatenatedVectorRV< V, M >::m_rvs, QUESO::BaseVectorRV< V, M >::m_subCdf, QUESO::BaseVectorRV< V, M >::m_unifiedCdf, and QUESO::BaseEnvironment::subDisplayFile().

42  :
43  BaseVectorRV<V,M>(((std::string)(prefix)+"concat").c_str(),imageSet),
44  m_rvs (2,(const BaseVectorRV <V,M>*) NULL),
45  m_pdfs (2,(const BaseJointPdf <V,M>*) NULL),
46  m_realizers (2,(const BaseVectorRealizer<V,M>*) NULL)
47 {
48  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
49  *m_env.subDisplayFile() << "Entering ConcatenatedVectorRV<V,M>::constructor(1)"
50  << ": prefix = " << m_prefix
51  << std::endl;
52  }
53 
54  m_rvs[0] = &rv1;
55  m_rvs[1] = &rv2;
56  m_pdfs[0] = &(m_rvs[0]->pdf());
57  m_pdfs[1] = &(m_rvs[1]->pdf());
58  m_realizers[0] = m_rvs[0]->has_realizer() ?
59  &(m_rvs[0]->realizer()) : NULL;
60  m_realizers[1] = m_rvs[1]->has_realizer() ?
61  &(m_rvs[1]->realizer()) : NULL;
62 
63  m_pdf = new ConcatenatedJointPdf<V,M>(m_prefix.c_str(),
64  *(m_pdfs[0]),
65  *(m_pdfs[1]),
66  m_imageSet);
67 
68  // Iff we have all sub-realizers, we can make our own realizer
69  m_realizer = (m_rvs[0]->has_realizer() &&
70  m_rvs[1]->has_realizer()) ?
71  new ConcatenatedVectorRealizer<V,M>(m_prefix.c_str(),
72  *(m_realizers[0]),
73  *(m_realizers[1]),
74  m_imageSet) :
75  NULL;
76 
77  m_subCdf = NULL; // FIX ME: complete code
78  m_unifiedCdf = NULL; // FIX ME: complete code
79  m_mdf = NULL; // FIX ME: complete code
80 
81  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
82  *m_env.subDisplayFile() << "Leaving ConcatenatedVectorRV<V,M>::constructor(1)"
83  << ": prefix = " << m_prefix
84  << std::endl;
85  }
86 }
std::string m_prefix
Definition: VectorRV.h:118
const BaseVectorCdf< V, M > * m_unifiedCdf
Definition: VectorRV.h:123
std::vector< const BaseJointPdf< V, M > * > m_pdfs
const BaseEnvironment & m_env
Definition: VectorRV.h:117
const VectorSet< V, M > & imageSet() const
Image set of the vector RV; access to private attribute m_imageSet.
Definition: VectorRV.C:83
BaseVectorRealizer< V, M > * m_realizer
Definition: VectorRV.h:121
std::vector< const BaseVectorRV< V, M > * > m_rvs
BaseJointPdf< V, M > * m_pdf
Definition: VectorRV.h:120
std::vector< const BaseVectorRealizer< V, M > * > m_realizers
const BaseVectorCdf< V, M > * m_subCdf
Definition: VectorRV.h:122
unsigned int displayVerbosity() const
Definition: Environment.C:450
const VectorSet< V, M > & m_imageSet
Definition: VectorRV.h:119
const BaseVectorMdf< V, M > * m_mdf
Definition: VectorRV.h:124
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
template<class V , class M >
QUESO::ConcatenatedVectorRV< V, M >::ConcatenatedVectorRV ( const char *  prefix,
const std::vector< const BaseVectorRV< V, M > * > &  rvs,
const VectorSet< V, M > &  imageSet 
)

Constructor.

Concatenates a sequence of RVs, given by: std::vector<const BaseVectorRV<V,M>* >& rvs into one single vector RV, given a prefix and the image set of the resulting vector RV.

Definition at line 89 of file ConcatenatedVectorRV.C.

References QUESO::BaseEnvironment::displayVerbosity(), QUESO::BaseVectorRV< V, M >::has_realizer(), QUESO::BaseVectorRV< V, M >::m_env, QUESO::BaseVectorRV< V, M >::m_imageSet, QUESO::BaseVectorRV< V, M >::m_mdf, QUESO::BaseVectorRV< V, M >::m_pdf, QUESO::ConcatenatedVectorRV< V, M >::m_pdfs, QUESO::BaseVectorRV< V, M >::m_prefix, QUESO::BaseVectorRV< V, M >::m_realizer, QUESO::ConcatenatedVectorRV< V, M >::m_realizers, QUESO::ConcatenatedVectorRV< V, M >::m_rvs, QUESO::BaseVectorRV< V, M >::m_subCdf, QUESO::BaseVectorRV< V, M >::m_unifiedCdf, QUESO::BaseVectorRV< V, M >::realizer(), and QUESO::BaseEnvironment::subDisplayFile().

93  :
94  BaseVectorRV<V,M>(((std::string)(prefix)+"concat").c_str(),imageSet),
95  m_rvs (rvs.size(),(const BaseVectorRV <V,M>*) NULL),
96  m_pdfs (rvs.size(),(const BaseJointPdf <V,M>*) NULL),
97  m_realizers (rvs.size(),(const BaseVectorRealizer<V,M>*) NULL)
98 {
99  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
100  *m_env.subDisplayFile() << "Entering ConcatenatedVectorRV<V,M>::constructor(2)"
101  << ": prefix = " << m_prefix
102  << std::endl;
103  }
104 
105  bool have_all_subrealizers = true; // maybe
106  for (unsigned int i = 0; i < m_rvs.size(); ++i) {
107  m_rvs [i] = rvs[i];
108  m_pdfs[i] = &(m_rvs[i]->pdf());
109 
110  // If our sub-RV has no realizer, we leave our pointer to it set
111  // to NULL
112  if (m_rvs[i]->has_realizer())
113  m_realizers[i] = &(m_rvs[i]->realizer());
114  else
115  have_all_subrealizers = false;
116  }
117 
118  m_pdf = new ConcatenatedJointPdf<V,M>(m_prefix.c_str(),
119  m_pdfs,
120  m_imageSet);
121 
122  unsigned int minPeriod = std::numeric_limits<unsigned int>::max();
123  for (unsigned int i = 0; i < m_realizers.size(); ++i) {
124  if (m_realizers[i] && minPeriod > m_realizers[i]->subPeriod()) {
125  minPeriod = m_realizers[i]->subPeriod();
126  }
127  }
128 
129  m_realizer = have_all_subrealizers ?
130  new ConcatenatedVectorRealizer<V,M>(m_prefix.c_str(),
131  m_realizers,
132  minPeriod,
133  m_imageSet) :
134  NULL;
135  m_subCdf = NULL; // FIX ME: complete code
136  m_unifiedCdf = NULL; // FIX ME: complete code
137  m_mdf = NULL; // FIX ME: complete code
138 
139  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
140  *m_env.subDisplayFile() << "Leaving ConcatenatedVectorRV<V,M>::constructor(2)"
141  << ": prefix = " << m_prefix
142  << std::endl;
143  }
144 }
std::string m_prefix
Definition: VectorRV.h:118
const BaseVectorCdf< V, M > * m_unifiedCdf
Definition: VectorRV.h:123
std::vector< const BaseJointPdf< V, M > * > m_pdfs
const BaseEnvironment & m_env
Definition: VectorRV.h:117
const VectorSet< V, M > & imageSet() const
Image set of the vector RV; access to private attribute m_imageSet.
Definition: VectorRV.C:83
BaseVectorRealizer< V, M > * m_realizer
Definition: VectorRV.h:121
std::vector< const BaseVectorRV< V, M > * > m_rvs
BaseJointPdf< V, M > * m_pdf
Definition: VectorRV.h:120
std::vector< const BaseVectorRealizer< V, M > * > m_realizers
const BaseVectorCdf< V, M > * m_subCdf
Definition: VectorRV.h:122
unsigned int displayVerbosity() const
Definition: Environment.C:450
bool has_realizer() const
Returns true iff this RV has the ability to produce realizations (samples)
Definition: VectorRV.C:99
const BaseVectorRealizer< V, M > & realizer() const
Finds a realization (sample) of the PDF of this vector RV; access to private attribute m_realizer...
Definition: VectorRV.C:106
const VectorSet< V, M > & m_imageSet
Definition: VectorRV.h:119
const BaseVectorMdf< V, M > * m_mdf
Definition: VectorRV.h:124
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
template<class V , class M >
QUESO::ConcatenatedVectorRV< V, M >::~ConcatenatedVectorRV ( )
virtual

Virtual destructor.

Definition at line 147 of file ConcatenatedVectorRV.C.

148 {
149  delete m_mdf;
150  delete m_unifiedCdf;
151  delete m_subCdf;
152  delete m_realizer;
153  delete m_pdf;
154 }
const BaseVectorCdf< V, M > * m_unifiedCdf
Definition: VectorRV.h:123
BaseVectorRealizer< V, M > * m_realizer
Definition: VectorRV.h:121
BaseJointPdf< V, M > * m_pdf
Definition: VectorRV.h:120
const BaseVectorCdf< V, M > * m_subCdf
Definition: VectorRV.h:122
const BaseVectorMdf< V, M > * m_mdf
Definition: VectorRV.h:124

Member Function Documentation

template<class V , class M >
void QUESO::ConcatenatedVectorRV< V, M >::print ( std::ostream &  os) const
virtual

TODO: Prints the vector RV.

Todo:
: implement me!

Implements QUESO::BaseVectorRV< V, M >.

Definition at line 158 of file ConcatenatedVectorRV.C.

159 {
160  os << "ConcatenatedVectorRV<V,M>::print() says, 'Please implement me.'" << std::endl;
161  return;
162 }

Member Data Documentation

template<class V = GslVector, class M = GslMatrix>
std::vector<const BaseJointPdf <V,M>* > QUESO::ConcatenatedVectorRV< V, M >::m_pdfs
private
template<class V = GslVector, class M = GslMatrix>
std::vector<const BaseVectorRealizer<V,M>* > QUESO::ConcatenatedVectorRV< V, M >::m_realizers
private
template<class V = GslVector, class M = GslMatrix>
std::vector<const BaseVectorRV <V,M>* > QUESO::ConcatenatedVectorRV< V, M >::m_rvs
private

The documentation for this class was generated from the following files:

Generated on Tue Jun 5 2018 19:49:23 for queso-0.57.1 by  doxygen 1.8.5