25 #include <queso/JeffreysJointPdf.h>
26 #include <queso/GslVector.h>
27 #include <queso/GslMatrix.h>
32 template<
class V,
class M>
53 template<
class V,
class M>
58 template<
class V,
class M>
61 const V& domainVector,
62 const V* domainDirection,
65 V* hessianEffect)
const
67 if (domainVector.sizeLocal() != this->m_domainSet.vectorSpace().dimLocal()) {
68 queso_error_msg(
"There is an invalid input while computing JeffreysJointPdf<V,M>::actualValue()");
71 if (gradVector ) *gradVector = m_domainSet.vectorSpace().zeroVector();
72 if (hessianMatrix) *hessianMatrix *= 0.;
73 if (hessianEffect) *hessianEffect = m_domainSet.vectorSpace().zeroVector();
75 if (domainDirection) {};
78 for (
unsigned int i = 0; i < domainVector.sizeLocal(); ++i){
79 if (domainVector[i] < 0.0 ) {
80 queso_error_msg(
"The domain for Jeffreys prior should be greater than zero.");
82 else if ((domainVector[i] == -INFINITY ) ||
83 (domainVector[i] == INFINITY ) ||
84 (m_normalizationStyle != 0 )) {
88 pdf = pdf * (1.0 / domainVector[i]);
91 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
92 *m_env.subDisplayFile() <<
" return pdf " << std::endl;
99 template<
class V,
class M>
102 const V& domainVector,
103 const V* domainDirection,
106 V* hessianEffect)
const
108 if (gradVector ) *gradVector = m_domainSet.vectorSpace().zeroVector();
109 if (hessianMatrix) *hessianMatrix *= 0.0;
110 if (hessianEffect) *hessianEffect = m_domainSet.vectorSpace().zeroVector();
112 if (domainVector[0]) {};
113 if (domainDirection) {};
117 for (
unsigned int i = 0; i < domainVector.sizeLocal(); ++i){
118 if (domainVector[i] < 0.0) {
119 queso_error_msg(
"The domain for Jeffreys prior should be greater than zero.");
121 else if ((domainVector[i] == -INFINITY ) ||
122 (domainVector[i] == INFINITY ) ||
123 (m_normalizationStyle != 0 )) {
128 pdf = pdf * (1.0 / domainVector[i]);
129 result = std::log(pdf);
132 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
133 *m_env.subDisplayFile() <<
" return log(pdf) " << std::endl;
138 template<
class V,
class M>
144 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
145 *m_env.subDisplayFile() <<
"Warning: JeffreysJointPdf<V,M>::distributionMean() makes little sense"
148 m_domainSet.centroid(meanVector);
151 template<
class V,
class M>
156 queso_not_implemented();
159 template<
class V,
class M>
165 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
166 *m_env.subDisplayFile() <<
"Entering JeffreysJointPdf<V,M>::computeLogOfNormalizationFactor()"
170 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
171 *m_env.subDisplayFile() <<
"Leaving JeffreysJointPdf<V,M>::computeLogOfNormalizationFactor()"
172 <<
", m_logOfNormalizationFactor = " << m_logOfNormalizationFactor
176 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
177 *m_env.subDisplayFile() <<
" return normalization factor " << std::endl;
virtual void distributionMean(V &meanVector) const
double actualValue(const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const
Actual value of the jeffreys PDF.
JeffreysJointPdf(const char *prefix, const VectorSet< V, M > &domainSet)
Constructor.
double lnValue(const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const
Logarithm of the value of the jeffreys PDF.
A templated class for handling sets.
double commonComputeLogOfNormalizationFactor(unsigned int numSamples, bool updateFactorInternally) const
Common method (to the derived classes) to compute the logarithm of the normalization factor...
const BaseEnvironment & m_env
double computeLogOfNormalizationFactor(unsigned int numSamples, bool updateFactorInternally) const
Computes the logarithm of the normalization factor.
A templated (base) class for handling joint PDFs.
A class for handling jeffreys joint PDFs.
~JeffreysJointPdf()
Destructor.
virtual void distributionVariance(M &covMatrix) const
Covariance matrix of the underlying random variable.
unsigned int displayVerbosity() const
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).