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

This base class allows the representation of a transition kernel. More...

#include <Algorithm.h>

Inheritance diagram for QUESO::BaseTKGroup< V, M >:
QUESO::HessianCovMatricesTKGroup< V, M > QUESO::MetropolisAdjustedLangevinTK< V, M > QUESO::ScaledCovMatrixTKGroup< V, M > QUESO::TransformedScaledCovMatrixTKGroup< V, M >

Public Member Functions

Constructor/Destructor methods
 BaseTKGroup ()
 Default constructor. More...
 
 BaseTKGroup (const char *prefix, const VectorSpace< V, M > &vectorSpace, const std::vector< double > &scales)
 Constructor. More...
 
virtual ~BaseTKGroup ()
 Destructor. More...
 
Statistical/Mathematical methods
virtual bool symmetric () const =0
 Whether or not the matrix is symmetric. See template specialization. More...
 
virtual const BaseVectorRV< V,
M > & 
rv (unsigned int stageId) const =0
 Gaussian increment property to construct a transition kernel. See template specialization. More...
 
virtual const BaseVectorRV< V,
M > & 
rv (const std::vector< unsigned int > &stageIds)=0
 Gaussian increment property to construct a transition kernel. See template specialization. More...
 
virtual const BaseVectorRV< V,
M > & 
rv (const V &position) const =0
 Constructs transition kernel pdf based on internal m_stageId variable. More...
 
Misc methods
const BaseEnvironmentenv () const
 QUESO's environment. More...
 
const V & preComputingPosition (unsigned int stageId) const
 Pre-computing position; access to protected attribute *m_preComputingPositions[stageId]. More...
 
virtual bool setPreComputingPosition (const V &position, unsigned int stageId)
 Sets the pre-computing positions m_preComputingPositions[stageId] with a new vector of size position. More...
 
virtual void clearPreComputingPositions ()
 Clears the pre-computing positions m_preComputingPositions[stageId]. More...
 
virtual unsigned int set_dr_stage (unsigned int stageId)
 Does nothing. Subclasses may re-implement. Returns the current stage id. More...
 
virtual void updateTK ()
 
virtual bool covMatrixIsDirty ()=0
 
virtual void cleanCovMatrix ()=0
 
I/O methods
virtual void print (std::ostream &os) const
 TODO: Prints the transition kernel. More...
 

Protected Attributes

const EmptyEnvironmentm_emptyEnv
 
const BaseEnvironmentm_env
 
std::string m_prefix
 
const VectorSpace< V, M > * m_vectorSpace
 
std::vector< double > m_scales
 
std::vector< const V * > m_preComputingPositions
 
std::vector< BaseVectorRV< V,
M > * > 
m_rvs
 
unsigned int m_stageId
 

Detailed Description

template<class V, class M>
class QUESO::BaseTKGroup< V, M >

This base class allows the representation of a transition kernel.

The transition kernel is a conditional distribution function that represents the probability of moving from a point \( x \in R^n \) to a point in the set \( A \in B \), where \( B \) is a Borel set over \( R^n \). Since it is a distribution function, \( P(x,R^n)=1 \), where it is permitted that the chain can make a transition from the point \( x \) to \( x \), that is \( P(x, {x}) \) is not necessarily zero.

Definition at line 32 of file Algorithm.h.

Constructor & Destructor Documentation

template<class V , class M >
QUESO::BaseTKGroup< V, M >::BaseTKGroup ( )

Default constructor.

Definition at line 33 of file TKGroup.C.

34  :
35  m_emptyEnv (new EmptyEnvironment()),
36  m_env (*m_emptyEnv),
37  m_prefix (""),
38  m_vectorSpace (NULL),
39  m_scales (),
41  m_rvs (),
42  m_stageId (0)
43 {
44 }
std::string m_prefix
Definition: TKGroup.h:129
unsigned int m_stageId
Definition: TKGroup.h:134
std::vector< const V * > m_preComputingPositions
Definition: TKGroup.h:132
std::vector< BaseVectorRV< V, M > * > m_rvs
Definition: TKGroup.h:133
const BaseEnvironment & m_env
Definition: TKGroup.h:128
const EmptyEnvironment * m_emptyEnv
Definition: TKGroup.h:127
const VectorSpace< V, M > * m_vectorSpace
Definition: TKGroup.h:130
std::vector< double > m_scales
Definition: TKGroup.h:131
template<class V, class M>
QUESO::BaseTKGroup< V, M >::BaseTKGroup ( const char *  prefix,
const VectorSpace< V, M > &  vectorSpace,
const std::vector< double > &  scales 
)

Constructor.

Definition at line 47 of file TKGroup.C.

References QUESO::BaseTKGroup< V, M >::m_scales.

51  :
52  m_emptyEnv (NULL),
53  m_env (vectorSpace.env()),
54  m_prefix (prefix),
55  m_vectorSpace (&vectorSpace),
56  m_scales (scales.size(),1.),
57  m_preComputingPositions(scales.size()+1,NULL), // Yes, +1
58  m_rvs (scales.size(),NULL), // IMPORTANT: it stays like this for scaledTK, but it will be overwritten to '+1' by hessianTK constructor
59  m_stageId (0)
60 {
61  for (unsigned int i = 0; i < m_scales.size(); ++i) {
62  m_scales[i] = scales[i];
63  }
64 }
std::string m_prefix
Definition: TKGroup.h:129
unsigned int m_stageId
Definition: TKGroup.h:134
std::vector< const V * > m_preComputingPositions
Definition: TKGroup.h:132
std::vector< BaseVectorRV< V, M > * > m_rvs
Definition: TKGroup.h:133
const BaseEnvironment & m_env
Definition: TKGroup.h:128
const EmptyEnvironment * m_emptyEnv
Definition: TKGroup.h:127
const VectorSpace< V, M > * m_vectorSpace
Definition: TKGroup.h:130
std::vector< double > m_scales
Definition: TKGroup.h:131
template<class V , class M >
QUESO::BaseTKGroup< V, M >::~BaseTKGroup ( )
virtual

Destructor.

Definition at line 67 of file TKGroup.C.

68 {
69  for (unsigned int i = 0; i < m_rvs.size(); ++i) {
70  if (m_rvs[i]) delete m_rvs[i];
71  }
72  for (unsigned int i = 0; i < m_preComputingPositions.size(); ++i) {
74  }
75  if (m_emptyEnv) delete m_emptyEnv;
76 }
std::vector< const V * > m_preComputingPositions
Definition: TKGroup.h:132
std::vector< BaseVectorRV< V, M > * > m_rvs
Definition: TKGroup.h:133
const EmptyEnvironment * m_emptyEnv
Definition: TKGroup.h:127

Member Function Documentation

template<class V, class M>
virtual void QUESO::BaseTKGroup< V, M >::cleanCovMatrix ( )
pure virtual

Performs whatever cleanup is needed (usually just resetting an internal bool flag) after the covariance matrix was modified.

After this method is called, covMatrixIsDirty should return true.

Implemented in QUESO::TransformedScaledCovMatrixTKGroup< V, M >, QUESO::MetropolisAdjustedLangevinTK< V, M >, QUESO::ScaledCovMatrixTKGroup< V, M >, and QUESO::HessianCovMatricesTKGroup< V, M >.

template<class V , class M >
void QUESO::BaseTKGroup< V, M >::clearPreComputingPositions ( )
virtual
template<class V, class M>
virtual bool QUESO::BaseTKGroup< V, M >::covMatrixIsDirty ( )
pure virtual

This method determines whether or not the user has 'dirtied' the covariance matrix, thereby necessitating an AM reset.

Should return true if the cov matrix was modified in such a way to affect the Adaptive Metropolis sample covariance calculation.

Implemented in QUESO::TransformedScaledCovMatrixTKGroup< V, M >, QUESO::MetropolisAdjustedLangevinTK< V, M >, QUESO::ScaledCovMatrixTKGroup< V, M >, and QUESO::HessianCovMatricesTKGroup< V, M >.

template<class V , class M >
const BaseEnvironment & QUESO::BaseTKGroup< V, M >::env ( ) const

QUESO's environment.

Definition at line 80 of file TKGroup.C.

81 {
82  return m_env;
83 }
const BaseEnvironment & m_env
Definition: TKGroup.h:128
template<class V , class M >
const V & QUESO::BaseTKGroup< V, M >::preComputingPosition ( unsigned int  stageId) const

Pre-computing position; access to protected attribute *m_preComputingPositions[stageId].

Definition at line 87 of file TKGroup.C.

88 {
89  queso_require_greater_msg(m_preComputingPositions.size(), stageId, "m_preComputingPositions.size() <= stageId");
90 
91  queso_require_msg(m_preComputingPositions[stageId], "m_preComputingPositions[stageId] == NULL");
92 
93  return *m_preComputingPositions[stageId];
94 }
std::vector< const V * > m_preComputingPositions
Definition: TKGroup.h:132
template<class V , class M >
void QUESO::BaseTKGroup< V, M >::print ( std::ostream &  os) const
virtual
template<class V, class M>
virtual const BaseVectorRV<V,M>& QUESO::BaseTKGroup< V, M >::rv ( unsigned int  stageId) const
pure virtual

Gaussian increment property to construct a transition kernel. See template specialization.

Implemented in QUESO::TransformedScaledCovMatrixTKGroup< V, M >, QUESO::HessianCovMatricesTKGroup< V, M >, QUESO::ScaledCovMatrixTKGroup< V, M >, and QUESO::MetropolisAdjustedLangevinTK< V, M >.

template<class V, class M>
virtual const BaseVectorRV<V,M>& QUESO::BaseTKGroup< V, M >::rv ( const std::vector< unsigned int > &  stageIds)
pure virtual

Gaussian increment property to construct a transition kernel. See template specialization.

Implemented in QUESO::TransformedScaledCovMatrixTKGroup< V, M >, QUESO::HessianCovMatricesTKGroup< V, M >, QUESO::ScaledCovMatrixTKGroup< V, M >, and QUESO::MetropolisAdjustedLangevinTK< V, M >.

template<class V, class M>
virtual const BaseVectorRV<V, M>& QUESO::BaseTKGroup< V, M >::rv ( const V &  position) const
pure virtual
template<class V , class M >
unsigned int QUESO::BaseTKGroup< V, M >::set_dr_stage ( unsigned int  stageId)
virtual

Does nothing. Subclasses may re-implement. Returns the current stage id.

Reimplemented in QUESO::TransformedScaledCovMatrixTKGroup< V, M >, QUESO::ScaledCovMatrixTKGroup< V, M >, and QUESO::HessianCovMatricesTKGroup< V, M >.

Definition at line 125 of file TKGroup.C.

126 {
127  return this->m_stageId;
128 }
unsigned int m_stageId
Definition: TKGroup.h:134
template<class V, class M >
bool QUESO::BaseTKGroup< V, M >::setPreComputingPosition ( const V &  position,
unsigned int  stageId 
)
virtual

Sets the pre-computing positions m_preComputingPositions[stageId] with a new vector of size position.

Reimplemented in QUESO::TransformedScaledCovMatrixTKGroup< V, M >, QUESO::MetropolisAdjustedLangevinTK< V, M >, QUESO::ScaledCovMatrixTKGroup< V, M >, and QUESO::HessianCovMatricesTKGroup< V, M >.

Definition at line 98 of file TKGroup.C.

Referenced by QUESO::HessianCovMatricesTKGroup< V, M >::setPreComputingPosition(), QUESO::ScaledCovMatrixTKGroup< V, M >::setPreComputingPosition(), QUESO::MetropolisAdjustedLangevinTK< V, M >::setPreComputingPosition(), and QUESO::TransformedScaledCovMatrixTKGroup< V, M >::setPreComputingPosition().

99 {
100  queso_require_greater_msg(m_preComputingPositions.size(), stageId, "m_preComputingPositions.size() <= stageId");
101 
102  queso_require_msg(!(m_preComputingPositions[stageId]), "m_preComputingPositions[stageId] != NULL");
103 
104  m_preComputingPositions[stageId] = new V(position);
105 
106  return true;
107 }
std::vector< const V * > m_preComputingPositions
Definition: TKGroup.h:132
template<class V, class M>
virtual bool QUESO::BaseTKGroup< V, M >::symmetric ( ) const
pure virtual
template<class V, class M>
virtual void QUESO::BaseTKGroup< V, M >::updateTK ( )
inlinevirtual

The user can override this method to implement state-dependent transition kernel behaviour.

Default behaviour is a no-op.

Definition at line 102 of file TKGroup.h.

102 { };

Member Data Documentation

template<class V, class M>
const EmptyEnvironment* QUESO::BaseTKGroup< V, M >::m_emptyEnv
protected

Definition at line 127 of file TKGroup.h.

template<class V, class M>
std::string QUESO::BaseTKGroup< V, M >::m_prefix
protected

Definition at line 129 of file TKGroup.h.

template<class V, class M>
unsigned int QUESO::BaseTKGroup< V, M >::m_stageId
protected

Definition at line 134 of file TKGroup.h.

template<class V, class M>
const VectorSpace<V,M>* QUESO::BaseTKGroup< V, M >::m_vectorSpace
protected

Definition at line 130 of file TKGroup.h.


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

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