bpp-core3  3.0.0
AbstractHmmTransitionMatrix.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_NUMERIC_HMM_ABSTRACTHMMTRANSITIONMATRIX_H
6 #define BPP_NUMERIC_HMM_ABSTRACTHMMTRANSITIONMATRIX_H
7 
8 
9 #include "../VectorTools.h"
10 #include "HmmStateAlphabet.h"
11 #include "HmmTransitionMatrix.h"
12 
13 namespace bpp
14 {
20  public virtual HmmTransitionMatrix
21 {
22 private:
23  std::shared_ptr<const HmmStateAlphabet> alph_;
24 
25 protected:
27 
28  mutable Vdouble eqFreq_;
29 
30  mutable bool upToDate_;
31 
32 public:
33  AbstractHmmTransitionMatrix(std::shared_ptr<const HmmStateAlphabet> alph, const std::string& prefix = "");
34 
36 
38 
42  std::shared_ptr<const HmmStateAlphabet> getHmmStateAlphabet() const
43  {
44  return alph_;
45  }
46 
51  {
52  return *alph_;
53  }
54 
60  void setHmmStateAlphabet(std::shared_ptr<const HmmStateAlphabet> stateAlphabet);
61 
65  size_t getNumberOfStates() const
66  {
67  return alph_->getNumberOfStates();
68  }
69 
78  std::vector<size_t> sample(size_t size) const;
79 };
80 } // end of namespace bpp
81 #endif // BPP_NUMERIC_HMM_ABSTRACTHMMTRANSITIONMATRIX_H
Hidden states alphabet.
AbstractHmmTransitionMatrix(std::shared_ptr< const HmmStateAlphabet > alph, const std::string &prefix="")
const HmmStateAlphabet & hmmStateAlphabet() const
std::shared_ptr< const HmmStateAlphabet > getHmmStateAlphabet() const
Partial implementation of HmmTransitionMatrix.
std::shared_ptr< const HmmStateAlphabet > alph_
std::vector< size_t > sample(size_t size) const
sampling of a sequence of states. Starting point is sampled from the equilibrium distribution.
std::vector< double > Vdouble
Definition: VectorTools.h:34
void setHmmStateAlphabet(std::shared_ptr< const HmmStateAlphabet > stateAlphabet)
Set the new hidden state alphabet.
AbstractHmmTransitionMatrix & operator=(const AbstractHmmTransitionMatrix &hptm)
Describe the transition probabilities between hidden states of a Hidden Markov Model.