bpp-phyl3  3.0.0
MixedTransitionModel.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_MIXEDTRANSITIONMODEL_H
6 #define BPP_PHYL_MODEL_MIXEDTRANSITIONMODEL_H
7 
8 #include <cstring> // C lib for string copy
9 #include <map>
10 #include <string>
11 #include <vector>
12 
13 #include "SubstitutionModel.h"
14 
15 namespace bpp
16 {
23  public virtual TransitionModelInterface
24 {
25 public:
27 
29 
30  virtual MixedTransitionModelInterface* clone() const override = 0;
31 
32 public:
36  virtual const TransitionModelInterface& nModel(size_t i) const = 0;
37 
38  virtual std::shared_ptr<const TransitionModelInterface> getNModel(size_t i) const = 0;
39 
43  virtual double getNProbability(size_t i) const = 0;
44 
45  virtual const std::vector<double>& getProbabilities() const = 0;
46 
50  virtual void setNProbability(size_t i, double prob) = 0;
51 
52  virtual size_t getNumberOfModels() const = 0;
53 
57  virtual const std::vector<double>& getVRates() const = 0;
58 
62  virtual double getNRate(size_t i) const = 0;
63 
72  virtual void setVRates(const Vdouble& vd) = 0;
73 
78  virtual void normalizeVRates() = 0;
79 
85  virtual const TransitionModelInterface& model(const std::string& name) const = 0;
86 
91  virtual Vuint getSubmodelNumbers(const std::string& desc) const = 0;
92 
93 protected:
94  virtual TransitionModelInterface& nModel_(size_t i) = 0;
95 
98 };
99 } // end of namespace bpp.
100 #endif // BPP_PHYL_MODEL_MIXEDTRANSITIONMODEL_H
Abstract class for mixture models based on the bibliography.
SubModel taken from a MixedTransitionModel, kept in the context of the MixedTransitionModel (see From...
Interface for Transition models, defined as a mixture of "simple" transition models.
virtual double getNProbability(size_t i) const =0
Returns the probability of a specific model from the mixture.
virtual const std::vector< double > & getProbabilities() const =0
virtual double getNRate(size_t i) const =0
Returns the rate of a specific submodel.
virtual void setVRates(const Vdouble &vd)=0
Sets the rates of the submodels to be proportional to a given vector, and normalizes them so that the...
virtual const std::vector< double > & getVRates() const =0
Returns the rates of the submodels.
virtual const TransitionModelInterface & nModel(size_t i) const =0
Returns a specific model from the mixture.
virtual MixedTransitionModelInterface * clone() const override=0
virtual void setNProbability(size_t i, double prob)=0
Sets the probability of a specific model from the mixture.
virtual void normalizeVRates()=0
Normalizes the rates of the submodels so that the mean rate of the mixture equals rate_.
virtual Vuint getSubmodelNumbers(const std::string &desc) const =0
Returns the vector of numbers of the submodels in the mixture that match a description.
virtual TransitionModelInterface & nModel_(size_t i)=0
virtual std::shared_ptr< const TransitionModelInterface > getNModel(size_t i) const =0
virtual size_t getNumberOfModels() const =0
virtual const TransitionModelInterface & model(const std::string &name) const =0
Access 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