25 #include <queso/GaussianVectorRealizer.h>
26 #include <queso/GslVector.h>
27 #include <queso/GslMatrix.h>
32 template<
class V,
class M>
35 const V& lawExpVector,
36 const M& lowerCholLawCovMatrix)
38 BaseVectorRealizer<V,M>( ((std::string)(prefix)+
"gau").c_str(), unifiedImageSet, std::numeric_limits<unsigned int>::max()),
39 m_unifiedLawExpVector (new V(lawExpVector)),
40 m_unifiedLawVarVector (unifiedImageSet.vectorSpace().newVector( INFINITY)),
41 m_lowerCholLawCovMatrix(new M(lowerCholLawCovMatrix)),
61 template<
class V,
class M>
64 const V& lawExpVector,
69 BaseVectorRealizer<V,M>( ((std::string)(prefix)+
"gau").c_str(), unifiedImageSet, std::numeric_limits<unsigned int>::max()),
70 m_unifiedLawExpVector (new V(lawExpVector)),
71 m_unifiedLawVarVector (unifiedImageSet.vectorSpace().newVector( INFINITY)),
72 m_lowerCholLawCovMatrix(NULL),
74 m_vecSsqrt (new V(vecSsqrt)),
75 m_matVt (new M(matVt))
92 template<
class V,
class M>
98 delete m_lowerCholLawCovMatrix;
99 delete m_unifiedLawVarVector;
100 delete m_unifiedLawExpVector;
103 template <
class V,
class M>
107 return *m_unifiedLawExpVector;
110 template <
class V,
class M>
114 return *m_unifiedLawVarVector;
117 template<
class V,
class M>
121 V iidGaussianVector(m_unifiedImageSet.vectorSpace().zeroVector());
123 bool outOfSupport =
true;
125 iidGaussianVector.cwSetGaussian(0.0, 1.0);
127 if (m_lowerCholLawCovMatrix) {
128 nextValues = (*m_unifiedLawExpVector) + (*m_lowerCholLawCovMatrix)*iidGaussianVector;
130 else if (m_matU && m_vecSsqrt && m_matVt) {
131 nextValues = (*m_unifiedLawExpVector) + (*m_matU)*( (*m_vecSsqrt) * ((*m_matVt)*iidGaussianVector) );
136 "GaussianVectorRealizer<V,M>::realization()",
137 "inconsistent internal state");
140 outOfSupport = !(this->m_unifiedImageSet.contains(nextValues));
141 }
while (outOfSupport);
146 template<
class V,
class M>
151 delete m_unifiedLawExpVector;
153 m_unifiedLawExpVector =
new V(newLawExpVector);
158 template<
class V,
class M>
163 delete m_lowerCholLawCovMatrix;
168 m_lowerCholLawCovMatrix =
new M(newLowerCholLawCovMatrix);
176 template<
class V,
class M>
184 delete m_lowerCholLawCovMatrix;
189 m_lowerCholLawCovMatrix = NULL;
190 m_matU =
new M(matU);
191 m_vecSsqrt =
new V(vecSsqrt);
192 m_matVt =
new M(matVt);
void realization(V &nextValues) const
Draws a realization.
A templated class for handling sets.
A templated (base) class for handling sampling from vector RVs.
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
const V & unifiedLawExpVector() const
Access to the vector of mean values and private attribute: m_unifiedLawExpVector. ...
void updateLawExpVector(const V &newLawExpVector)
Updates the mean with the new value newLawExpVector.
~GaussianVectorRealizer()
Destructor.
const BaseEnvironment & m_env
const V & unifiedLawVarVector() const
Access to the vector of variance values and private attribute: m_unifiedLawVarVector.
A class for handling sampling from Gaussian probability density distributions.
GaussianVectorRealizer(const char *prefix, const VectorSet< V, M > &unifiedImageSet, const V &lawExpVector, const M &lowerCholLawCovMatrix)
Constructor.
unsigned int displayVerbosity() const
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
void updateLowerCholLawCovMatrix(const M &newLowerCholLawCovMatrix)
Updates the lower triangular matrix from Cholesky decomposition of the covariance matrix to the new v...
V * m_unifiedLawExpVector