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
10
11// From the STL:
12#include <vector>
13#include <map>
14
15namespace bpp
16{
37{
38protected:
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
61public:
62 AbstractTreeLikelihoodData(std::shared_ptr< const TreeTemplate<Node>> tree) :
64
68 tree_(atd.tree_),
70 {}
71
73 {
76 tree_ = atd.tree_;
77 alphabet_ = atd.alphabet_;
78 return *this;
79 }
80
81
83
84public:
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.
const std::vector< size_t > & getRootArrayPositions() const
AbstractTreeLikelihoodData & operator=(const AbstractTreeLikelihoodData &atd)
AbstractTreeLikelihoodData(std::shared_ptr< const TreeTemplate< Node > > tree)
std::vector< size_t > rootPatternLinks_
Links between sites and patterns.
std::shared_ptr< const Alphabet > alphabet_
const std::vector< unsigned int > & getWeights() const
std::vector< size_t > & getRootArrayPositions()
unsigned int getWeight(size_t pos) const
AbstractTreeLikelihoodData(const AbstractTreeLikelihoodData &atd)
std::vector< unsigned int > rootWeights_
The frequency of each site.
std::shared_ptr< const TreeTemplate< Node > > tree_
std::shared_ptr< const TreeTemplate< Node > > getTree() const
std::shared_ptr< const Alphabet > getAlphabet() const
size_t getRootArrayPosition(const size_t site) const
TreeLikelihood data structure.
The phylogenetic tree class.
Definition: TreeTemplate.h:59
Defines the basic types of data flow nodes.