26 #include <queso/GaussianVectorRealizer.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)),
62 template<
class V,
class M>
65 const V& lawExpVector,
70 BaseVectorRealizer<V,M>( ((std::string)(prefix)+
"gau").c_str(), unifiedImageSet, std::numeric_limits<unsigned int>::max()),
71 m_unifiedLawExpVector (new V(lawExpVector)),
72 m_unifiedLawVarVector (unifiedImageSet.vectorSpace().newVector( INFINITY)),
73 m_lowerCholLawCovMatrix(NULL),
75 m_vecSsqrt (new V(vecSsqrt)),
76 m_matVt (new M(matVt))
93 template<
class V,
class M>
99 delete m_lowerCholLawCovMatrix;
100 delete m_unifiedLawVarVector;
101 delete m_unifiedLawExpVector;
104 template <
class V,
class M>
108 return *m_unifiedLawExpVector;
111 template <
class V,
class M>
115 return *m_unifiedLawVarVector;
118 template<
class V,
class M>
122 V iidGaussianVector(m_unifiedImageSet.vectorSpace().zeroVector());
124 bool outOfSupport =
true;
126 iidGaussianVector.cwSetGaussian(0.0, 1.0);
128 if (m_lowerCholLawCovMatrix) {
129 nextValues = (*m_unifiedLawExpVector) + (*m_lowerCholLawCovMatrix)*iidGaussianVector;
131 else if (m_matU && m_vecSsqrt && m_matVt) {
132 nextValues = (*m_unifiedLawExpVector) + (*m_matU)*( (*m_vecSsqrt) * ((*m_matVt)*iidGaussianVector) );
138 outOfSupport = !(this->m_unifiedImageSet.contains(nextValues));
139 }
while (outOfSupport);
144 template<
class V,
class M>
149 delete m_unifiedLawExpVector;
151 m_unifiedLawExpVector =
new V(newLawExpVector);
156 template<
class V,
class M>
161 delete m_lowerCholLawCovMatrix;
166 m_lowerCholLawCovMatrix =
new M(newLowerCholLawCovMatrix);
174 template<
class V,
class M>
182 delete m_lowerCholLawCovMatrix;
187 m_lowerCholLawCovMatrix = NULL;
188 m_matU =
new M(matU);
189 m_vecSsqrt =
new V(vecSsqrt);
190 m_matVt =
new M(matVt);
const V & unifiedLawVarVector() const
Access to the vector of variance values and private attribute: m_unifiedLawVarVector.
unsigned int displayVerbosity() const
const V & unifiedLawExpVector() const
Access to the vector of mean values and private attribute: m_unifiedLawExpVector. ...
V * m_unifiedLawExpVector
void realization(V &nextValues) const
Draws a realization.
A templated class for handling sets.
void updateLawExpVector(const V &newLawExpVector)
Updates the mean with the new value newLawExpVector.
~GaussianVectorRealizer()
Destructor.
#define queso_error_msg(msg)
A class for handling sampling from Gaussian probability density distributions.
const BaseEnvironment & m_env
GaussianVectorRealizer(const char *prefix, const VectorSet< V, M > &unifiedImageSet, const V &lawExpVector, const M &lowerCholLawCovMatrix)
Constructor.
void updateLowerCholLawCovMatrix(const M &newLowerCholLawCovMatrix)
Updates the lower triangular matrix from Cholesky decomposition of the covariance matrix to the new v...
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
A templated (base) class for handling sampling from vector RVs.