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

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

#include <BetaVectorRV.h>

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

Public Member Functions

Constructor/Destructor methods
 BetaVectorRV (const char *prefix, const VectorSet< V, M > &imageSet, const V &alpha, const V &beta)
 Default Constructor. More...
 
virtual ~BetaVectorRV ()
 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 >
 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...
 
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 Mass 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, class M>
class QUESO::BetaVectorRV< V, M >

A class representing a vector RV constructed via Beta distribution.

This class allows the user to compute the value of a Beta PDF and to generate realizations (samples) from it.
The beta 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,b)} x^{a-1}(1-x)^{b-1}, \]

where B(ยท) is the Beta 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 must all be positive, and the values x must lie on the interval [0, 1].

Definition at line 61 of file BetaVectorRV.h.

Constructor & Destructor Documentation

template<class V , class M >
QUESO::BetaVectorRV< V, M >::BetaVectorRV ( const char *  prefix,
const VectorSet< V, M > &  imageSet,
const V &  alpha,
const V &  beta 
)

Default Constructor.

Construct a Beta 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,1], which is a requirement imposed by the Beta distribution. If this condition is not satisfied, an error message will be displayed and the program will exit.

Definition at line 36 of file BetaVectorRV.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(), QUESO::BaseEnvironment::subDisplayFile(), UQ_FATAL_TEST_MACRO, and QUESO::BaseEnvironment::worldRank().

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 BetaVectorRV<V,M>::constructor()"
46  << ": prefix = " << m_prefix
47  << std::endl;
48  }
49 
50 // begin kemelli 2013-April-22 : --------------------------
51 
52  const BoxSubset<V,M>* imageBox = dynamic_cast<const BoxSubset<V,M>* >(&imageSet);
53 
54  double smallerOfMaxValues = imageBox->maxValues().getMinValue();
55  double biggerOfMaxValues = imageBox->maxValues().getMaxValue();
56  double smallerOfMinValues = imageBox->minValues().getMinValue();
57  double biggerOfMinValues = imageBox->minValues().getMaxValue();
58 
59  // Beta dist is defined only in [0,1]
60  if( (smallerOfMinValues < 0) || ( biggerOfMaxValues > 1 ) )
61  {
62  std::cerr << "In BetaVectorRV<V,M>::constructor()\n"
63  << "Beta distribution is defined only in [0, 1].\n"
64  << "The data provided is: \n"
65  << *imageBox
66  << "Sampling will not cover all interval.\n"
67  << std::endl;
68 
69  // if at least one of the min values > 1 then exit
70  UQ_FATAL_TEST_MACRO(biggerOfMinValues > 1,
71  m_env.worldRank(),
72  "In BetaVectorRV<V,M>::constructor()",
73  "invalid input: Beta distribution is only defined in [0, 1], and max(m_minValues)>1");
74  // if at least one of the max values < 0 then exit
75  UQ_FATAL_TEST_MACRO(smallerOfMaxValues < 0, //biggerOfMaxValues
76  m_env.worldRank(),
77  "In BetaVectorRV<V,M>::constructor()",
78  "invalid input: Beta distribution is only defined in [0, 1], and min(m_maxValues)<0");
79  }
80  // end kemelli 2013-April-22 --------------------------
81 
82  m_pdf = new BetaJointPdf<V,M>(m_prefix.c_str(),
83  m_imageSet,
84  alpha,
85  beta);
86  m_realizer = new BetaVectorRealizer<V,M>(m_prefix.c_str(),
87  m_imageSet,
88  alpha,
89  beta);
90  m_subCdf = NULL; // FIX ME: complete code
91  m_unifiedCdf = NULL; // FIX ME: complete code
92  m_mdf = NULL; // FIX ME: complete code
93 
94  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
95  *m_env.subDisplayFile() << "Leaving BetaVectorRV<V,M>::constructor()"
96  << ": prefix = " << m_prefix
97  << std::endl;
98  }
99 }
const BaseVectorCdf< V, M > * m_unifiedCdf
Definition: VectorRV.h:118
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:305
const VectorSet< V, M > & m_imageSet
Definition: VectorRV.h:114
const BaseEnvironment & m_env
Definition: VectorRV.h:112
const BaseVectorCdf< V, M > * m_subCdf
Definition: VectorRV.h:117
BaseVectorRealizer< V, M > * m_realizer
Definition: VectorRV.h:116
const VectorSet< V, M > & imageSet() const
Image set of the vector RV; access to private attribute m_imageSet.
Definition: VectorRV.C:79
unsigned int displayVerbosity() const
Definition: Environment.C:436
const BaseVectorMdf< V, M > * m_mdf
Definition: VectorRV.h:119
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
std::string m_prefix
Definition: VectorRV.h:113
BaseJointPdf< V, M > * m_pdf
Definition: VectorRV.h:115
template<class V , class M >
QUESO::BetaVectorRV< V, M >::~BetaVectorRV ( )
virtual

Virtual destructor.

Definition at line 102 of file BetaVectorRV.C.

103 {
104  delete m_mdf;
105  delete m_unifiedCdf;
106  delete m_subCdf;
107  delete m_realizer;
108  delete m_pdf;
109 }
const BaseVectorCdf< V, M > * m_unifiedCdf
Definition: VectorRV.h:118
const BaseVectorCdf< V, M > * m_subCdf
Definition: VectorRV.h:117
BaseVectorRealizer< V, M > * m_realizer
Definition: VectorRV.h:116
const BaseVectorMdf< V, M > * m_mdf
Definition: VectorRV.h:119
BaseJointPdf< V, M > * m_pdf
Definition: VectorRV.h:115

Member Function Documentation

template<class V , class M >
void QUESO::BetaVectorRV< V, M >::print ( std::ostream &  os) const
virtual

TODO: Prints the vector RV.

Todo:
: implement me!

Implements QUESO::BaseVectorRV< V, M >.

Definition at line 113 of file BetaVectorRV.C.

114 {
115  os << "BetaVectorRV<V,M>::print() says, 'Please implement me.'" << std::endl;
116  return;
117 }

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

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