25 #include <queso/PoweredJointPdf.h>
26 #include <queso/GslVector.h>
27 #include <queso/GslMatrix.h>
32 template<
class V,
class M>
38 BaseJointPdf<V,M>(((std::string)(prefix)+
"pow").c_str(),srcDensity.domainSet()),
39 m_srcDensity (srcDensity),
61 template<
class V,
class M>
66 template<
class V,
class M>
70 m_srcDensity.setNormalizationStyle(value);
74 template<
class V,
class M>
77 const V& domainVector,
78 const V* domainDirection,
81 V* hessianEffect)
const
83 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
84 *m_env.subDisplayFile() <<
"Entering PoweredJointPdf<V,M>::actualValue()"
85 <<
": domainVector = " << domainVector
91 "PoweredJointPdf<V,M>::actualValue()",
94 double value = m_srcDensity.actualValue(domainVector,domainDirection,gradVector,hessianMatrix,hessianEffect);
98 "PoweredJointPdf<V,M>::actualValue()",
99 "incomplete code for domainDirection, gradVector, hessianMatrix and hessianEffect calculations");
101 double returnValue = pow(value,m_exponent);
102 returnValue *= exp(m_logOfNormalizationFactor);
104 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
105 *m_env.subDisplayFile() <<
"Leaving PoweredJointPdf<V,M>::actualValue()"
106 <<
": domainVector = " << domainVector
107 <<
", returnValue = " << returnValue
114 template<
class V,
class M>
117 const V& domainVector,
118 const V* domainDirection,
121 V* hessianEffect)
const
123 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
124 *m_env.subDisplayFile() <<
"Entering PoweredJointPdf<V,M>::lnValue()"
125 <<
": domainVector = " << domainVector
129 double value = m_srcDensity.lnValue(domainVector,domainDirection,gradVector,hessianMatrix,hessianEffect);
133 "PoweredJointPdf<V,M>::lnValue()",
134 "incomplete code for domainDirection, gradVector, hessianMatrix and hessianEffect calculations");
136 double returnValue = m_exponent*value;
137 returnValue += m_logOfNormalizationFactor;
139 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
140 *m_env.subDisplayFile() <<
"Leaving PoweredJointPdf<V,M>::lnValue()"
141 <<
": domainVector = " << domainVector
142 <<
", returnValue = " << returnValue
149 template<
class V,
class M>
155 double volume = m_domainSet.volume();
156 if (((boost::math::isnan)(volume)) ||
157 (volume == -INFINITY ) ||
158 (volume == INFINITY ) ||
165 "PoweredJointPdf<V,M>::lnValue()",
166 "incomplete code for computeLogOfNormalizationFactor()");
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
void setNormalizationStyle(unsigned int value) const
Sets a value to be used in the normalization style of the powered PDF (ie, protected attribute m_srcD...
const BaseEnvironment & m_env
A class for handling a powered joint PDFs.
double lnValue(const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const
Logarithm of the value of the powered PDF.
PoweredJointPdf(const char *prefix, const BaseJointPdf< V, M > &srcDensity, double exponent)
Constructor.
double actualValue(const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const
Actual value of the powered PDF.
unsigned int displayVerbosity() const
~PoweredJointPdf()
Destructor.
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
A templated (base) class for handling joint PDFs.
double computeLogOfNormalizationFactor(unsigned int numSamples, bool updateFactorInternally) const
TODO: Computes the logarithm of the normalization factor.