5#ifndef BPP_PHYL_LEGACY_LIKELIHOOD_DRASDRTREELIKELIHOODDATA_H
6#define BPP_PHYL_LEGACY_LIKELIHOOD_DRASDRTREELIKELIHOODDATA_H
9#include "../../Model/SubstitutionModel.h"
10#include "../../SitePatterns.h"
11#include "../../PatternTools.h"
187 mutable std::map<int, DRASDRTreeLikelihoodNodeData>
nodeData_;
188 mutable std::map<int, DRASDRTreeLikelihoodLeafData>
leafData_;
258 int id = it.second.getNode()->getId();
259 it.second.setNode(
tree_->getNode(
id));
263 int id = it.second.getNode()->getId();
264 it.second.setNode(
tree_->getNode(
id));
290 return currentPosition;
295 return nodeData_[nodeId].getLikelihoodArrays();
300 return nodeData_[nodeId].getLikelihoodArrays();
305 return nodeData_[parentId].getLikelihoodArrayForNeighbor(neighborId);
310 return nodeData_[parentId].getLikelihoodArrayForNeighbor(neighborId);
315 return nodeData_[nodeId].getDLikelihoodArray();
320 return nodeData_[nodeId].getDLikelihoodArray();
325 return nodeData_[nodeId].getD2LikelihoodArray();
330 return nodeData_[nodeId].getD2LikelihoodArray();
335 return leafData_[nodeId].getLikelihoodArray();
340 return leafData_[nodeId].getLikelihoodArray();
Partial implementation of the TreeLikelihoodData interface.
AbstractTreeLikelihoodData & operator=(const AbstractTreeLikelihoodData &atd)
std::shared_ptr< const TreeTemplate< Node > > tree_
Likelihood data structure for rate across sites models, using a double-recursive algorithm.
size_t getNumberOfSites() const
const std::map< int, VVVdouble > & getLikelihoodArrays(int nodeId) const
VVVdouble & getLikelihoodArray(int parentId, int neighborId)
const DRASDRTreeLikelihoodLeafData & getLeafData(int nodeId) const
VVVdouble rootLikelihoods_
size_t getNumberOfClasses() const
const Vdouble & getRootRateSiteLikelihoodArray() const
VVdouble & getLeafLikelihoods(int nodeId)
DRASDRTreeLikelihoodData(const DRASDRTreeLikelihoodData &data)
const DRASDRTreeLikelihoodNodeData & getNodeData(int nodeId) const
std::shared_ptr< const AlignmentDataInterface > getShrunkData() const
DRASDRTreeLikelihoodNodeData & getNodeData(int nodeId)
DRASDRTreeLikelihoodData * clone() const
void setTree(std::shared_ptr< const TreeTemplate< Node > > tree)
Set the tree associated to the data.
std::map< int, VVVdouble > & getLikelihoodArrays(int nodeId)
virtual ~DRASDRTreeLikelihoodData()
void reInit()
Rebuild likelihood arrays at inner nodes.
const VVVdouble & getRootLikelihoodArray() const
DRASDRTreeLikelihoodData & operator=(const DRASDRTreeLikelihoodData &data)
size_t getNumberOfStates() const
const VVVdouble & getLikelihoodArray(int parentId, int neighborId) const
const Vdouble & getD2LikelihoodArray(int nodeId) const
DRASDRTreeLikelihoodData(std::shared_ptr< const TreeTemplate< Node > > tree, size_t nbClasses)
const VVdouble & getRootSiteLikelihoodArray() const
const VVdouble & getLeafLikelihoods(int nodeId) const
const Vdouble & getDLikelihoodArray(int nodeId) const
VVdouble & getRootSiteLikelihoodArray()
Vdouble & getRootRateSiteLikelihoodArray()
const AlignmentDataInterface & shrunkData() const
VVdouble rootLikelihoodsS_
void initLikelihoods(const AlignmentDataInterface &sites, const TransitionModelInterface &model)
Resize and initialize all likelihood arrays according to the given data set and substitution model.
Vdouble rootLikelihoodsSR_
std::map< int, DRASDRTreeLikelihoodNodeData > nodeData_
std::map< int, DRASDRTreeLikelihoodLeafData > leafData_
Vdouble & getDLikelihoodArray(int nodeId)
size_t getArrayPosition(int parentId, int sonId, size_t currentPosition) const
std::shared_ptr< AlignmentDataInterface > shrunkData_
size_t getNumberOfDistinctSites() const
VVVdouble & getRootLikelihoodArray()
DRASDRTreeLikelihoodLeafData & getLeafData(int nodeId)
Vdouble & getD2LikelihoodArray(int nodeId)
Likelihood data structure for a leaf.
DRASDRTreeLikelihoodLeafData & operator=(const DRASDRTreeLikelihoodLeafData &data)
DRASDRTreeLikelihoodLeafData * clone() const
const Node * getNode() const
Get the node associated to this data structure.
DRASDRTreeLikelihoodLeafData(const DRASDRTreeLikelihoodLeafData &data)
DRASDRTreeLikelihoodLeafData()
VVdouble & getLikelihoodArray()
void setNode(const Node *node)
Set the node associated to this data.
Likelihood data structure for a node.
const Node * getNode() const
Get the node associated to this data structure.
void setNode(const Node *node)
Set the node associated to this data.
DRASDRTreeLikelihoodNodeData()
Vdouble & getDLikelihoodArray()
Vdouble & getD2LikelihoodArray()
const std::map< int, VVVdouble > & getLikelihoodArrays() const
virtual ~DRASDRTreeLikelihoodNodeData()
VVVdouble & getLikelihoodArrayForNeighbor(int neighborId)
const Vdouble & getD2LikelihoodArrayForNeighbor() const
DRASDRTreeLikelihoodNodeData * clone() const
void eraseNeighborArrays()
bool isNeighbor(int neighborId) const
Vdouble nodeDLikelihoods_
This contains all likelihood first order derivatives values used for computation.
std::map< int, VVVdouble > & getLikelihoodArrays()
DRASDRTreeLikelihoodNodeData & operator=(const DRASDRTreeLikelihoodNodeData &data)
std::map< int, VVVdouble > nodeLikelihoods_
This contains all likelihood values used for computation.
DRASDRTreeLikelihoodNodeData(const DRASDRTreeLikelihoodNodeData &data)
const Vdouble & getDLikelihoodArray() const
const VVVdouble & getLikelihoodArrayForNeighbor(int neighborId) const
Vdouble nodeD2Likelihoods_
This contains all likelihood second order derivatives values used for computation.
The phylogenetic node class.
Interface for all transition models.
TreeLikelihood partial data structure.
The phylogenetic tree class.
Defines the basic types of data flow nodes.
std::vector< double > Vdouble
std::vector< VVdouble > VVVdouble
std::vector< Vdouble > VVdouble