queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
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 >:
QUESO::BaseVectorRealizer< V, M >

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 = GslVector, class M = GslMatrix>
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 46 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 34 of file JeffreysVectorRealizer.C.

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

37  :
38  BaseVectorRealizer<V,M>(((std::string)(prefix)+"gen").c_str(),unifiedImageSet,std::numeric_limits<unsigned int>::max())
39 {
40  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
41  *m_env.subDisplayFile() << "Entering JeffreysVectorRealizer<V,M>::constructor()"
42  << ": prefix = " << m_prefix
43  << std::endl;
44  }
45 
46  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
47  *m_env.subDisplayFile() << "Leaving JeffreysVectorRealizer<V,M>::constructor()"
48  << ": prefix = " << m_prefix
49  << std::endl;
50  }
51 }
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::JeffreysVectorRealizer< V, M >::~JeffreysVectorRealizer ( )

Destructor.

Definition at line 54 of file JeffreysVectorRealizer.C.

55 {
56 }

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 60 of file JeffreysVectorRealizer.C.

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

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