25 #include <queso/InvLogitGaussianVectorRV.h>
26 #include <queso/InvLogitGaussianVectorRealizer.h>
27 #include <queso/InvLogitGaussianJointPdf.h>
28 #include <queso/GslVector.h>
29 #include <queso/GslMatrix.h>
34 template<
class V,
class M>
38 const V & lawExpVector,
39 const V & lawVarVector)
40 :
BaseVectorRV<V, M>(((std::string)(prefix)+
"invlogit_gau").c_str(),
55 V cholDiag(lawVarVector);
57 M lowerCholLawCovMatrix(cholDiag);
58 lowerCholLawCovMatrix.zeroUpper(
false);
62 lowerCholLawCovMatrix);
75 template<
class V,
class M>
79 const V & lawExpVector,
80 const M & lawCovMatrix)
81 :
BaseVectorRV<V, M>(((std::string)(prefix)+
"invlogit_gau").c_str(),
92 lawExpVector, lawCovMatrix);
94 M lowerCholLawCovMatrix(lawCovMatrix);
95 int iRC = lowerCholLawCovMatrix.chol();
96 lowerCholLawCovMatrix.zeroUpper(
false);
98 std::cerr <<
"In InvLogitGaussianVectorRV<V,M>::constructor() [2]: chol failed, will use svd\n";
100 *
m_env.
subDisplayFile() <<
"In InvLogitGaussianVectorRV<V,M>::constructor() [2]: chol failed; will use svd; lawCovMatrix contents are\n";
104 M matU (lawCovMatrix);
105 M matVt(
m_imageSet.vectorSpace().zeroVector());
106 V vecS (
m_imageSet.vectorSpace().zeroVector());
107 iRC = lawCovMatrix.svd(matU,vecS,matVt);
108 queso_require_msg(!(iRC),
"Cholesky decomposition of covariance matrix failed.");
131 template<
class V,
class M>
141 template<
class V,
class M>
150 updateLawExpVector(newLawExpVector);
154 template<
class V,
class M>
163 M newLowerCholLawCovMatrix(newLawCovMatrix);
164 int iRC = newLowerCholLawCovMatrix.chol();
165 newLowerCholLawCovMatrix.zeroUpper(
false);
167 std::cerr <<
"In InvLogitGaussianVectorRV<V,M>::updateLawCovMatrix(): chol failed, will use svd\n";
168 if (m_env.subDisplayFile()) {
169 *m_env.subDisplayFile() <<
"In InvLogitGaussianVectorRV<V,M>::updateLawCovMatrix(): chol failed; will use svd; newLawCovMatrix contents are\n";
170 *m_env.subDisplayFile() << newLawCovMatrix;
171 *m_env.subDisplayFile() << std::endl;
173 M matU (newLawCovMatrix);
174 M matVt(m_imageSet.vectorSpace().zeroVector());
175 V vecS (m_imageSet.vectorSpace().zeroVector());
176 iRC = newLawCovMatrix.svd(matU,vecS,matVt);
177 queso_require_msg(!(iRC),
"Cholesky decomposition of covariance matrix failed.");
181 updateLowerCholLawCovMatrix(matU, vecS, matVt);
185 updateLowerCholLawCovMatrix(newLowerCholLawCovMatrix);
190 template <
class V,
class M>
194 os <<
"InvLogitGaussianVectorRV<V,M>::print() says, 'Please implement me.'" << std::endl;
unsigned int displayVerbosity() const
virtual ~InvLogitGaussianVectorRV()
Virtual destructor.
const VectorSet< V, M > & m_imageSet
A templated base class for handling vector RV.
A class for handling sampling from (transformed) Gaussian probability density distributions with boun...
void print(std::ostream &os) const
TODO: Prints the vector RV.
InvLogitGaussianVectorRV(const char *prefix, const BoxSubset< V, M > &imageBoxSubset, const V &lawExpVector, const V &lawVarVector)
Constructor.
void updateLawExpVector(const V &newLawExpVector)
Updates the vector that contains the mean values for the underlying Gaussian.
BaseJointPdf< V, M > * m_pdf
#define queso_require_msg(asserted, msg)
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
A class for handling hybrid (transformed) Gaussians with bounds.
void updateLawCovMatrix(const M &newLawCovMatrix)
Updates the covariance matrix.
const BaseVectorCdf< V, M > * m_unifiedCdf
Class representing a subset of a vector space shaped like a hypercube.
const BaseEnvironment & m_env
const BaseVectorMdf< V, M > * m_mdf
#define queso_require_greater_msg(expr1, expr2, msg)
const BaseVectorCdf< V, M > * m_subCdf
BaseVectorRealizer< V, M > * m_realizer
A class representing a (transformed) Gaussian vector RV with bounds.