queso-0.53.0
Private Attributes | List of all members
QUESO::ConcatenatedVectorRealizer< V, M > Class Template Reference

A class for handling sampling from concatenated probability density distributions. More...

#include <ConcatenatedVectorRealizer.h>

Inheritance diagram for QUESO::ConcatenatedVectorRealizer< V, M >:
Inheritance graph
[legend]
Collaboration diagram for QUESO::ConcatenatedVectorRealizer< V, M >:
Collaboration graph
[legend]

Public Member Functions

Constructor/Destructor methods
 ConcatenatedVectorRealizer (const char *prefix, const BaseVectorRealizer< V, M > &realizer1, const BaseVectorRealizer< V, M > &realizer2, const VectorSet< V, M > &unifiedImageSet)
 Constructor. More...
 
 ConcatenatedVectorRealizer (const char *prefix, const std::vector< const BaseVectorRealizer< V, M > * > &realizers, unsigned int minPeriod, const VectorSet< V, M > &unifiedImageSet)
 Constructor. More...
 
 ~ConcatenatedVectorRealizer ()
 Destructor. More...
 
Realization-related methods
void realization (V &nextValues) const
 Performs a realization (sample) from a probability density function. See template specialization. More...
 
- Public Member Functions inherited from QUESO::BaseVectorRealizer< V, M >
 BaseVectorRealizer (const char *prefix, const VectorSet< V, M > &unifiedImageSet, unsigned int subPeriod)
 Default constructor. More...
 
virtual ~BaseVectorRealizer ()
 Virtual destructor. More...
 
const VectorSet< V, M > & unifiedImageSet () const
 Image set where the realizations lie. Access to protected attribute m_unifiedImageSet. More...
 
unsigned int subPeriod () const
 Sub-period of the realization. Access to protected attribute m_subPeriod. More...
 

Private Attributes

std::vector< const
BaseVectorRealizer< V, M > * > 
m_realizers
 

Additional Inherited Members

- Protected Attributes inherited from QUESO::BaseVectorRealizer< V, M >
const BaseEnvironmentm_env
 
std::string m_prefix
 
const VectorSet< V, M > & m_unifiedImageSet
 
unsigned int m_subPeriod
 

Detailed Description

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

A class for handling sampling from concatenated probability density distributions.

This class allows the user draw samples from concatenated probability density distributions (two or more distinct probability distributions has(ve) been concatenated into one single vector RV). This class used, for instance, to draw realization of 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 51 of file ConcatenatedVectorRealizer.h.

Constructor & Destructor Documentation

template<class V , class M >
QUESO::ConcatenatedVectorRealizer< V, M >::ConcatenatedVectorRealizer ( const char *  prefix,
const BaseVectorRealizer< V, M > &  realizer1,
const BaseVectorRealizer< V, M > &  realizer2,
const VectorSet< V, M > &  unifiedImageSet 
)

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 33 of file ConcatenatedVectorRealizer.C.

References QUESO::BaseEnvironment::displayVerbosity(), QUESO::BaseVectorRealizer< V, M >::m_env, QUESO::BaseVectorRealizer< V, M >::m_prefix, QUESO::ConcatenatedVectorRealizer< V, M >::m_realizers, and QUESO::BaseEnvironment::subDisplayFile().

38  :
39  BaseVectorRealizer<V,M>( ((std::string)(prefix)+"gen").c_str(),unifiedImageSet,std::min(realizer1.subPeriod(),realizer2.subPeriod()) ), // 2011/Oct/02
40  m_realizers(2,(const BaseVectorRealizer<V,M>*) NULL)
41 {
42  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
43  *m_env.subDisplayFile() << "Entering ConcatenatedVectorRealizer<V,M>::constructor()"
44  << ": prefix = " << m_prefix
45  << std::endl;
46  }
47 
48  m_realizers[0] = &realizer1;
49  m_realizers[1] = &realizer2;
50 
51  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
52  *m_env.subDisplayFile() << "Leaving ConcatenatedVectorRealizer<V,M>::constructor()"
53  << ": prefix = " << m_prefix
54  << std::endl;
55  }
56 }
unsigned int displayVerbosity() const
Definition: Environment.C:396
std::vector< const BaseVectorRealizer< V, M > * > m_realizers
const BaseEnvironment & m_env
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
const VectorSet< V, M > & unifiedImageSet() const
Image set where the realizations lie. Access to protected attribute m_unifiedImageSet.
template<class V , class M >
QUESO::ConcatenatedVectorRealizer< V, M >::ConcatenatedVectorRealizer ( const char *  prefix,
const std::vector< const BaseVectorRealizer< V, M > * > &  realizers,
unsigned int  minPeriod,
const VectorSet< V, M > &  unifiedImageSet 
)

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 59 of file ConcatenatedVectorRealizer.C.

References QUESO::ConcatenatedVectorRealizer< V, M >::m_realizers.

64  :
65  BaseVectorRealizer<V,M>( ((std::string)(prefix)+"gen").c_str(),unifiedImageSet,minPeriod),
66  m_realizers(realizers.size(),(const BaseVectorRealizer<V,M>*) NULL)
67 {
68  for (unsigned int i = 0; i < m_realizers.size(); ++i) {
69  m_realizers[i] = realizers[i];
70  }
71 }
std::vector< const BaseVectorRealizer< V, M > * > m_realizers
const VectorSet< V, M > & unifiedImageSet() const
Image set where the realizations lie. Access to protected attribute m_unifiedImageSet.
template<class V , class M >
QUESO::ConcatenatedVectorRealizer< V, M >::~ConcatenatedVectorRealizer ( )

Destructor.

Definition at line 74 of file ConcatenatedVectorRealizer.C.

75 {
76 }

Member Function Documentation

template<class V , class M >
void QUESO::ConcatenatedVectorRealizer< V, M >::realization ( V &  nextValues) const
virtual

Performs a realization (sample) from a probability density function. See template specialization.

Implements QUESO::BaseVectorRealizer< V, M >.

Definition at line 80 of file ConcatenatedVectorRealizer.C.

81 {
82  std::vector<V*> vecs(m_realizers.size(),(V*)NULL);
83  for (unsigned int i = 0; i < vecs.size(); ++i) {
84  vecs[i] = new V(m_realizers[i]->unifiedImageSet().vectorSpace().zeroVector());
85  //std::cout << "In ConcatenatedVectorRealizer<V,M>::realization: v[i]->sizeLocal() = " << v[i]->sizeLocal() << std::endl;
86  m_realizers[i]->realization(*(vecs[i]));
87  }
88 
89  //std::cout << "In ConcatenatedVectorRealizer<V,M>::realization: nextValues.sizeLocal() = " << nextValues.sizeLocal() << std::endl;
90  std::vector<const V*> constVecs(m_realizers.size(),(V*)NULL);
91  for (unsigned int i = 0; i < vecs.size(); ++i) {
92  constVecs[i] = vecs[i];
93  }
94  nextValues.cwSetConcatenated(constVecs);
95  //std::cout << "In ConcatenatedVectorRealizer<V,M>::realization: succeeded" << std::endl;
96 
97  for (unsigned int i = 0; i < vecs.size(); ++i) {
98  delete vecs[i];
99  }
100 
101  return;
102 }
std::vector< const BaseVectorRealizer< V, M > * > m_realizers
const VectorSet< V, M > & unifiedImageSet() const
Image set where the realizations lie. Access to protected attribute m_unifiedImageSet.

Member Data Documentation

template<class V = GslVector, class M = GslMatrix>
std::vector<const BaseVectorRealizer<V,M>* > QUESO::ConcatenatedVectorRealizer< V, M >::m_realizers
private

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

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