queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
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 >:
QUESO::BaseJointPdf< V, M > QUESO::BaseScalarFunction< V, M >

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...
 
virtual void distributionMean (V &meanVector) const
 
virtual void distributionVariance (M &covMatrix) const
 
void setLogOfNormalizationFactor (double value) const
 Sets a logarithmic value to be used in the normalization factor (stored in the protected attribute m_normalizationStyle.) More...
 
virtual void print (std::ostream &os) const
 Print method. Non-pure for backwards compatibility. More...
 
- Public Member Functions inherited from QUESO::BaseScalarFunction< V, M >
void setFiniteDifferenceStepSize (double fdStepSize)
 Sets the step size for finite differencing gradients. More...
 
void setFiniteDifferenceStepSize (unsigned int i, double fdStepSize)
 
 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...
 
virtual double lnValue (const V &domainVector) const
 Returns the logarithm of the function at domainVector. More...
 
virtual double lnValue (const V &domainVector, V &gradVector) const
 Returns the logarithm of the function and its gradient at domainVector. More...
 
virtual double lnValue (const V &domainVector, V &gradVector, const V &domainDirection, V &hessianEffect) const
 

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 50 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
const BaseEnvironment & m_env
unsigned int displayVerbosity() const
Definition: Environment.C:450
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
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::queso_require_equal_to_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 }
double m_logOfNormalizationFactor
Definition: JointPdf.h:122
const BaseJointPdf< V, M > & m_srcDensity
const BaseEnvironment & m_env
MonteCarloSGOptions::MonteCarloSGOptions(const BaseEnvironment &env, const char *prefix, const McOptionsValues &alternativeOptionsValues queso_require_equal_to_msg)(m_env.optionsInputFileName(), std::string(""), std::string("this constructor is incompatible with the existence of an options input file"))
const VectorSet< V, M > & m_domainSet
Domain set of the scalar function.
unsigned int displayVerbosity() const
Definition: Environment.C:450
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
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::queso_isnan().

143 {
144  double value = 0.;
145 
146  double volume = m_domainSet.volume();
147  if ((queso_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 }
bool queso_isnan(T arg)
Definition: math_macros.h:39
const VectorSet< V, M > & m_domainSet
Domain set of the scalar function.
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.

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

Definition at line 110 of file PoweredJointPdf.C.

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 }
double m_logOfNormalizationFactor
Definition: JointPdf.h:122
const BaseJointPdf< V, M > & m_srcDensity
const BaseEnvironment & m_env
unsigned int displayVerbosity() const
Definition: Environment.C:450
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
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 93 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 92 of file PoweredJointPdf.h.


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

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