5 #ifndef BPP_PHYL_LEGACY_LIKELIHOOD_ABSTRACTTREELIKELIHOOD_H
6 #define BPP_PHYL_LEGACY_LIKELIHOOD_ABSTRACTTREELIKELIHOOD_H
11 #include "../../Model/SubstitutionModel.h"
60 throw Exception(
"AbstractTreeLikelihood::SimpleBranchIterator::next(). No more branch in the set.");
90 throw Exception(
"AbstractTreeLikelihood::SimpleSiteIterator::next(). No more site in the set.");
106 std::shared_ptr<const TransitionModelInterface>
model_;
126 std::shared_ptr<const TransitionModelInterface>
getModel()
const override {
return model_; }
131 return std::dynamic_pointer_cast<const SubstitutionModelInterface>(
model_);
157 throw Exception(
"AbstractHomogeneousTreeLikelihood::ConstHomogeneousBranchModelIterator::next(). No more branch in the set.");
169 std::shared_ptr<const TransitionModelInterface>
model_;
189 std::shared_ptr<const TransitionModelInterface>
getModel()
const override {
return model_; }
194 return std::dynamic_pointer_cast<const SubstitutionModelInterface>(
model_);
208 std::unique_ptr<const AlignmentDataInterface>
data_;
209 mutable std::shared_ptr< TreeTemplate<Node>>
tree_;
231 if (lik.
data_)
data_ = std::unique_ptr<AlignmentDataInterface>(lik.
data_->clone());
232 if (lik.
tree_)
tree_ = std::unique_ptr< TreeTemplate<Node>>(lik.
tree_->clone());
237 AbstractParametrizable::operator=(lik);
238 if (lik.
data_)
data_ = std::unique_ptr<AlignmentDataInterface>(lik.
data_->clone());
240 if (lik.
tree_)
tree_ = std::unique_ptr< TreeTemplate<Node>>(lik.
tree_->clone());
const SubstitutionModelInterface & substitutionModel() const override
std::shared_ptr< const TransitionModelInterface > model_
ConstNoPartitionBranchModelDescription(std::shared_ptr< const TransitionModelInterface > model, size_t nbSites)
std::shared_ptr< const SubstitutionModelInterface > getSubstitutionModel() const override
std::shared_ptr< const TransitionModelInterface > getModel() const override
ConstNoPartitionBranchModelDescription(const ConstNoPartitionBranchModelDescription &bmd)
const TransitionModelInterface & model() const override
ConstNoPartitionBranchModelDescription & operator=(const ConstNoPartitionBranchModelDescription &bmd)
SiteIterator * getNewSiteIterator() const override
ConstNoPartitionBranchModelIterator(std::shared_ptr< const TransitionModelInterface > model, size_t nbSites)
ConstNoPartitionBranchModelDescription * next()
ConstNoPartitionBranchModelDescription branchModelDescription_
std::shared_ptr< const SubstitutionModelInterface > getSubstitutionModel() const override
std::shared_ptr< const TransitionModelInterface > model_
BranchIterator * getNewBranchIterator() const override
const TransitionModelInterface & model() const override
ConstNoPartitionSiteModelDescription(std::shared_ptr< const TransitionModelInterface > model, const std::vector< int > nodesId)
const SubstitutionModelInterface & substitutionModel() const override
ConstNoPartitionSiteModelDescription(const ConstNoPartitionSiteModelDescription &smd)
std::vector< int > nodesId_
ConstNoPartitionSiteModelDescription & operator=(const ConstNoPartitionSiteModelDescription &smd)
std::shared_ptr< const TransitionModelInterface > getModel() const override
A very simple branch iterator.
std::vector< int > nodesId_
SimpleBranchIterator(const std::vector< int > &nodesId)
A very simple site iterator.
SimpleSiteIterator(size_t nbSites, size_t offset=0)
Partial implementation of the TreeLikelihood interface.
void initialize()
Init the likelihood object.
const AlignmentDataInterface & data() const
Get the dataset for which the likelihood must be evaluated.
void enableFirstOrderDerivatives(bool yn)
void enableDerivatives(bool yn)
Tell if derivatives must be computed.
const Tree & tree() const
Get the tree (topology and branch lengths).
void enableSecondOrderDerivatives(bool yn)
AbstractTreeLikelihood & operator=(const AbstractTreeLikelihood &lik)
std::unique_ptr< const AlignmentDataInterface > data_
std::shared_ptr< TreeTemplate< Node > > tree_
AbstractTreeLikelihood(const AbstractTreeLikelihood &lik)
Vdouble getLikelihoodPerSite() const
Get the likelihood for each site.
bool isInitialized() const
bool hasLikelihoodData() const
bool enableFirstOrderDerivatives() const
VVdouble getLikelihoodPerSitePerState() const
Get the likelihood for each site and for each state.
std::shared_ptr< const Alphabet > getAlphabet() const
Get the alphabet associated to the dataset.
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.
bool enableSecondOrderDerivatives() const
size_t getNumberOfSites() const
Get the number of sites in the dataset.
virtual ~AbstractTreeLikelihood()
Abstract class destructor.
bool computeFirstOrderDerivatives_
bool computeSecondOrderDerivatives_
Interface for all substitution models.
Interface for all transition models.
An iterator over a set of branches, specified by their node ids.
A pair of SubstitutionModel / SiteIterator.
Iterates through all models used for all sites on a given branch.
A pair of SubstitutionModel / BranchIterator.
An iterator over a set of sites, specified by their position.
The TreeLikelihood interface.
Interface for phylogenetic tree objects.
Defines the basic types of data flow nodes.
std::vector< double > Vdouble
std::vector< Vdouble > VVdouble