queso-0.51.1
Private Attributes | List of all members
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 >:
Inheritance graph
[legend]
Collaboration diagram for QUESO::LogNormalVectorRealizer< V, M >:
Collaboration graph
[legend]

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, class M>
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 46 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 33 of file LogNormalVectorRealizer.C.

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

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

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

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

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 115 of file LogNormalVectorRealizer.C.

References UQ_FATAL_TEST_MACRO.

116 {
117  V iidGaussianVector(m_unifiedImageSet.vectorSpace().zeroVector());
118 
119  bool outOfSupport = true;
120  do {
121  iidGaussianVector.cwSetGaussian(0.0, 1.0);
122 
124  nextValues = (*m_unifiedLawExpVector) + (*m_lowerCholLawCovMatrix)*iidGaussianVector;
125  }
126  else if (m_matU && m_vecSsqrt && m_matVt) {
127  nextValues = (*m_unifiedLawExpVector) + (*m_matU)*( (*m_vecSsqrt) * ((*m_matVt)*iidGaussianVector) );
128  }
129  else {
130  UQ_FATAL_TEST_MACRO(true,
131  m_env.worldRank(),
132  "LogNormalVectorRealizer<V,M>::realization()",
133  "inconsistent internal state");
134  }
135 
136  for (unsigned int i = 0; i < nextValues.sizeLocal(); ++i) {
137  nextValues[i] = std::exp(nextValues[i]);
138  }
139 
140  outOfSupport = !(this->m_unifiedImageSet.contains(nextValues));
141  } while (outOfSupport); // prudenci 2011-Oct-04
142 
143  return;
144 }
const VectorSet< V, M > & m_unifiedImageSet
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
const BaseEnvironment & m_env
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
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 101 of file LogNormalVectorRealizer.C.

102 {
103  return *m_unifiedLawExpVector;
104 }
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 108 of file LogNormalVectorRealizer.C.

109 {
110  return *m_unifiedLawVarVector;
111 }

Member Data Documentation

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

Definition at line 89 of file LogNormalVectorRealizer.h.

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

Definition at line 90 of file LogNormalVectorRealizer.h.

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

Definition at line 92 of file LogNormalVectorRealizer.h.

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

Definition at line 87 of file LogNormalVectorRealizer.h.

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

Definition at line 88 of file LogNormalVectorRealizer.h.

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

Definition at line 91 of file LogNormalVectorRealizer.h.


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

Generated on Thu Apr 23 2015 19:26:18 for queso-0.51.1 by  doxygen 1.8.5