25 #include <queso/JointPdf.h>
26 #include <queso/GslVector.h>
27 #include <queso/GslMatrix.h>
32 template<
class V,
class M>
38 m_normalizationStyle(0),
39 m_logOfNormalizationFactor(0.)
54 template<
class V,
class M>
60 template<
class V,
class M>
64 queso_not_implemented();
68 template<
class V,
class M>
72 queso_not_implemented();
76 template<
class V,
class M>
80 m_normalizationStyle = value;
84 template<
class V,
class M>
88 m_logOfNormalizationFactor = value;
92 template <
class V,
class M>
100 os <<
"Start printing BaseJointPdf<V, M>" << std::endl;
101 os <<
"m_prefix:" << std::endl;
102 os << this->m_prefix << std::endl;
103 os <<
"m_domainSet:" << std::endl;
104 os << this->m_domainSet << std::endl;
105 os <<
"m_normalizationStyle:" << std::endl;
106 os << this->m_normalizationStyle << std::endl;
107 os <<
"m_logOfNormalizationFactor:" << std::endl;
108 os << this->m_logOfNormalizationFactor << std::endl;
109 os <<
"End printing BaseJointPdf<V, M>" << std::endl;
113 template<
class V,
class M>
119 double volume = m_domainSet.volume();
121 (volume == -INFINITY ) ||
122 (volume == INFINITY ) ||
128 if (boxSubset == NULL) {
132 V tmpVec(m_domainSet.vectorSpace().zeroVector());
134 for (
unsigned int i = 0; i < numSamples; ++i) {
136 sum += this->actualValue(tmpVec,NULL,NULL,NULL,NULL);
138 double avgValue = sum/((double) numSamples);
139 value = -( log(avgValue) + log(volume) );
140 if (updateFactorInternally) {
141 m_logOfNormalizationFactor = value;
150 template <
class V,
class M>
154 if (componentId > m_components.size())
return m_dummyComponent;
155 if (m_components[componentId] == NULL)
return m_dummyComponent;
156 return *(m_components[componentId]);
A templated (base) class for handling scalar functions.
void setLogOfNormalizationFactor(double value) const
Sets a logarithmic value to be used in the normalization factor (stored in the protected attribute m_...
virtual void setNormalizationStyle(unsigned int value) const
virtual ~BaseJointPdf()
Destructor.
A templated class for handling sets.
BaseJointPdf(const char *prefix, const VectorSet< V, M > &domainSet)
Default constructor.
double commonComputeLogOfNormalizationFactor(unsigned int numSamples, bool updateFactorInternally) const
Common method (to the derived classes) to compute the logarithm of the normalization factor...
const V & minValues() const
Vector of the minimum values of the box subset.
Class representing a subset of a vector space shaped like a hypercube.
const BaseEnvironment & m_env
A templated (base) class for handling joint PDFs.
virtual void print(std::ostream &os) const
Print method. Non-pure for backwards compatibility.
virtual void distributionVariance(M &covMatrix) const
unsigned int displayVerbosity() const
virtual void distributionMean(V &meanVector) const
const V & maxValues() const
Vector of the maximum values of the box subset.
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).