bpp-phyl3  3.0.0
BinarySubstitutionModel.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_PHYL_MODEL_BINARYSUBSTITUTIONMODEL_H
6 #define BPP_PHYL_MODEL_BINARYSUBSTITUTIONMODEL_H
7 
9 
11 
12 namespace bpp
13 {
82 {
83 private:
84  double kappa_;
85 
86 protected:
87  mutable double lambda_, exp_;
89 
90 public:
91  BinarySubstitutionModel(std::shared_ptr<const BinaryAlphabet> alpha, double kappa = 1.);
92 
94 
95  BinarySubstitutionModel* clone() const { return new BinarySubstitutionModel(*this); }
96 
97 public:
98  double Pij_t (size_t i, size_t j, double d) const;
99  double dPij_dt (size_t i, size_t j, double d) const;
100  double d2Pij_dt2(size_t i, size_t j, double d) const;
101  const Matrix<double>& getPij_t (double d) const;
102  const Matrix<double>& getdPij_dt (double d) const;
103  const Matrix<double>& getd2Pij_dt2(double d) const;
104 
105  std::string getName() const { return "Binary"; }
106 
107  void setFreq(std::map<int, double>& freqs);
108 
109  size_t getNumberOfStates() const { return 2; }
110 
111 protected:
112  void updateMatrices_();
113 };
114 } // end of namespace bpp.
115 #endif // BPP_PHYL_MODEL_BINARYSUBSTITUTIONMODEL_H
Partial implementation of the ReversibleSubstitutionModel interface.
double d2Pij_dt2(size_t i, size_t j, double d) const
BinarySubstitutionModel * clone() const
double Pij_t(size_t i, size_t j, double d) const
void updateMatrices_()
Compute and diagonalize the matrix, and fill the eigenValues_, leftEigenVectors_ and rightEigenVecto...
void setFreq(std::map< int, double > &freqs)
Set equilibrium frequencies.
const Matrix< double > & getPij_t(double d) const
size_t getNumberOfStates() const
Get the number of states.
std::string getName() const
Get the name of the model.
const Matrix< double > & getdPij_dt(double d) const
const Matrix< double > & getd2Pij_dt2(double d) const
double dPij_dt(size_t i, size_t j, double d) const
BinarySubstitutionModel(std::shared_ptr< const BinaryAlphabet > alpha, double kappa=1.)
Defines the basic types of data flow nodes.