25 #include <queso/WignerJointPdf.h>
26 #include <queso/GslVector.h>
27 #include <queso/GslMatrix.h>
32 template<
class V,
class M>
41 m_centerPos(new V(centerPos)),
50 queso_require_greater_msg(
m_radius, 0.,
"invalid radius");
59 template<
class V,
class M>
65 template<
class V,
class M>
68 const V& domainVector,
69 const V* domainDirection,
72 V* hessianEffect)
const
76 if (gradVector ) *gradVector = m_domainSet.vectorSpace().zeroVector();
77 if (hessianMatrix) *hessianMatrix *= 0.;
78 if (hessianEffect) *hessianEffect = m_domainSet.vectorSpace().zeroVector();
80 double returnValue = 0.;
81 double distanceRatio = (domainVector - *m_centerPos).norm2()/m_radius;
82 if (distanceRatio < 1.) {
83 returnValue = 2.*m_radius*m_radius*sqrt(1. - distanceRatio*distanceRatio)/M_PI;
85 returnValue *= exp(m_logOfNormalizationFactor);
90 template<
class V,
class M>
93 const V& domainVector,
94 const V* domainDirection,
97 V* hessianEffect)
const
99 if (gradVector ) *gradVector = m_domainSet.vectorSpace().zeroVector();
100 if (hessianMatrix) *hessianMatrix *= 0.;
101 if (hessianEffect) *hessianEffect = m_domainSet.vectorSpace().zeroVector();
104 return log(this->actualValue(domainVector,domainDirection,gradVector,hessianMatrix,hessianEffect));
107 template<
class V,
class M>
111 meanVector = *m_centerPos;
115 template<
class V,
class M>
119 queso_not_implemented();
124 template<
class V,
class M>
130 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
131 *m_env.subDisplayFile() <<
"Entering WignerJointPdf<V,M>::computeLogOfNormalizationFactor()"
135 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
136 *m_env.subDisplayFile() <<
"Leaving WignerJointPdf<V,M>::computeLogOfNormalizationFactor()"
137 <<
", m_logOfNormalizationFactor = " << m_logOfNormalizationFactor
double actualValue(const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const
Actual value of the PDF (scalar function).
double computeLogOfNormalizationFactor(unsigned int numSamples, bool updateFactorInternally) const
Computes the logarithm of the normalization factor.
virtual void distributionVariance(M &covMatrix) const
Covariance matrix of the underlying random variable.
~WignerJointPdf()
Destructor.
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
virtual void distributionMean(V &meanVector) const
Mean value of the underlying random variable.
A class for handling Wigner joint PDFs.
A templated (base) class for handling joint PDFs.
WignerJointPdf(const char *prefix, const VectorSet< V, M > &domainSet, const V ¢erPos, double radius)
Constructor.
double lnValue(const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const
Computes the logarithm of the value of the function.
MonteCarloSGOptions::MonteCarloSGOptions(const BaseEnvironment &env, const char *prefix, const McOptionsValues &alternativeOptionsValues queso_require_equal_to_msg)(m_env.optionsInputFileName(), std::string(""), std::string("this constructor is incompatible with the existence of an options input file"))
unsigned int displayVerbosity() const
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).