queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
QUESO::LogNormalVectorRealizer< V, M > Class Template Reference

A class for handling sampling from a Log-Normal probability density distribution. More...

#include <LogNormalVectorRealizer.h>

Inheritance diagram for QUESO::LogNormalVectorRealizer< V, M >:
QUESO::BaseVectorRealizer< V, M >

Public Member Functions

Constructor/Destructor methods
 LogNormalVectorRealizer (const char *prefix, const VectorSet< V, M > &unifiedImageSet, const V &lawExpVector, const M &lowerCholLawCovMatrix)
 Constructor. More...
 
 LogNormalVectorRealizer (const char *prefix, const VectorSet< V, M > &unifiedImageSet, const V &lawExpVector, const M &matU, const V &vecSsqrt, const M &matVt)
 Constructor. More...
 
 ~LogNormalVectorRealizer ()
 Destructor. More...
 
Realization-related methods
const V & unifiedLawExpVector () const
 Access to the vector of mean values and private attribute: m_unifiedLawExpVector. More...
 
const V & unifiedLawVarVector () const
 Access to the vector of variance values and private attribute: m_unifiedLawVarVector. More...
 
void realization (V &nextValues) const
 Draws a realization. More...
 
- Public Member Functions inherited from QUESO::BaseVectorRealizer< V, M >
 BaseVectorRealizer (const char *prefix, const VectorSet< V, M > &unifiedImageSet, unsigned int subPeriod)
 Default constructor. More...
 
virtual ~BaseVectorRealizer ()
 Virtual destructor. More...
 
const VectorSet< V, M > & unifiedImageSet () const
 Image set where the realizations lie. Access to protected attribute m_unifiedImageSet. More...
 
unsigned int subPeriod () const
 Sub-period of the realization. Access to protected attribute m_subPeriod. More...
 

Private Attributes

V * m_unifiedLawExpVector
 
V * m_unifiedLawVarVector
 
M * m_lowerCholLawCovMatrix
 
M * m_matU
 
V * m_vecSsqrt
 
M * m_matVt
 

Additional Inherited Members

- Protected Attributes inherited from QUESO::BaseVectorRealizer< V, M >
const BaseEnvironmentm_env
 
std::string m_prefix
 
const VectorSet< V, M > & m_unifiedImageSet
 
unsigned int m_subPeriod
 

Detailed Description

template<class V = GslVector, class M = GslMatrix>
class QUESO::LogNormalVectorRealizer< V, M >

A class for handling sampling from a Log-Normal probability density distribution.

This class handles sampling from a Log-Normal probability density distribution, of mean and variance given.

Definition at line 49 of file LogNormalVectorRealizer.h.

Constructor & Destructor Documentation

template<class V , class M >
QUESO::LogNormalVectorRealizer< V, M >::LogNormalVectorRealizer ( const char *  prefix,
const VectorSet< V, M > &  unifiedImageSet,
const V &  lawExpVector,
const M &  lowerCholLawCovMatrix 
)

Constructor.

Constructs a new object of the class, given a prefix and the image set, a vector of mean values, lawExpVector, and a lower triangular matrix resulting from Cholesky decomposition of the covariance matrix, lowerCholLawCovMatrix.

Definition at line 34 of file LogNormalVectorRealizer.C.

References QUESO::BaseEnvironment::displayVerbosity(), QUESO::BaseVectorRealizer< V, M >::m_env, QUESO::BaseVectorRealizer< V, M >::m_prefix, and QUESO::BaseEnvironment::subDisplayFile().

38  :
39  BaseVectorRealizer<V,M>( ((std::string)(prefix)+"gau").c_str(), unifiedImageSet, std::numeric_limits<unsigned int>::max()), // 2011/Oct/02 - Correction thanks to Corey
40  m_unifiedLawExpVector (new V(lawExpVector)),
41  m_unifiedLawVarVector (unifiedImageSet.vectorSpace().newVector( INFINITY)), // FIX ME
42  m_lowerCholLawCovMatrix(new M(lowerCholLawCovMatrix)),
43  m_matU (NULL),
44  m_vecSsqrt (NULL),
45  m_matVt (NULL)
46 {
47  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
48  *m_env.subDisplayFile() << "Entering LogNormalVectorRealizer<V,M>::constructor() [1]"
49  << ": prefix = " << m_prefix
50  << std::endl;
51  }
52 
53  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
54  *m_env.subDisplayFile() << "Leaving LogNormalVectorRealizer<V,M>::constructor() [1]"
55  << ": prefix = " << m_prefix
56  << std::endl;
57  }
58 }
const BaseEnvironment & m_env
const VectorSet< V, M > & unifiedImageSet() const
Image set where the realizations lie. Access to protected attribute m_unifiedImageSet.
unsigned int displayVerbosity() const
Definition: Environment.C:450
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
template<class V , class M >
QUESO::LogNormalVectorRealizer< V, M >::LogNormalVectorRealizer ( const char *  prefix,
const VectorSet< V, M > &  unifiedImageSet,
const V &  lawExpVector,
const M &  matU,
const V &  vecSsqrt,
const M &  matVt 
)

Constructor.

Constructs a new object of the class, given a prefix and the image set, a vector of mean values, lawExpVector, and a set of two matrices and one vector resulting from the Single Value Decomposition of the covariance matrix, matU, vecSsqrt and matVt.

Definition at line 61 of file LogNormalVectorRealizer.C.

References QUESO::BaseEnvironment::displayVerbosity(), QUESO::BaseVectorRealizer< V, M >::m_env, QUESO::BaseVectorRealizer< V, M >::m_prefix, and QUESO::BaseEnvironment::subDisplayFile().

67  :
68  BaseVectorRealizer<V,M>( ((std::string)(prefix)+"gau").c_str(), unifiedImageSet, std::numeric_limits<unsigned int>::max()), // 2011/Oct/02 - Correction thanks to Corey
69  m_unifiedLawExpVector (new V(lawExpVector)),
70  m_unifiedLawVarVector (unifiedImageSet.vectorSpace().newVector( INFINITY)), // FIX ME
72  m_matU (new M(matU)),
73  m_vecSsqrt (new V(vecSsqrt)),
74  m_matVt (new M(matVt))
75 {
76  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
77  *m_env.subDisplayFile() << "Entering LogNormalVectorRealizer<V,M>::constructor() [2]"
78  << ": prefix = " << m_prefix
79  << std::endl;
80  }
81 
82  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
83  *m_env.subDisplayFile() << "Leaving LogNormalVectorRealizer<V,M>::constructor() [2]"
84  << ": prefix = " << m_prefix
85  << std::endl;
86  }
87 }
const BaseEnvironment & m_env
const VectorSet< V, M > & unifiedImageSet() const
Image set where the realizations lie. Access to protected attribute m_unifiedImageSet.
unsigned int displayVerbosity() const
Definition: Environment.C:450
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320

Member Function Documentation

template<class V , class M >
void QUESO::LogNormalVectorRealizer< V, M >::realization ( V &  nextValues) const
virtual

Draws a realization.

This function draws a realization of a LogNormal distribution and saves it in nextValues.

Implements QUESO::BaseVectorRealizer< V, M >.

Definition at line 116 of file LogNormalVectorRealizer.C.

117 {
118  V iidGaussianVector(m_unifiedImageSet.vectorSpace().zeroVector());
119 
120  bool outOfSupport = true;
121  do {
122  iidGaussianVector.cwSetGaussian(0.0, 1.0);
123 
125  nextValues = (*m_unifiedLawExpVector) + (*m_lowerCholLawCovMatrix)*iidGaussianVector;
126  }
127  else if (m_matU && m_vecSsqrt && m_matVt) {
128  nextValues = (*m_unifiedLawExpVector) + (*m_matU)*( (*m_vecSsqrt) * ((*m_matVt)*iidGaussianVector) );
129  }
130  else {
131  queso_error_msg("inconsistent internal state");
132  }
133 
134  for (unsigned int i = 0; i < nextValues.sizeLocal(); ++i) {
135  nextValues[i] = std::exp(nextValues[i]);
136  }
137 
138  outOfSupport = !(this->m_unifiedImageSet.contains(nextValues));
139  } while (outOfSupport); // prudenci 2011-Oct-04
140 
141  return;
142 }
const VectorSet< V, M > & m_unifiedImageSet
template<class V , class M >
const V & QUESO::LogNormalVectorRealizer< V, M >::unifiedLawExpVector ( ) const

Access to the vector of mean values and private attribute: m_unifiedLawExpVector.

Definition at line 102 of file LogNormalVectorRealizer.C.

103 {
104  return *m_unifiedLawExpVector;
105 }
template<class V , class M >
const V & QUESO::LogNormalVectorRealizer< V, M >::unifiedLawVarVector ( ) const

Access to the vector of variance values and private attribute: m_unifiedLawVarVector.

Definition at line 109 of file LogNormalVectorRealizer.C.

110 {
111  return *m_unifiedLawVarVector;
112 }

Member Data Documentation

template<class V = GslVector, class M = GslMatrix>
M* QUESO::LogNormalVectorRealizer< V, M >::m_lowerCholLawCovMatrix
private

Definition at line 92 of file LogNormalVectorRealizer.h.

template<class V = GslVector, class M = GslMatrix>
M* QUESO::LogNormalVectorRealizer< V, M >::m_matU
private

Definition at line 93 of file LogNormalVectorRealizer.h.

template<class V = GslVector, class M = GslMatrix>
M* QUESO::LogNormalVectorRealizer< V, M >::m_matVt
private

Definition at line 95 of file LogNormalVectorRealizer.h.

template<class V = GslVector, class M = GslMatrix>
V* QUESO::LogNormalVectorRealizer< V, M >::m_unifiedLawExpVector
private

Definition at line 90 of file LogNormalVectorRealizer.h.

template<class V = GslVector, class M = GslMatrix>
V* QUESO::LogNormalVectorRealizer< V, M >::m_unifiedLawVarVector
private

Definition at line 91 of file LogNormalVectorRealizer.h.

template<class V = GslVector, class M = GslMatrix>
V* QUESO::LogNormalVectorRealizer< V, M >::m_vecSsqrt
private

Definition at line 94 of file LogNormalVectorRealizer.h.


The documentation for this class was generated from the following files:

Generated on Tue Jun 5 2018 19:49:33 for queso-0.57.1 by  doxygen 1.8.5