queso-0.51.1
Protected Attributes | List of all members
QUESO::PoweredJointPdf< V, M > Class Template Reference

A class for handling a powered joint PDFs. More...

#include <PoweredJointPdf.h>

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

Public Member Functions

Constructor/Destructor methods
 PoweredJointPdf (const char *prefix, const BaseJointPdf< V, M > &srcDensity, double exponent)
 Constructor. More...
 
 ~PoweredJointPdf ()
 Destructor. More...
 
Math methods
double actualValue (const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const
 Actual value of the powered PDF. More...
 
double lnValue (const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const
 Logarithm of the value of the powered PDF. More...
 
void setNormalizationStyle (unsigned int value) const
 Sets a value to be used in the normalization style of the powered PDF (ie, protected attribute m_srcDensity). More...
 
double computeLogOfNormalizationFactor (unsigned int numSamples, bool updateFactorInternally) const
 TODO: 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...
 
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...
 

Protected Attributes

const BaseJointPdf< V, M > & m_srcDensity
 
double m_exponent
 
- 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...
 

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...
 

Detailed Description

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

A class for handling a powered joint PDFs.

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

Definition at line 49 of file PoweredJointPdf.h.

Constructor & Destructor Documentation

template<class V , class M >
QUESO::PoweredJointPdf< V, M >::PoweredJointPdf ( const char *  prefix,
const BaseJointPdf< V, M > &  srcDensity,
double  exponent 
)

Constructor.

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

Definition at line 33 of file PoweredJointPdf.C.

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

37  :
38  BaseJointPdf<V,M>(((std::string)(prefix)+"pow").c_str(),srcDensity.domainSet()),
39  m_srcDensity (srcDensity),
40  m_exponent (exponent)
41 {
42  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
43  *m_env.subDisplayFile() << "Entering PoweredJointPdf<V,M>::constructor()"
44  << ": prefix = " << m_prefix
45  << std::endl;
46  }
47 
48  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
49  *m_env.subDisplayFile() << "In PoweredJointPdf<V,M>::constructor()"
50  //<< ", prefix = " << m_prefix
51  << std::endl;
52  }
53 
54  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
55  *m_env.subDisplayFile() << "Leaving PoweredJointPdf<V,M>::constructor()"
56  << ": prefix = " << m_prefix
57  << std::endl;
58  }
59 }
const BaseJointPdf< V, M > & m_srcDensity
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
template<class V , class M >
QUESO::PoweredJointPdf< V, M >::~PoweredJointPdf ( )

Destructor.

Definition at line 62 of file PoweredJointPdf.C.

63 {
64 }

Member Function Documentation

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

Actual value of the powered PDF.

Finds the actual value using BaseJointPdf::actualValue() and apply it to the power of this PDF, which given by exponent, and multiplies it by the normalization factor, which is given by exp(m_logOfNormalizationFactor).

Implements QUESO::BaseJointPdf< V, M >.

Definition at line 76 of file PoweredJointPdf.C.

References UQ_FATAL_TEST_MACRO.

82 {
83  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
84  *m_env.subDisplayFile() << "Entering PoweredJointPdf<V,M>::actualValue()"
85  << ": domainVector = " << domainVector
86  << std::endl;
87  }
88 
89  UQ_FATAL_TEST_MACRO(domainVector.sizeLocal() != this->m_domainSet.vectorSpace().dimLocal(),
90  m_env.worldRank(),
91  "PoweredJointPdf<V,M>::actualValue()",
92  "invalid input");
93 
94  double value = m_srcDensity.actualValue(domainVector,domainDirection,gradVector,hessianMatrix,hessianEffect);
95 
96  UQ_FATAL_TEST_MACRO((domainDirection || gradVector || hessianMatrix || hessianEffect),
97  m_env.worldRank(),
98  "PoweredJointPdf<V,M>::actualValue()",
99  "incomplete code for domainDirection, gradVector, hessianMatrix and hessianEffect calculations");
100 
101  double returnValue = pow(value,m_exponent);
102  returnValue *= exp(m_logOfNormalizationFactor); // [PDF-08] ???
103 
104  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
105  *m_env.subDisplayFile() << "Leaving PoweredJointPdf<V,M>::actualValue()"
106  << ": domainVector = " << domainVector
107  << ", returnValue = " << returnValue
108  << std::endl;
109  }
110 
111  return returnValue;
112 }
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
const BaseJointPdf< V, M > & m_srcDensity
const VectorSet< V, M > & m_domainSet
Domain set of the scalar function.
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
unsigned int displayVerbosity() const
Definition: Environment.C:436
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
template<class V , class M >
double QUESO::PoweredJointPdf< V, M >::computeLogOfNormalizationFactor ( unsigned int  numSamples,
bool  updateFactorInternally 
) const
virtual

TODO: Computes the logarithm of the normalization factor.

Todo:
: implement me!

Implements QUESO::BaseJointPdf< V, M >.

Definition at line 151 of file PoweredJointPdf.C.

References UQ_FATAL_TEST_MACRO.

152 {
153  double value = 0.;
154 
155  double volume = m_domainSet.volume();
156  if (((boost::math::isnan)(volume)) ||
157  (volume == -INFINITY ) ||
158  (volume == INFINITY ) ||
159  (volume <= 0. )) {
160  // Do nothing
161  }
162  else {
163  UQ_FATAL_TEST_MACRO(true,
164  m_env.worldRank(),
165  "PoweredJointPdf<V,M>::lnValue()",
166  "incomplete code for computeLogOfNormalizationFactor()");
167  }
168 
169  return value;
170 }
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
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::PoweredJointPdf< V, M >::lnValue ( const V &  domainVector,
const V *  domainDirection,
V *  gradVector,
M *  hessianMatrix,
V *  hessianEffect 
) const
virtual

Logarithm of the value of the powered PDF.

Finds the logarithm of actual value using BaseJointPdf::lnValue() and multiplies by the power of this PDF, which given by exponent, and then adds the normalization factor, which is given by m_logOfNormalizationFactor.

Implements QUESO::BaseJointPdf< V, M >.

Definition at line 116 of file PoweredJointPdf.C.

References UQ_FATAL_TEST_MACRO.

122 {
123  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
124  *m_env.subDisplayFile() << "Entering PoweredJointPdf<V,M>::lnValue()"
125  << ": domainVector = " << domainVector
126  << std::endl;
127  }
128 
129  double value = m_srcDensity.lnValue(domainVector,domainDirection,gradVector,hessianMatrix,hessianEffect);
130 
131  UQ_FATAL_TEST_MACRO((domainDirection || gradVector || hessianMatrix || hessianEffect),
132  m_env.worldRank(),
133  "PoweredJointPdf<V,M>::lnValue()",
134  "incomplete code for domainDirection, gradVector, hessianMatrix and hessianEffect calculations");
135 
136  double returnValue = m_exponent*value;
137  returnValue += m_logOfNormalizationFactor; // [PDF-08] ???
138 
139  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
140  *m_env.subDisplayFile() << "Leaving PoweredJointPdf<V,M>::lnValue()"
141  << ": domainVector = " << domainVector
142  << ", returnValue = " << returnValue
143  << std::endl;
144  }
145 
146  return returnValue;
147 }
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
const BaseJointPdf< V, M > & m_srcDensity
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
unsigned int displayVerbosity() const
Definition: Environment.C:436
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
template<class V , class M >
void QUESO::PoweredJointPdf< V, M >::setNormalizationStyle ( unsigned int  value) const
virtual

Sets a value to be used in the normalization style of the powered PDF (ie, protected attribute m_srcDensity).

Reimplemented from QUESO::BaseJointPdf< V, M >.

Definition at line 68 of file PoweredJointPdf.C.

69 {
70  m_srcDensity.setNormalizationStyle(value);
71  return;
72 }
const BaseJointPdf< V, M > & m_srcDensity

Member Data Documentation

template<class V , class M >
double QUESO::PoweredJointPdf< V, M >::m_exponent
protected

Definition at line 92 of file PoweredJointPdf.h.

template<class V , class M >
const BaseJointPdf<V,M>& QUESO::PoweredJointPdf< V, M >::m_srcDensity
protected

Definition at line 91 of file PoweredJointPdf.h.


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