queso-0.51.1
List of all members
QUESO::JeffreysVectorRealizer< V, M > Class Template Reference

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

#include <JeffreysVectorRealizer.h>

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

Public Member Functions

Constructor/Destructor methods
 JeffreysVectorRealizer (const char *prefix, const VectorSet< V, M > &unifiedImageSet)
 Constructor. More...
 
 ~JeffreysVectorRealizer ()
 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, class M>
class QUESO::JeffreysVectorRealizer< V, M >

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

This class handles sampling from a jeffreys probability density distribution.

Definition at line 43 of file JeffreysVectorRealizer.h.

Constructor & Destructor Documentation

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

Constructor.

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

Definition at line 33 of file JeffreysVectorRealizer.C.

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

36  :
37  BaseVectorRealizer<V,M>(((std::string)(prefix)+"gen").c_str(),unifiedImageSet,std::numeric_limits<unsigned int>::max())
38 {
39  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
40  *m_env.subDisplayFile() << "Entering JeffreysVectorRealizer<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 JeffreysVectorRealizer<V,M>::constructor()"
47  << ": prefix = " << m_prefix
48  << std::endl;
49  }
50 }
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:305
const BaseEnvironment & m_env
unsigned int displayVerbosity() const
Definition: Environment.C:436
const VectorSet< V, M > & unifiedImageSet() const
Image set where the realizations lie. Access to protected attribute m_unifiedImageSet.
template<class V , class M >
QUESO::JeffreysVectorRealizer< V, M >::~JeffreysVectorRealizer ( )

Destructor.

Definition at line 53 of file JeffreysVectorRealizer.C.

54 {
55 }

Member Function Documentation

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

Draws a realization.

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

Implements QUESO::BaseVectorRealizer< V, M >.

Definition at line 59 of file JeffreysVectorRealizer.C.

References QUESO::BoxSubset< V, M >::maxValues(), QUESO::BoxSubset< V, M >::minValues(), and queso_error_msg.

60 {
61  const BoxSubset<V,M>* imageBox = dynamic_cast<const BoxSubset<V,M>* >(&m_unifiedImageSet);
62 
63  if (imageBox == NULL) {
64  queso_error_msg("For JeffreysVectorRealizer<V,M>::realization(), only box images are supported right now");
65  }
66  //take log of Jeffreys bounds to set uniform bounds
67  GslVector logMinValues(imageBox->minValues());
68  for (unsigned int i = 0; i < logMinValues.sizeLocal(); ++i) {
69  if (logMinValues[i] < 0.0) {
70  queso_error_msg("The minimum value for a Jeffreys distribution should be greater than or equal to zero.");
71  }
72  else {
73  logMinValues[i] = std::log(logMinValues[i]);
74  }
75  }
76 
77  GslVector logMaxValues(imageBox->maxValues());
78  for (unsigned int i = 0; i < logMaxValues.sizeLocal(); ++i) {
79  if (logMaxValues[i] <= 0.0) {
80  queso_error_msg("The maximum value for a Jeffreys distribution should be greater than zero.");
81  }
82  else {
83  logMaxValues[i] = std::log(logMaxValues[i]);
84  }
85  }
86 
87  nextValues.cwSetUniform(logMinValues,logMaxValues);
88  for (unsigned int i = 0; i < nextValues.sizeLocal(); ++i) {
89  nextValues[i] = std::exp(nextValues[i]);
90  }
91  return;
92 }
const VectorSet< V, M > & m_unifiedImageSet
#define queso_error_msg(msg)
Definition: asserts.h:91

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

Generated on Thu Apr 23 2015 19:26:18 for queso-0.51.1 by  doxygen 1.8.5