27 #include <queso/InvLogitGaussianVectorRealizer.h> 
   28 #include <queso/GslVector.h> 
   29 #include <queso/GslMatrix.h> 
   30 #include <queso/math_macros.h> 
   34 template<
class V, 
class M>
 
   38     const V & lawExpVector,
 
   39     const M & lowerCholLawCovMatrix)
 
   41       unifiedImageBoxSubset, std::numeric_limits<unsigned int>::max()),
 
   42     m_unifiedLawExpVector(new V(lawExpVector)),
 
   43     m_unifiedLawVarVector(
 
   44         unifiedImageBoxSubset.vectorSpace().newVector(INFINITY)),  
 
   45     m_lowerCholLawCovMatrix(new M(lowerCholLawCovMatrix)),
 
   49     m_unifiedImageBoxSubset(unifiedImageBoxSubset)
 
   54 template<
class V, 
class M>
 
   58     const V & lawExpVector,
 
   63       unifiedImageBoxSubset, std::numeric_limits<unsigned int>::max()),
 
   64     m_unifiedLawExpVector(new V(lawExpVector)),
 
   65     m_unifiedLawVarVector(
 
   66         unifiedImageBoxSubset.vectorSpace().newVector( INFINITY)), 
 
   67     m_lowerCholLawCovMatrix(NULL),
 
   69     m_vecSsqrt(new V(vecSsqrt)),
 
   70     m_matVt(new M(matVt)),
 
   71     m_unifiedImageBoxSubset(unifiedImageBoxSubset)
 
   76 template<
class V, 
class M>
 
   82   delete m_lowerCholLawCovMatrix;
 
   83   delete m_unifiedLawVarVector;
 
   84   delete m_unifiedLawExpVector;
 
   87 template <
class V, 
class M>
 
   91   return *m_unifiedLawExpVector;
 
   94 template <
class V, 
class M>
 
   98   return *m_unifiedLawVarVector;
 
  101 template<
class V, 
class M>
 
  105   V iidGaussianVector(m_unifiedImageSet.vectorSpace().zeroVector());
 
  107   iidGaussianVector.cwSetGaussian(0.0, 1.0);
 
  109   if (m_lowerCholLawCovMatrix) {
 
  110     nextValues = (*m_unifiedLawExpVector) +
 
  111       (*m_lowerCholLawCovMatrix) * iidGaussianVector;
 
  113   else if (m_matU && m_vecSsqrt && m_matVt) {
 
  114     nextValues = (*m_unifiedLawExpVector) +
 
  115       (*m_matU) * ((*m_vecSsqrt) * ((*m_matVt) * iidGaussianVector));
 
  118     queso_error_msg(
"GaussianVectorRealizer<V,M>::realization() inconsistent internal state");
 
  121   V min_domain_bounds(this->m_unifiedImageBoxSubset.minValues());
 
  122   V max_domain_bounds(this->m_unifiedImageBoxSubset.maxValues());
 
  124   for (
unsigned int i = 0; i < nextValues.sizeLocal(); i++) {
 
  125     double temp = std::exp(nextValues[i]);
 
  126     double min_val = min_domain_bounds[i];
 
  127     double max_val = max_domain_bounds[i];
 
  132         nextValues[i] = (max_val * temp + min_val) / (1.0 + temp);
 
  138       nextValues[i] = temp + min_val;
 
  144       nextValues[i] = (max_val * temp - 1.0) / temp;
 
  149 template<
class V, 
class M>
 
  152     const V & newLawExpVector)
 
  155   delete m_unifiedLawExpVector;
 
  157   m_unifiedLawExpVector = 
new V(newLawExpVector);
 
  160 template<
class V, 
class M>
 
  163     const M & newLowerCholLawCovMatrix)
 
  166   delete m_lowerCholLawCovMatrix;
 
  171   m_lowerCholLawCovMatrix = 
new M(newLowerCholLawCovMatrix);
 
  177 template<
class V, 
class M>
 
  185   delete m_lowerCholLawCovMatrix;
 
  190   m_lowerCholLawCovMatrix = NULL;
 
  191   m_matU                  = 
new M(matU);
 
  192   m_vecSsqrt              = 
new V(vecSsqrt);
 
  193   m_matVt                 = 
new M(matVt);
 
A class for handling sampling from (transformed) Gaussian probability density distributions with boun...
 
~InvLogitGaussianVectorRealizer()
Destructor. 
 
const V & unifiedLawExpVector() const 
Access to the vector of mean values of the Gaussian and private attribute: m_unifiedLawExpVector. 
 
bool queso_isfinite(T arg)
 
V * m_unifiedLawExpVector
 
Class representing a subset of a vector space shaped like a hypercube. 
 
const V & unifiedLawVarVector() const 
Access to the vector of variance values and private attribute: m_unifiedLawVarVector. 
 
A templated (base) class for handling sampling from vector RVs. 
 
InvLogitGaussianVectorRealizer(const char *prefix, const BoxSubset< V, M > &unifiedImageBoxSubset, const V &lawExpVector, const M &lowerCholLawCovMatrix)
Constructor. 
 
#define queso_error_msg(msg)
 
void updateLowerCholLawCovMatrix(const M &newLowerCholLawCovMatrix)
Updates the lower triangular matrix from Cholesky decomposition of the covariance matrix to the new v...
 
void updateLawExpVector(const V &newLawExpVector)
Updates the mean of the Gaussian with the new value newLawExpVector. 
 
void realization(V &nextValues) const 
Draws a realization.