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]);
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() <<
"Entering JeffreysJointPdf<V,M>::computeLogOfNormalizationFactor()"
149 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
150 *m_env.subDisplayFile() <<
"Leaving JeffreysJointPdf<V,M>::computeLogOfNormalizationFactor()"
151 <<
", m_logOfNormalizationFactor = " << m_logOfNormalizationFactor
155 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
156 *m_env.subDisplayFile() <<
" return normalization factor " << std::endl;
unsigned int displayVerbosity() const
A templated class for handling sets.
A templated (base) class for handling joint PDFs.
double commonComputeLogOfNormalizationFactor(unsigned int numSamples, bool updateFactorInternally) const
Common method (to the derived classes) to compute the logarithm of the normalization factor...
#define queso_error_msg(msg)
double actualValue(const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const
Actual value of the jeffreys PDF.
const BaseEnvironment & m_env
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
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.
double computeLogOfNormalizationFactor(unsigned int numSamples, bool updateFactorInternally) const
Computes the logarithm of the normalization factor.
A class for handling jeffreys joint PDFs.
~JeffreysJointPdf()
Destructor.