bpp-core3  3.0.0
DirichletDiscreteDistribution.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_PROB_DIRICHLETDISCRETEDISTRIBUTION_H
6 #define BPP_NUMERIC_PROB_DIRICHLETDISCRETEDISTRIBUTION_H
7 
8 
9 #include "../../Exceptions.h"
10 #include "../../Io/OutputStream.h"
11 #include "../ParameterAliasable.h"
12 #include "../VectorTools.h"
15 
16 namespace bpp
17 {
70 {
71 private:
72  std::vector<BetaDiscreteDistribution* > vpBDD_;
73 
74 public:
81  DirichletDiscreteDistribution(std::vector<size_t> vn, Vdouble valpha);
82 
84 
86  {
87  return new DirichletDiscreteDistribution(*this);
88  }
89 
90 protected:
91  void applyParameters();
92 
93 public:
94  std::string getName() const {return "Dirichlet";}
95 
96  void fireParameterChanged(const ParameterList& parameters);
97 
101  size_t getNumberOfCategories() const;
102 
109  Vdouble getValueCategory(Vdouble& Vvalue) const;
110 
111  VVdouble getCategories() const;
112 
117  virtual double getProbability(Vdouble& category) const;
118 
128  Vdouble rand() const;
129 
136  Vdouble randC() const;
137 
138 protected:
139  void discretize(Vdouble& valpha);
140 };
141 } // end of namespace bpp.
142 #endif // BPP_NUMERIC_PROB_DIRICHLETDISCRETEDISTRIBUTION_H
Interface for multiple discrete distribution objects.
Vdouble rand() const
Draw a random vector from this distribution.
The parameter list object.
Definition: ParameterList.h:27
DirichletDiscreteDistribution * clone() const
Create a copy of this object and send a pointer to it.
A partial implementation of the Parametrizable interface.
std::vector< double > Vdouble
Definition: VectorTools.h:34
DirichletDiscreteDistribution(std::vector< size_t > vn, Vdouble valpha)
Build a new discretized Dirichlet distribution.
virtual double getProbability(Vdouble &category) const
void fireParameterChanged(const ParameterList &parameters)
Notify the class when one or several parameters have changed.
Vdouble randC() const
Draw a random vector from the continuous version of this distribution.
std::vector< BetaDiscreteDistribution *> vpBDD_
std::vector< Vdouble > VVdouble
Definition: VectorTools.h:35
Discretized Dirichlet distribution. If the distribution is in n dimensions, the domain is the n-1 sim...