bpp-phyl3  3.0.0
TwoParameterBinarySubstitutionModel.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_TWOPARAMETERBINARYSUBSTITUTIONMODEL_H
6 #define BPP_PHYL_MODEL_TWOPARAMETERBINARYSUBSTITUTIONMODEL_H
7 
9 
11 
12 namespace bpp
13 {
82 {
83 private:
84  double mu_;
85  double pi0_;
86 
87 protected:
88  mutable double lambda_, exp_;
90 
91 public:
92  TwoParameterBinarySubstitutionModel(std::shared_ptr<const BinaryAlphabet> alpha, double mu = 1., double pi0 = 0.5);
93 
95 
97 
98 public:
99  // the inherited functions don't do the work - need to override them with the correct computation
100  double Pij_t (size_t i, size_t j, double d) const;
101  double dPij_dt (size_t i, size_t j, double d) const;
102  double d2Pij_dt2(size_t i, size_t j, double d) const;
103  const Matrix<double>& getPij_t (double d) const;
104  const Matrix<double>& getdPij_dt (double d) const;
105  const Matrix<double>& getd2Pij_dt2(double d) const;
106 
107  std::string getName() const { return "TwoParameterBinary"; }
108 
109  size_t getNumberOfStates() const { return 2; }
110 
111  void setMuBounds(double lb, double ub);
112 
113 protected:
114  void updateMatrices_();
115 };
116 } // end of namespace bpp.
117 #endif // BPP_PHYL_MODEL_TWOPARAMETERBINARYSUBSTITUTIONMODEL_H
Partial implementation of the ReversibleSubstitutionModel interface.
const Matrix< double > & getd2Pij_dt2(double d) const
double dPij_dt(size_t i, size_t j, double d) const
std::string getName() const
Get the name of the model.
TwoParameterBinarySubstitutionModel(std::shared_ptr< const BinaryAlphabet > alpha, double mu=1., double pi0=0.5)
size_t getNumberOfStates() const
Get the number of states.
double d2Pij_dt2(size_t i, size_t j, double d) const
void updateMatrices_()
Compute and diagonalize the matrix, and fill the eigenValues_, leftEigenVectors_ and rightEigenVecto...
double Pij_t(size_t i, size_t j, double d) const
TwoParameterBinarySubstitutionModel * clone() const
Defines the basic types of data flow nodes.