25 #include <queso/GammaJointPdf.h>
26 #include <queso/GslVector.h>
27 #include <queso/GslMatrix.h>
32 template<
class V,
class M>
39 BaseJointPdf<V,M>(((std::string)(prefix)+
"uni").c_str(),domainSet),
56 template<
class V,
class M>
61 template<
class V,
class M>
64 const V& domainVector,
65 const V* domainDirection,
68 V* hessianEffect)
const
72 "GammaJointPdf<V,M>::actualValue()",
77 "GammaJointPdf<V,M>::actualValue()",
78 "incomplete code for gradVector, hessianMatrix and hessianEffect calculations");
81 return exp(this->lnValue(domainVector,domainDirection,gradVector,hessianMatrix,hessianEffect));
84 template<
class V,
class M>
87 const V& domainVector,
88 const V* domainDirection,
91 V* hessianEffect)
const
95 "GammaJointPdf<V,M>::lnValue()",
96 "incomplete code for gradVector, hessianMatrix and hessianEffect calculations");
100 for (
unsigned int i = 0; i < domainVector.sizeLocal(); ++i) {
101 if (m_normalizationStyle == 0) {
103 aux = log(m_env.basicPdfs()->gammaPdfActualValue(domainVector[i],m_a[i],m_b[i]));
106 aux = (m_a[i]-1.)*log(domainVector[i]) - domainVector[i]/m_b[i];
108 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 99)) {
109 *m_env.subDisplayFile() <<
"In GammaJointPdf<V,M>::lnValue()"
110 <<
", m_normalizationStyle = " << m_normalizationStyle
111 <<
": domainVector[" << i <<
"] = " << domainVector[i]
112 <<
", m_a[" << i <<
"] = " << m_a[i]
113 <<
", m_b[" << i <<
"] = " << m_b[i]
114 <<
", log(pdf)= " << aux
119 result += m_logOfNormalizationFactor;
124 template<
class V,
class M>
130 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
131 *m_env.subDisplayFile() <<
"Entering GammaJointPdf<V,M>::computeLogOfNormalizationFactor()"
135 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
136 *m_env.subDisplayFile() <<
"Leaving GammaJointPdf<V,M>::computeLogOfNormalizationFactor()"
137 <<
", m_logOfNormalizationFactor = " << m_logOfNormalizationFactor
double computeLogOfNormalizationFactor(unsigned int numSamples, bool updateFactorInternally) const
Computes the logarithm of the normalization factor.
A templated class for handling sets.
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 Gamma PDF.
~GammaJointPdf()
Destructor.
double lnValue(const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const
Logarithm of the value of the Gamma PDF.
const BaseEnvironment & m_env
GammaJointPdf(const char *prefix, const VectorSet< V, M > &domainSet, const V &a, const V &b)
Constructor.
double commonComputeLogOfNormalizationFactor(unsigned int numSamples, bool updateFactorInternally) const
Common method (to the derived classes) to compute the logarithm of the normalization factor...
unsigned int displayVerbosity() const
A class for handling Gamma joint PDFs.
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
A templated (base) class for handling joint PDFs.