25 #include <queso/LogNormalVectorRV.h>
26 #include <queso/LogNormalJointPdf.h>
27 #include <queso/LogNormalVectorRealizer.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)
41 BaseVectorRV<V,M>(((std::string)(prefix)+
"gau").c_str(),imageSet)
53 double smallerOfMaxValues = imageBox->
maxValues().getMinValue();
54 double smallerOfMinValues = imageBox->
minValues().getMinValue();
56 if( smallerOfMinValues < 0 )
58 std::cerr <<
"In LogNormalVectorRV<V,M>::constructor()\n"
59 <<
"LogNormal distribution is only defined in (0, infinity).\n"
60 <<
"The data provided is: \n"
62 <<
"Sampling will not cover all interval.\n"
66 queso_require_greater_equal_msg(smallerOfMaxValues, 0,
"invalid input: LogNormal distribution is only defined in (0, infinity), and min(m_maxValues)<0");
76 M lowerCholLawCovMatrix(lawVarVector);
77 int iRC = lowerCholLawCovMatrix.chol();
78 lowerCholLawCovMatrix.zeroUpper(
false);
80 std::cerr <<
"In LogNormalVectorRV<V,M>::constructor() [1]: chol failed, will use svd\n";
82 *
m_env.
subDisplayFile() <<
"In LogNormalVectorRV<V,M>::constructor() [1]: chol failed; will use svd; lawVarVector contents are\n";
86 M matLaw(lawVarVector);
87 M matU (lawVarVector);
88 M matVt (
m_imageSet.vectorSpace().zeroVector());
89 V vecS (
m_imageSet.vectorSpace().zeroVector());
90 iRC = matLaw.svd(matU,vecS,matVt);
91 queso_require_msg(!(iRC),
"Cholesky decomposition of covariance matrix failed.");
105 lowerCholLawCovMatrix);
119 template<
class V,
class M>
129 template <
class V,
class M>
133 os <<
"LogNormalVectorRV<V,M>::print() says, 'Please implement me.'" << std::endl;
const BaseVectorCdf< V, M > * m_unifiedCdf
const BaseEnvironment & m_env
const VectorSet< V, M > & imageSet() const
Image set of the vector RV; access to private attribute m_imageSet.
A templated class for handling sets.
BaseVectorRealizer< V, M > * m_realizer
const V & minValues() const
Vector of the minimum values of the box subset.
Class representing a subset of a vector space shaped like a hypercube.
A class representing a LogNormal vector RV.
BaseJointPdf< V, M > * m_pdf
A class for handling Log-Normal joint PDFs.
A templated base class for handling vector RV.
const BaseVectorCdf< V, M > * m_subCdf
unsigned int displayVerbosity() const
A class for handling sampling from a Log-Normal probability density distribution. ...
void print(std::ostream &os) const
TODO: Prints the vector RV.
const V & maxValues() const
Vector of the maximum values of the box subset.
const VectorSet< V, M > & m_imageSet
const BaseVectorMdf< V, M > * m_mdf
virtual ~LogNormalVectorRV()
Virtual destructor.
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
LogNormalVectorRV(const char *prefix, const VectorSet< V, M > &imageSet, const V &lawExpVector, const V &lawVarVector)
Constructor.