hops
StateTransformation.hpp
Go to the documentation of this file.
1 #ifndef HOPS_STATETRANSFORMATION_HPP
2 #define HOPS_STATETRANSFORMATION_HPP
3 
4 namespace hops {
10  template<typename MarkovChainImpl, typename Transformation>
11  class StateTransformation : public MarkovChainImpl {
12  public:
13  explicit StateTransformation(const MarkovChainImpl &markovChainImpl, Transformation transformation) :
14  MarkovChainImpl(markovChainImpl),
15  transformation(transformation) {}
16 
17  typename MarkovChainImpl::StateType getState() {
18  return transformation.apply(MarkovChainImpl::getState());
19  }
20 
21  typename MarkovChainImpl::StateType getProposal() {
22  return transformation.apply(MarkovChainImpl::getProposal());
23  }
24 
25  void setState(const typename MarkovChainImpl::StateType &state) {
26  MarkovChainImpl::setState(transformation.applyInverse(state));
27  }
28 
29  private:
30  Transformation transformation;
31  };
32 }
33 
34 #endif //HOPS_STATETRANSFORMATION_HPP
hops::Transformation
Definition: Transformation.hpp:13
hops::StateTransformation::getProposal
MarkovChainImpl::StateType getProposal()
Definition: StateTransformation.hpp:21
hops::Transformation::applyInverse
VectorType applyInverse(VectorType vector)
Definition: Transformation.hpp:26
hops::StateTransformation::getState
MarkovChainImpl::StateType getState()
Definition: StateTransformation.hpp:17
hops::StateTransformation::StateTransformation
StateTransformation(const MarkovChainImpl &markovChainImpl, Transformation transformation)
Definition: StateTransformation.hpp:13
hops::StateTransformation::setState
void setState(const typename MarkovChainImpl::StateType &state)
Definition: StateTransformation.hpp:25
hops
Definition: CsvReader.hpp:8
hops::StateTransformation
Mixin for undoing transformations to the Markov chain state.
Definition: StateTransformation.hpp:11
hops::Transformation::apply
VectorType apply(VectorType vector)
Transforms vector from rounded space to unrounded space.
Definition: Transformation.hpp:22