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>
59 template<
class V,
class M>
63 m_normalizationStyle = value;
67 template<
class V,
class M>
71 m_logOfNormalizationFactor = value;
75 template<
class V,
class M>
81 double volume = m_domainSet.volume();
82 if (((boost::math::isnan)(volume)) ||
83 (volume == -INFINITY ) ||
84 (volume == INFINITY ) ||
90 if (boxSubset == NULL) {
94 V tmpVec(m_domainSet.vectorSpace().zeroVector());
96 for (
unsigned int i = 0; i < numSamples; ++i) {
98 sum += this->actualValue(tmpVec,NULL,NULL,NULL,NULL);
100 double avgValue = sum/((double) numSamples);
101 value = -( log(avgValue) + log(volume) );
102 if (updateFactorInternally) {
103 m_logOfNormalizationFactor = value;
112 template <
class V,
class M>
116 if (componentId > m_components.size())
return m_dummyComponent;
117 if (m_components[componentId] == NULL)
return m_dummyComponent;
118 return *(m_components[componentId]);
unsigned int displayVerbosity() const
BaseJointPdf(const char *prefix, const VectorSet< V, M > &domainSet)
Default constructor.
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...
A templated (base) class for handling scalar functions.
virtual void setNormalizationStyle(unsigned int value) const
Sets a value to be used in the normalization style (stored in the protected attribute m_normalization...
const BaseEnvironment & m_env
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).
const V & minValues() const
Vector of the minimum values of the box subset.
void setLogOfNormalizationFactor(double value) const
Sets a logarithmic value to be used in the normalization factor (stored in the protected attribute m_...
Class representing a subset of a vector space shaped like a hypercube.
virtual ~BaseJointPdf()
Destructor.