25 #include <queso/ScaledCovMatrixTKGroup.h>
26 #include <queso/GslVector.h>
27 #include <queso/GslMatrix.h>
28 #include <queso/GaussianJointPdf.h>
33 template<
class V,
class M>
37 const std::vector<double>& scales,
41 m_originalCovMatrix (covMatrix)
50 <<
": m_scales.size() = " <<
m_scales.size()
52 <<
", m_rvs.size() = " <<
m_rvs.size()
65 template<
class V,
class M>
70 template<
class V,
class M>
77 template<
class V,
class M>
87 queso_require_msg(m_preComputingPositions[stageId],
"m_preComputingPositions[stageId] == NULL");
89 if ((m_env.subDisplayFile() ) &&
90 (m_env.displayVerbosity() >= 10)) {
91 *m_env.subDisplayFile() <<
"In ScaledCovMatrixTKGroup<V,M>::rv1()"
92 <<
", stageId = " << stageId
93 <<
": about to call m_rvs[0]->updateLawExpVector()"
94 <<
", vector = " << *m_preComputingPositions[stageId]
102 return (*gaussian_rv);
105 template<
class V,
class M>
115 queso_require_msg(m_preComputingPositions[stageIds[0]],
"m_preComputingPositions[stageIds[0]] == NULL");
117 if ((m_env.subDisplayFile() ) &&
118 (m_env.displayVerbosity() >= 10)) {
119 *m_env.subDisplayFile() <<
"In ScaledCovMatrixTKGroup<V,M>::rv2()"
120 <<
", stageIds.size() = " << stageIds.size()
121 <<
", stageIds[0] = " << stageIds[0]
122 <<
": about to call m_rvs[stageIds.size()-1]->updateLawExpVector()"
123 <<
", vector = " << *m_preComputingPositions[stageIds[0]]
131 return (*gaussian_rv);
134 template<
class V,
class M>
138 for (
unsigned int i = 0; i < m_scales.size(); ++i) {
139 double factor = 1./m_scales[i]/m_scales[i];
140 if ((m_env.subDisplayFile() ) &&
141 (m_env.displayVerbosity() >= 10)) {
142 *m_env.subDisplayFile() <<
"In ScaledCovMatrixTKGroup<V,M>::updateLawCovMatrix()"
143 <<
", m_scales.size() = " << m_scales.size()
145 <<
", m_scales[i] = " << m_scales[i]
146 <<
", factor = " << factor
147 <<
": about to call m_rvs[i]->updateLawCovMatrix()"
148 <<
", covMatrix = \n" << factor*covMatrix
158 template<
class V,
class M>
162 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
163 *m_env.subDisplayFile() <<
"Entering ScaledCovMatrixTKGroup<V,M>::setPreComputingPosition()"
164 <<
": position = " << position
165 <<
", stageId = " << stageId
172 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
173 *m_env.subDisplayFile() <<
"In ScaledCovMatrixTKGroup<V,M>::setPreComputingPosition()"
174 <<
", position = " << position
175 <<
", stageId = " << stageId
176 <<
": preComputingPos = " << *m_preComputingPositions[stageId];
177 if (stageId < m_scales.size()) {
178 *m_env.subDisplayFile() <<
", factor = " << 1./m_scales[stageId]/m_scales[stageId];
180 if (stageId < m_rvs.size()) {
182 *m_env.subDisplayFile() <<
", rvCov = " << pdfPtr->
lawCovMatrix();
184 *m_env.subDisplayFile() << std::endl;
187 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
188 *m_env.subDisplayFile() <<
"Leaving ScaledCovMatrixTKGroup<V,M>::setPreComputingPosition()"
189 <<
": position = " << position
190 <<
", stageId = " << stageId
197 template<
class V,
class M>
207 template<
class V,
class M>
215 for (
unsigned int i = 0; i < m_scales.size(); ++i) {
216 double factor = 1./m_scales[i]/m_scales[i];
220 m_vectorSpace->zeroVector(),
221 factor*m_originalCovMatrix);
227 template<
class V,
class M>
unsigned int displayVerbosity() const
~ScaledCovMatrixTKGroup()
Destructor.
virtual void print(std::ostream &os) const
TODO: Prints the transition kernel.
void print(std::ostream &os) const
TODO: Prints the transition kernel.
This base class allows the representation of a transition kernel.
void clearPreComputingPositions()
Clears the pre-computing positions m_preComputingPositions[stageId].
const GaussianVectorRV< V, M > & rv(unsigned int stageId) const
Gaussian increment property to construct a transition kernel.
void updateLawCovMatrix(const M &covMatrix)
Scales the covariance matrix.
#define queso_require_not_equal_to_msg(expr1, expr2, msg)
bool symmetric() const
Whether or not the matrix is symmetric. Always 'true'.
This class allows the representation of a transition kernel with a scaled covariance matrix...
virtual bool setPreComputingPosition(const V &position, unsigned int stageId)
Sets the pre-computing positions m_preComputingPositions[stageId] with a new vector of size position...
const BaseEnvironment & m_env
A class for handling Gaussian joint PDFs.
#define queso_require_equal_to_msg(expr1, expr2, msg)
bool setPreComputingPosition(const V &position, unsigned int stageId)
Sets the pre-computing positions m_preComputingPositions[stageId] with a new vector of size position...
virtual void clearPreComputingPositions()
Clears the pre-computing positions m_preComputingPositions[stageId].
#define queso_require_msg(asserted, msg)
A class representing a Gaussian vector RV.
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
std::vector< const V * > m_preComputingPositions
const M & lawCovMatrix() const
Returns the covariance matrix; access to protected attribute m_lawCovMatrix.
std::vector< BaseVectorRV< V, M > * > m_rvs
void updateLawExpVector(const V &newLawExpVector)
Updates the vector that contains the mean values.
#define queso_require_greater_equal_msg(expr1, expr2, msg)
std::vector< double > m_scales
void setRVsWithZeroMean()
Sets the mean of the RVs to zero.
#define queso_require_greater_msg(expr1, expr2, msg)
A class representing a vector space.
ScaledCovMatrixTKGroup(const char *prefix, const VectorSpace< V, M > &vectorSpace, const std::vector< double > &scales, const M &covMatrix)
Default constructor.