bpp-phyl3  3.0.0
AbstractTreeLikelihoodData.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_LEGACY_LIKELIHOOD_ABSTRACTTREELIKELIHOODDATA_H
6 #define BPP_PHYL_LEGACY_LIKELIHOOD_ABSTRACTTREELIKELIHOODDATA_H
7 
8 
9 #include "TreeLikelihoodData.h"
10 
11 // From the STL:
12 #include <vector>
13 #include <map>
14 
15 namespace bpp
16 {
36  public TreeLikelihoodData
37 {
38 protected:
50  std::vector<size_t> rootPatternLinks_;
51 
55  std::vector<unsigned int> rootWeights_;
56 
57  std::shared_ptr<const TreeTemplate<Node>> tree_;
58 
59  std::shared_ptr<const Alphabet> alphabet_;
60 
61 public:
62  AbstractTreeLikelihoodData(std::shared_ptr< const TreeTemplate<Node>> tree) :
64 
68  tree_(atd.tree_),
69  alphabet_(atd.alphabet_)
70  {}
71 
73  {
76  tree_ = atd.tree_;
77  alphabet_ = atd.alphabet_;
78  return *this;
79  }
80 
81 
83 
84 public:
85  std::vector<size_t>& getRootArrayPositions() { return rootPatternLinks_; }
86  const std::vector<size_t>& getRootArrayPositions() const { return rootPatternLinks_; }
87  size_t getRootArrayPosition(const size_t site) const
88  {
89  return rootPatternLinks_[site];
90  }
91  unsigned int getWeight(size_t pos) const
92  {
93  return rootWeights_[pos];
94  }
95  const std::vector<unsigned int>& getWeights() const
96  {
97  return rootWeights_;
98  }
99 
100  std::shared_ptr<const Alphabet> getAlphabet() const { return alphabet_; }
101 
102  std::shared_ptr< const TreeTemplate<Node>> getTree() const { return tree_; }
103 };
104 } // end of namespace bpp.
105 #endif // BPP_PHYL_LEGACY_LIKELIHOOD_ABSTRACTTREELIKELIHOODDATA_H
Partial implementation of the TreeLikelihoodData interface.
AbstractTreeLikelihoodData & operator=(const AbstractTreeLikelihoodData &atd)
const std::vector< unsigned int > & getWeights() const
std::vector< size_t > rootPatternLinks_
Links between sites and patterns.
AbstractTreeLikelihoodData(std::shared_ptr< const TreeTemplate< Node >> tree)
std::shared_ptr< const Alphabet > alphabet_
std::vector< size_t > & getRootArrayPositions()
unsigned int getWeight(size_t pos) const
std::shared_ptr< const TreeTemplate< Node > > getTree() const
const std::vector< size_t > & getRootArrayPositions() const
AbstractTreeLikelihoodData(const AbstractTreeLikelihoodData &atd)
std::vector< unsigned int > rootWeights_
The frequency of each site.
std::shared_ptr< const TreeTemplate< Node > > tree_
size_t getRootArrayPosition(const size_t site) const
std::shared_ptr< const Alphabet > getAlphabet() const
TreeLikelihood data structure.
The phylogenetic tree class.
Definition: TreeTemplate.h:59
Defines the basic types of data flow nodes.