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

A class representing a vector RV constructed via Gamma distribution. More...

#include <GammaVectorRV.h>

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

Public Member Functions

Constructor/Destructor methods
 GammaVectorRV (const char *prefix, const VectorSet< V, M > &imageSet, const V &a, const V &b)
 Default Constructor. More...
 
virtual ~GammaVectorRV ()
 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...
 

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

A class representing a vector RV constructed via Gamma distribution.

This class allows the user to compute the value of a Gamma PDF and to generate realizations (samples) from it.

The gamma probability density function for a given value x and given pair of parameters a and b is:

\[ y = f(x|a,b) = \frac{1}{b^{a}\Gamma(a)} x^{a-1} e^{\frac{x}{b}}, \]

where \( \Gamma(.) \) is the Gamma function:

\[ B(a,b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)} = \frac{(a-1)!(b-1)!}{(a+b-1)!}. \]

The parameters a and b are shape and scale parameters and must all be positive, and the values x must lie on the interval \( (0, \infty)\).

Definition at line 64 of file GammaVectorRV.h.

Constructor & Destructor Documentation

template<class V , class M >
QUESO::GammaVectorRV< V, M >::GammaVectorRV ( const char *  prefix,
const VectorSet< V, M > &  imageSet,
const V &  a,
const V &  b 
)

Default Constructor.

Construct a Gamma vector RV with parameters a>0 and b>0, whose variates live in imageSet. The constructor will check whether or not the data provided via imageSet belongs to \( (0, \infty)\), which is a requirement imposed by the Gamma distribution. If this condition is not satisfied, an error message will be displayed and the program will exit.

Definition at line 36 of file GammaVectorRV.C.

References QUESO::BaseEnvironment::displayVerbosity(), QUESO::BaseVectorRV< V, M >::imageSet(), 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::BaseVectorRV< V, M >::m_prefix, QUESO::BaseVectorRV< V, M >::m_realizer, QUESO::BaseVectorRV< V, M >::m_subCdf, QUESO::BaseVectorRV< V, M >::m_unifiedCdf, QUESO::BoxSubset< V, M >::maxValues(), QUESO::BoxSubset< V, M >::minValues(), and QUESO::BaseEnvironment::subDisplayFile().

41  :
42  BaseVectorRV<V,M>(((std::string)(prefix)+"uni").c_str(),imageSet)
43 {
44  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
45  *m_env.subDisplayFile() << "Entering GammaVectorRV<V,M>::constructor()"
46  << ": prefix = " << m_prefix
47  << std::endl;
48  }
49 
50 // begin kemelli 2013-April-22 --------------------------
51 // better to check for the parameter values in the constructor,
52 // rather than in GammaVectorRealizer<V,M>::realization
53 
54  const BoxSubset<V,M>* imageBox = dynamic_cast<const BoxSubset<V,M>* >(&imageSet);
55  double smallerOfMaxValues = imageBox->maxValues().getMinValue();
56  double smallerOfMinValues = imageBox->minValues().getMinValue();
57 
58  // Gamma dist is defined only in (0,inf)
59  if( smallerOfMinValues < 0 )
60  {
61  std::cerr << "In GammaVectorRV<V,M>::constructor()\n"
62  << "Gamma distribution is only defined in (0, infinity).\n"
63  << "The data provided is: \n"
64  << *imageBox
65  << "Sampling will not cover all interval.\n"
66  << std::endl;
67 
68  queso_require_greater_equal_msg(smallerOfMaxValues, 0, "invalid input: Gamma distribution is only defined in (0, infinity), and min(m_maxValues)<0");
69  }
70 // end kemelli 2013-April-22 --------------------------
71 
72  m_pdf = new GammaJointPdf<V,M>(m_prefix.c_str(),
73  m_imageSet,
74  a,
75  b);
76  m_realizer = new GammaVectorRealizer<V,M>(m_prefix.c_str(),
77  m_imageSet,
78  a,
79  b);
80 
81  m_subCdf = NULL; // FIX ME: complete code
82  m_unifiedCdf = NULL; // FIX ME: complete code
83  m_mdf = NULL; // FIX ME: complete code
84 
85  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
86  *m_env.subDisplayFile() << "Leaving GammaVectorRV<V,M>::constructor()"
87  << ": prefix = " << m_prefix
88  << std::endl;
89  }
90 }
std::string m_prefix
Definition: VectorRV.h:118
const BaseVectorCdf< V, M > * m_unifiedCdf
Definition: VectorRV.h:123
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
BaseJointPdf< V, M > * m_pdf
Definition: VectorRV.h:120
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::GammaVectorRV< V, M >::~GammaVectorRV ( )
virtual

Virtual destructor.

Definition at line 93 of file GammaVectorRV.C.

94 {
95  delete m_mdf;
96  delete m_unifiedCdf;
97  delete m_subCdf;
98  delete m_realizer;
99  delete m_pdf;
100 }
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::GammaVectorRV< V, M >::print ( std::ostream &  os) const
virtual

TODO: Prints the vector RV.

Todo:
: implement me!

Implements QUESO::BaseVectorRV< V, M >.

Definition at line 104 of file GammaVectorRV.C.

105 {
106  os << "GammaVectorRV<V,M>::print() says, 'Please implement me.'" << std::endl;
107  return;
108 }

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

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