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

A class for handling sampling from a Uniform probability density distribution. More...

#include <UniformVectorRealizer.h>

Inheritance diagram for QUESO::UniformVectorRealizer< V, M >:
QUESO::BaseVectorRealizer< V, M >

Public Member Functions

Constructor/Destructor methods
 UniformVectorRealizer (const char *prefix, const VectorSet< V, M > &unifiedImageSet)
 Constructor. More...
 
 ~UniformVectorRealizer ()
 Destructor. More...
 
Realization-related methods
void realization (V &nextValues) const
 Draws a realization. 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...
 

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::UniformVectorRealizer< V, M >

A class for handling sampling from a Uniform probability density distribution.

This class handles sampling from a uniform probability density distribution.

Definition at line 45 of file UniformVectorRealizer.h.

Constructor & Destructor Documentation

template<class V , class M >
QUESO::UniformVectorRealizer< V, M >::UniformVectorRealizer ( const char *  prefix,
const VectorSet< V, M > &  unifiedImageSet 
)

Constructor.

Constructs a new object, given a prefix and the image set of the vector realizer.

Note: If unifiedImageSet is unbounded, it does not make sense to ask for realizations.

Definition at line 35 of file UniformVectorRealizer.C.

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

38  :
39  BaseVectorRealizer<V,M>(((std::string)(prefix)+"gen").c_str(),unifiedImageSet,std::numeric_limits<unsigned int>::max())
40 {
41  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
42  *m_env.subDisplayFile() << "Entering UniformVectorRealizer<V,M>::constructor()"
43  << ": prefix = " << m_prefix
44  << std::endl;
45  }
46 
47  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
48  *m_env.subDisplayFile() << "Leaving UniformVectorRealizer<V,M>::constructor()"
49  << ": prefix = " << m_prefix
50  << std::endl;
51  }
52 }
const BaseEnvironment & m_env
const VectorSet< V, M > & unifiedImageSet() const
Image set where the realizations lie. Access to protected attribute m_unifiedImageSet.
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
template<class V , class M >
QUESO::UniformVectorRealizer< V, M >::~UniformVectorRealizer ( )

Destructor.

Definition at line 55 of file UniformVectorRealizer.C.

56 {
57 }

Member Function Documentation

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

Draws a realization.

This function draws a realization of a uniform distribution and saves it in nextValues. It internally finds the minimum and the maximum values of the distribution.

Note: If the state space is unbounded, the distribution is improper and realizations do not make sense.

Implements QUESO::BaseVectorRealizer< V, M >.

Definition at line 61 of file UniformVectorRealizer.C.

References QUESO::BoxSubset< V, M >::maxValues(), QUESO::BoxSubset< V, M >::minValues(), QUESO::queso_isfinite(), and QUESO::VectorSet< V, M >::volume().

62 {
63  const BoxSubset<V,M>* imageBox = dynamic_cast<const BoxSubset<V,M>* >(&m_unifiedImageSet);
64 
65  queso_require_msg(imageBox, "only box images are supported right now");
66  queso_require_msg(queso_isfinite(imageBox->volume()), "drawing realisations from an improper uniform is not supported");
67 
68  nextValues.cwSetUniform(imageBox->minValues(),imageBox->maxValues());
69 }
bool queso_isfinite(T arg)
Definition: math_macros.h:51
const VectorSet< V, M > & m_unifiedImageSet

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

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