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

A class for handling uniform joint PDFs. More...

#include <UniformJointPdf.h>

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

Public Member Functions

Constructor/Destructor methods
 UniformJointPdf (const char *prefix, const VectorSet< V, M > &domainSet)
 Constructor. More...
 
 ~UniformJointPdf ()
 Destructor. More...
 
Math methods
double actualValue (const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const
 Actual value of the uniform PDF. More...
 
double lnValue (const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const
 Logarithm of the value of the uniform PDF. More...
 
double computeLogOfNormalizationFactor (unsigned int numSamples, bool updateFactorInternally) const
 Computes the logarithm of the normalization factor. More...
 
- Public Member Functions inherited from QUESO::BaseJointPdf< V, M >
 BaseJointPdf (const char *prefix, const VectorSet< V, M > &domainSet)
 Default constructor. More...
 
virtual ~BaseJointPdf ()
 Destructor. More...
 
virtual void setNormalizationStyle (unsigned int value) const
 Sets a value to be used in the normalization style (stored in the protected attribute m_normalizationStyle.) More...
 
void setLogOfNormalizationFactor (double value) const
 Sets a logarithmic value to be used in the normalization factor (stored in the protected attribute m_normalizationStyle.) More...
 
- Public Member Functions inherited from QUESO::BaseScalarFunction< V, M >
 BaseScalarFunction (const char *prefix, const VectorSet< V, M > &domainSet)
 Default constructor. More...
 
virtual ~BaseScalarFunction ()
 Destructor. More...
 
const VectorSet< V, M > & domainSet () const
 Access to the protected attribute m_domainSet: domain set of the scalar function. More...
 

Additional Inherited Members

- Protected Member Functions inherited from QUESO::BaseJointPdf< V, M >
double commonComputeLogOfNormalizationFactor (unsigned int numSamples, bool updateFactorInternally) const
 Common method (to the derived classes) to compute the logarithm of the normalization factor. More...
 
- Protected Attributes inherited from QUESO::BaseJointPdf< V, M >
unsigned int m_normalizationStyle
 
double m_logOfNormalizationFactor
 
- Protected Attributes inherited from QUESO::BaseScalarFunction< V, M >
const BaseEnvironmentm_env
 
std::string m_prefix
 
const VectorSet< V, M > & m_domainSet
 Domain set of the scalar function. More...
 

Detailed Description

template<class V, class M>
class QUESO::UniformJointPdf< V, M >

A class for handling uniform joint PDFs.

This class allows the mathematical definition of a Uniform Joint PDF.

Definition at line 49 of file UniformJointPdf.h.

Constructor & Destructor Documentation

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

Constructor.

Constructs a new object of the class, given a prefix and the domain set of the uniform PDF.

Definition at line 33 of file UniformJointPdf.C.

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

36  :
37  BaseJointPdf<V,M>(((std::string)(prefix)+"uni").c_str(),
38  domainSet)
39 {
40  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
41  *m_env.subDisplayFile() << "Entering UniformJointPdf<V,M>::constructor()"
42  << ": prefix = " << m_prefix
43  << std::endl;
44  }
45 
46  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
47  *m_env.subDisplayFile() << "Leaving UniformJointPdf<V,M>::constructor()"
48  << ": prefix = " << m_prefix
49  << std::endl;
50  }
51 }
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:305
const VectorSet< V, M > & domainSet() const
Access to the protected attribute m_domainSet: domain set of the scalar function. ...
const BaseEnvironment & m_env
unsigned int displayVerbosity() const
Definition: Environment.C:436
template<class V , class M >
QUESO::UniformJointPdf< V, M >::~UniformJointPdf ( )

Destructor.

Definition at line 54 of file UniformJointPdf.C.

55 {
56 }

Member Function Documentation

template<class V , class M >
double QUESO::UniformJointPdf< V, M >::actualValue ( const V &  domainVector,
const V *  domainDirection,
V *  gradVector,
M *  hessianMatrix,
V *  hessianEffect 
) const
virtual

Actual value of the uniform PDF.

If the domain of the PDF is well defined (neither negative nor infinite), then the actual value is given by 1.0/(the volume of the domain), otherwise the actual value is 1.

Implements QUESO::BaseJointPdf< V, M >.

Definition at line 60 of file UniformJointPdf.C.

References UQ_FATAL_TEST_MACRO.

66 {
67  UQ_FATAL_TEST_MACRO(domainVector.sizeLocal() != this->m_domainSet.vectorSpace().dimLocal(),
68  m_env.worldRank(),
69  "UniformJointPdf<V,M>::actualValue()",
70  "invalid input");
71 
72  if (gradVector ) *gradVector = m_domainSet.vectorSpace().zeroVector();
73  if (hessianMatrix) *hessianMatrix *= 0.;
74  if (hessianEffect) *hessianEffect = m_domainSet.vectorSpace().zeroVector();
75 
76  if (domainDirection) {}; // just to remove compiler warning
77 
78  double volume = m_domainSet.volume();
79  if (((boost::math::isnan)(volume)) ||
80  (volume == -INFINITY ) ||
81  (volume == INFINITY ) ||
82  (volume <= 0. ) ||
83  (m_normalizationStyle != 0 )) {
84  volume = 1.;
85  }
86 
87  return 1./volume; // No need to multiply by exp(m_logOfNormalizationFactor) [PDF-04]
88 }
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
unsigned int m_normalizationStyle
Definition: JointPdf.h:103
const VectorSet< V, M > & m_domainSet
Domain set of the scalar function.
const BaseEnvironment & m_env
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
template<class V , class M >
double QUESO::UniformJointPdf< V, M >::computeLogOfNormalizationFactor ( unsigned int  numSamples,
bool  updateFactorInternally 
) const
virtual

Computes the logarithm of the normalization factor.

This routine calls BaseJointPdf::commonComputeLogOfNormalizationFactor().

Implements QUESO::BaseJointPdf< V, M >.

Definition at line 120 of file UniformJointPdf.C.

References QUESO::BaseJointPdf< V, M >::commonComputeLogOfNormalizationFactor().

121 {
122  double value = 0.;
123 
124  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
125  *m_env.subDisplayFile() << "Entering UniformJointPdf<V,M>::computeLogOfNormalizationFactor()"
126  << std::endl;
127  }
128  value = BaseJointPdf<V,M>::commonComputeLogOfNormalizationFactor(numSamples, updateFactorInternally);
129  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
130  *m_env.subDisplayFile() << "Leaving UniformJointPdf<V,M>::computeLogOfNormalizationFactor()"
131  << ", m_logOfNormalizationFactor = " << m_logOfNormalizationFactor
132  << std::endl;
133  }
134 
135  return value;
136 }
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:305
double m_logOfNormalizationFactor
Definition: JointPdf.h:104
const BaseEnvironment & m_env
double commonComputeLogOfNormalizationFactor(unsigned int numSamples, bool updateFactorInternally) const
Common method (to the derived classes) to compute the logarithm of the normalization factor...
Definition: JointPdf.C:77
unsigned int displayVerbosity() const
Definition: Environment.C:436
template<class V , class M >
double QUESO::UniformJointPdf< V, M >::lnValue ( const V &  domainVector,
const V *  domainDirection,
V *  gradVector,
M *  hessianMatrix,
V *  hessianEffect 
) const
virtual

Logarithm of the value of the uniform PDF.

Analogous to the actualValue routine, except that the logarithm of the calculated value is returned.

Implements QUESO::BaseJointPdf< V, M >.

Definition at line 92 of file UniformJointPdf.C.

98 {
99  if (gradVector ) *gradVector = m_domainSet.vectorSpace().zeroVector();
100  if (hessianMatrix) *hessianMatrix *= 0.;
101  if (hessianEffect) *hessianEffect = m_domainSet.vectorSpace().zeroVector();
102 
103  if (domainVector[0]) {}; // just to remove compiler warning
104  if (domainDirection) {}; // just to remove compiler warning
105 
106  double volume = m_domainSet.volume();
107  if (((boost::math::isnan)(volume)) ||
108  (volume == -INFINITY ) ||
109  (volume == INFINITY ) ||
110  (volume <= 0. ) ||
111  (m_normalizationStyle != 0 )) {
112  volume = 1.;
113  }
114 
115  return log(volume); // No need to add m_logOfNormalizationFactor [PDF-04]
116 }
unsigned int m_normalizationStyle
Definition: JointPdf.h:103
const VectorSet< V, M > & m_domainSet
Domain set of the scalar function.

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