bpp-phyl3  3.0.0
AbstractTreeLikelihood.cpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
6 
7 using namespace bpp;
8 
9 /******************************************************************************/
10 
12 {
14  for (size_t i = 0; i < l.size(); i++)
15  {
16  l[i] = getLikelihoodForASite(i);
17  }
18  return l;
19 }
20 
21 /******************************************************************************/
22 
24 {
26  for (size_t i = 0; i < l.size(); i++)
27  {
28  l[i] = getLogLikelihoodForASite(i);
29  }
30  return l;
31 }
32 
33 /******************************************************************************/
34 
36 {
38  for (size_t i = 0; i < l.size(); i++)
39  {
40  Vdouble* l_i = &l[i];
41  l_i->resize(getNumberOfStates());
42  for (size_t x = 0; x < l_i->size(); x++)
43  {
44  (*l_i)[x] = getLikelihoodForASiteForAState(i, static_cast<int>(x));
45  }
46  }
47  return l;
48 }
49 
50 /******************************************************************************/
51 
53 {
55  for (size_t i = 0; i < l.size(); i++)
56  {
57  Vdouble* l_i = &l[i];
58  l_i->resize(getNumberOfStates());
59  for (size_t x = 0; x < l_i->size(); x++)
60  {
61  (*l_i)[x] = getLogLikelihoodForASiteForAState(i, static_cast<int>(x));
62  }
63  }
64  return l;
65 }
66 
67 /******************************************************************************/
Vdouble getLikelihoodPerSite() const
Get the likelihood for each site.
VVdouble getLikelihoodPerSitePerState() const
Get the likelihood for each site and for each state.
Vdouble getLogLikelihoodPerSite() const
Get the logarithm of the likelihood for each site.
VVdouble getLogLikelihoodPerSitePerState() const
Get the logarithm of the likelihood for each site and for each state.
size_t getNumberOfSites() const
Get the number of sites in the dataset.
virtual size_t getNumberOfStates() const =0
virtual double getLikelihoodForASiteForAState(size_t site, int state) const =0
Get the likelihood for a site and for a state.
virtual double getLogLikelihoodForASite(size_t site) const =0
Get the logarithm of the likelihood for a site.
virtual double getLikelihoodForASite(size_t site) const =0
Get the likelihood for a site.
virtual double getLogLikelihoodForASiteForAState(size_t site, int state) const =0
Get the logarithm of the likelihood for a site and for a state.
Defines the basic types of data flow nodes.
std::vector< double > Vdouble
std::vector< Vdouble > VVdouble