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(),
51 "InvLogitGaussianVectorRV<V,M>::constructor() [1]",
52 "Covariance matrix is not symmetric positive definite.");
58 V cholDiag(lawVarVector);
60 M lowerCholLawCovMatrix(cholDiag);
61 lowerCholLawCovMatrix.zeroUpper(
false);
65 lowerCholLawCovMatrix);
78 template<
class V,
class M>
82 const V & lawExpVector,
83 const M & lawCovMatrix)
84 :
BaseVectorRV<V, M>(((std::string)(prefix)+
"invlogit_gau").c_str(),
95 lawExpVector, lawCovMatrix);
97 M lowerCholLawCovMatrix(lawCovMatrix);
98 int iRC = lowerCholLawCovMatrix.chol();
99 lowerCholLawCovMatrix.zeroUpper(
false);
101 std::cerr <<
"In InvLogitGaussianVectorRV<V,M>::constructor() [2]: chol failed, will use svd\n";
103 *
m_env.
subDisplayFile() <<
"In InvLogitGaussianVectorRV<V,M>::constructor() [2]: chol failed; will use svd; lawCovMatrix contents are\n";
107 M matU (lawCovMatrix);
108 M matVt(
m_imageSet.vectorSpace().zeroVector());
109 V vecS (
m_imageSet.vectorSpace().zeroVector());
110 iRC = lawCovMatrix.svd(matU,vecS,matVt);
113 "InvLogitGaussianVectorRV<V,M>::constructor() [2]",
114 "Cholesky decomposition of covariance matrix failed.");
137 template<
class V,
class M>
147 template<
class V,
class M>
156 updateLawExpVector(newLawExpVector);
160 template<
class V,
class M>
169 M newLowerCholLawCovMatrix(newLawCovMatrix);
170 int iRC = newLowerCholLawCovMatrix.chol();
171 newLowerCholLawCovMatrix.zeroUpper(
false);
173 std::cerr <<
"In InvLogitGaussianVectorRV<V,M>::updateLawCovMatrix(): chol failed, will use svd\n";
174 if (m_env.subDisplayFile()) {
175 *m_env.subDisplayFile() <<
"In InvLogitGaussianVectorRV<V,M>::updateLawCovMatrix(): chol failed; will use svd; newLawCovMatrix contents are\n";
176 *m_env.subDisplayFile() << newLawCovMatrix;
177 *m_env.subDisplayFile() << std::endl;
179 M matU (newLawCovMatrix);
180 M matVt(m_imageSet.vectorSpace().zeroVector());
181 V vecS (m_imageSet.vectorSpace().zeroVector());
182 iRC = newLawCovMatrix.svd(matU,vecS,matVt);
185 "InvLogitGaussianVectorRV<V,M>::updateLawCovMatrix()",
186 "Cholesky decomposition of covariance matrix failed.");
190 updateLowerCholLawCovMatrix(matU, vecS, matVt);
194 updateLowerCholLawCovMatrix(newLowerCholLawCovMatrix);
199 template <
class V,
class M>
203 os <<
"InvLogitGaussianVectorRV<V,M>::print() says, 'Please implement me.'" << std::endl;
void updateLawCovMatrix(const M &newLawCovMatrix)
Updates the covariance matrix.
const BaseVectorCdf< V, M > * m_unifiedCdf
int worldRank() const
Returns the process world rank.
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
const VectorSet< V, M > & m_imageSet
const BaseEnvironment & m_env
A class representing a (transformed) Gaussian vector RV with bounds.
const BaseVectorCdf< V, M > * m_subCdf
BaseVectorRealizer< V, M > * m_realizer
void print(std::ostream &os) const
TODO: Prints the vector RV.
Class representing a subset of a vector space shaped like a hypercube.
A class for handling sampling from (transformed) Gaussian probability density distributions with boun...
void updateLawExpVector(const V &newLawExpVector)
Updates the vector that contains the mean values for the underlying Gaussian.
A templated base class for handling vector RV.
virtual ~InvLogitGaussianVectorRV()
Virtual destructor.
unsigned int displayVerbosity() const
const BaseVectorMdf< V, M > * m_mdf
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
InvLogitGaussianVectorRV(const char *prefix, const BoxSubset< V, M > &imageBoxSubset, const V &lawExpVector, const V &lawVarVector)
Constructor.
A class for handling hybrid (transformed) Gaussians with bounds.
BaseJointPdf< V, M > * m_pdf