26 #include <queso/LogNormalVectorRealizer.h>
27 #include <queso/GslVector.h>
28 #include <queso/GslMatrix.h>
33 template<
class V,
class M>
36 const V& lawExpVector,
37 const M& lowerCholLawCovMatrix)
39 BaseVectorRealizer<V,M>( ((std::string)(prefix)+
"gau").c_str(), unifiedImageSet, std::numeric_limits<unsigned int>::max()),
40 m_unifiedLawExpVector (new V(lawExpVector)),
41 m_unifiedLawVarVector (unifiedImageSet.vectorSpace().newVector( INFINITY)),
42 m_lowerCholLawCovMatrix(new M(lowerCholLawCovMatrix)),
60 template<
class V,
class M>
63 const V& lawExpVector,
68 BaseVectorRealizer<V,M>( ((std::string)(prefix)+
"gau").c_str(), unifiedImageSet, std::numeric_limits<unsigned int>::max()),
69 m_unifiedLawExpVector (new V(lawExpVector)),
70 m_unifiedLawVarVector (unifiedImageSet.vectorSpace().newVector( INFINITY)),
71 m_lowerCholLawCovMatrix(NULL),
73 m_vecSsqrt (new V(vecSsqrt)),
74 m_matVt (new M(matVt))
89 template<
class V,
class M>
95 delete m_lowerCholLawCovMatrix;
96 delete m_unifiedLawVarVector;
97 delete m_unifiedLawExpVector;
100 template <
class V,
class M>
104 return *m_unifiedLawExpVector;
107 template <
class V,
class M>
111 return *m_unifiedLawVarVector;
114 template<
class V,
class M>
118 V iidGaussianVector(m_unifiedImageSet.vectorSpace().zeroVector());
120 bool outOfSupport =
true;
122 iidGaussianVector.cwSetGaussian(0.0, 1.0);
124 if (m_lowerCholLawCovMatrix) {
125 nextValues = (*m_unifiedLawExpVector) + (*m_lowerCholLawCovMatrix)*iidGaussianVector;
127 else if (m_matU && m_vecSsqrt && m_matVt) {
128 nextValues = (*m_unifiedLawExpVector) + (*m_matU)*( (*m_vecSsqrt) * ((*m_matVt)*iidGaussianVector) );
131 queso_error_msg(
"inconsistent internal state");
134 for (
unsigned int i = 0; i < nextValues.sizeLocal(); ++i) {
135 nextValues[i] = std::exp(nextValues[i]);
138 outOfSupport = !(this->m_unifiedImageSet.contains(nextValues));
139 }
while (outOfSupport);
A templated (base) class for handling sampling from vector RVs.
const BaseEnvironment & m_env
~LogNormalVectorRealizer()
Destructor.
const V & unifiedLawVarVector() const
Access to the vector of variance values and private attribute: m_unifiedLawVarVector.
LogNormalVectorRealizer(const char *prefix, const VectorSet< V, M > &unifiedImageSet, const V &lawExpVector, const M &lowerCholLawCovMatrix)
Constructor.
A templated class for handling sets.
const V & unifiedLawExpVector() const
Access to the vector of mean values and private attribute: m_unifiedLawExpVector. ...
unsigned int displayVerbosity() const
A class for handling sampling from a Log-Normal probability density distribution. ...
void realization(V &nextValues) const
Draws a realization.
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).