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 double value = m_srcDensity.actualValue(domainVector,domainDirection,gradVector,hessianMatrix,hessianEffect);
93 queso_require_msg(!(domainDirection || gradVector || hessianMatrix || hessianEffect),
"incomplete code for domainDirection, gradVector, hessianMatrix and hessianEffect calculations");
95 double returnValue = pow(value,m_exponent);
96 returnValue *= exp(m_logOfNormalizationFactor);
98 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
99 *m_env.subDisplayFile() <<
"Leaving PoweredJointPdf<V,M>::actualValue()"
100 <<
": domainVector = " << domainVector
101 <<
", returnValue = " << returnValue
108 template<
class V,
class M>
111 const V& domainVector,
112 const V* domainDirection,
115 V* hessianEffect)
const
117 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
118 *m_env.subDisplayFile() <<
"Entering PoweredJointPdf<V,M>::lnValue()"
119 <<
": domainVector = " << domainVector
123 double value = m_srcDensity.lnValue(domainVector,domainDirection,gradVector,hessianMatrix,hessianEffect);
125 queso_require_msg(!(domainDirection || gradVector || hessianMatrix || hessianEffect),
"incomplete code for domainDirection, gradVector, hessianMatrix and hessianEffect calculations");
127 double returnValue = m_exponent*value;
128 returnValue += m_logOfNormalizationFactor;
130 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
131 *m_env.subDisplayFile() <<
"Leaving PoweredJointPdf<V,M>::lnValue()"
132 <<
": domainVector = " << domainVector
133 <<
", returnValue = " << returnValue
140 template<
class V,
class M>
146 double volume = m_domainSet.volume();
147 if (((boost::math::isnan)(volume)) ||
148 (volume == -INFINITY ) ||
149 (volume == INFINITY ) ||
154 queso_error_msg(
"incomplete code for computeLogOfNormalizationFactor()");
unsigned int displayVerbosity() const
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...
~PoweredJointPdf()
Destructor.
A templated (base) class for handling joint PDFs.
#define queso_error_msg(msg)
double computeLogOfNormalizationFactor(unsigned int numSamples, bool updateFactorInternally) const
TODO: Computes the logarithm of the normalization factor.
#define queso_require_equal_to_msg(expr1, expr2, msg)
const BaseEnvironment & m_env
#define queso_require_msg(asserted, msg)
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
double actualValue(const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const
Actual value of the powered PDF.
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.
A class for handling a powered joint PDFs.