queso-0.53.0
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 = GslVector, class M = GslMatrix>
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 52 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 }
unsigned int displayVerbosity() const
Definition: Environment.C:396
const BaseJointPdf< V, M > & m_srcDensity
const BaseEnvironment & m_env
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
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 queso_require_equal_to_msg, and queso_require_msg.

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  queso_require_equal_to_msg(domainVector.sizeLocal(), this->m_domainSet.vectorSpace().dimLocal(), "invalid input");
90 
91  double value = m_srcDensity.actualValue(domainVector,domainDirection,gradVector,hessianMatrix,hessianEffect);
92 
93  queso_require_msg(!(domainDirection || gradVector || hessianMatrix || hessianEffect), "incomplete code for domainDirection, gradVector, hessianMatrix and hessianEffect calculations");
94 
95  double returnValue = pow(value,m_exponent);
96  returnValue *= exp(m_logOfNormalizationFactor); // [PDF-08] ???
97 
98  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
99  *m_env.subDisplayFile() << "Leaving PoweredJointPdf<V,M>::actualValue()"
100  << ": domainVector = " << domainVector
101  << ", returnValue = " << returnValue
102  << std::endl;
103  }
104 
105  return returnValue;
106 }
unsigned int displayVerbosity() const
Definition: Environment.C:396
double m_logOfNormalizationFactor
Definition: JointPdf.h:100
const VectorSet< V, M > & m_domainSet
Domain set of the scalar function.
const BaseJointPdf< V, M > & m_srcDensity
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
const BaseEnvironment & m_env
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
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 142 of file PoweredJointPdf.C.

References queso_error_msg.

143 {
144  double value = 0.;
145 
146  double volume = m_domainSet.volume();
147  if (((boost::math::isnan)(volume)) ||
148  (volume == -INFINITY ) ||
149  (volume == INFINITY ) ||
150  (volume <= 0. )) {
151  // Do nothing
152  }
153  else {
154  queso_error_msg("incomplete code for computeLogOfNormalizationFactor()");
155  }
156 
157  return value;
158 }
const VectorSet< V, M > & m_domainSet
Domain set of the scalar function.
#define queso_error_msg(msg)
Definition: asserts.h:47
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 110 of file PoweredJointPdf.C.

References queso_require_msg.

116 {
117  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
118  *m_env.subDisplayFile() << "Entering PoweredJointPdf<V,M>::lnValue()"
119  << ": domainVector = " << domainVector
120  << std::endl;
121  }
122 
123  double value = m_srcDensity.lnValue(domainVector,domainDirection,gradVector,hessianMatrix,hessianEffect);
124 
125  queso_require_msg(!(domainDirection || gradVector || hessianMatrix || hessianEffect), "incomplete code for domainDirection, gradVector, hessianMatrix and hessianEffect calculations");
126 
127  double returnValue = m_exponent*value;
128  returnValue += m_logOfNormalizationFactor; // [PDF-08] ???
129 
130  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
131  *m_env.subDisplayFile() << "Leaving PoweredJointPdf<V,M>::lnValue()"
132  << ": domainVector = " << domainVector
133  << ", returnValue = " << returnValue
134  << std::endl;
135  }
136 
137  return returnValue;
138 }
unsigned int displayVerbosity() const
Definition: Environment.C:396
double m_logOfNormalizationFactor
Definition: JointPdf.h:100
const BaseJointPdf< V, M > & m_srcDensity
const BaseEnvironment & m_env
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
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 = GslVector, class M = GslMatrix>
double QUESO::PoweredJointPdf< V, M >::m_exponent
protected

Definition at line 95 of file PoweredJointPdf.h.

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

Definition at line 94 of file PoweredJointPdf.h.


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

Generated on Thu Jun 11 2015 13:52:36 for queso-0.53.0 by  doxygen 1.8.5