bpp-phyl3  3.0.0
MixtureOfTransitionModels.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_MIXTUREOFTRANSITIONMODELS_H
6 #define BPP_PHYL_MODEL_MIXTUREOFTRANSITIONMODELS_H
7 
9 #include <cstring> // C lib for string copy
10 #include <map>
11 #include <string>
12 #include <vector>
13 
15 
16 namespace bpp
17 {
88 {
89 public:
100  std::shared_ptr<const Alphabet> alpha,
101  std::vector<std::unique_ptr<TransitionModelInterface>>& vpModel);
102 
117  std::shared_ptr<const Alphabet> alpha,
118  std::vector<std::unique_ptr<TransitionModelInterface>>& vpModel,
119  Vdouble& vproba, Vdouble& vrate);
120 
122 
124 
125  virtual ~MixtureOfTransitionModels();
126 
128  {
129  return new MixtureOfTransitionModels(*this);
130  }
131 
132 public:
133  std::string getName() const override { return "Mixture"; }
134 
138  const TransitionModelInterface& model(const std::string& name) const override;
139 
140  const TransitionModelInterface& model(size_t i) const
141  {
143  }
144 
145  void updateMatrices_() override;
146 
154  virtual void setVRates(const Vdouble& vd) override;
155 
163  Vuint getSubmodelNumbers(const std::string& desc) const override;
164 
169  void setFreq(std::map<int, double>&) override;
170 };
171 } // end of namespace bpp.
172 #endif // BPP_PHYL_MODEL_MIXTUREOFTRANSITIONMODELS_H
Partial implementation for Mixed Transition models, defined as a mixture of "simple" substitution mod...
const TransitionModelInterface & nModel(size_t i) const override
Returns a specific model from the mixture.
Transition models defined as a mixture of several substitution models.
virtual void setVRates(const Vdouble &vd) override
Sets the rates of the submodels to follow the constraint that the mean rate of the mixture equals rat...
void updateMatrices_() override
Diagonalize the matrix, and fill the eigenValues_, iEigenValues_, leftEigenVectors_ and rightEigenVe...
MixtureOfTransitionModels(std::shared_ptr< const Alphabet > alpha, std::vector< std::unique_ptr< TransitionModelInterface >> &vpModel)
Constructor of a MixtureOfTransitionModels, where all the models have rate 1 and equal probability.
MixtureOfTransitionModels & operator=(const MixtureOfTransitionModels &)
std::string getName() const override
Get the name of the model.
void setFreq(std::map< int, double > &) override
applies setFreq to all the models of the mixture and recovers the parameters values.
MixtureOfTransitionModels * clone() const override
const TransitionModelInterface & model(size_t i) const
Vuint getSubmodelNumbers(const std::string &desc) const override
Returns the vector of numbers of the submodels in the mixture that match a description of the paramet...
const TransitionModelInterface & model(const std::string &name) const override
retrieve a pointer to the submodel with the given name.
Interface for all transition models.
Defines the basic types of data flow nodes.
std::vector< double > Vdouble
std::vector< unsigned int > Vuint