bpp-phyl3  3.0.0
bpp::BranchLikelihood Class Referenceabstract

Compute likelihood for a 4-tree. More...

#include <Bpp/Phyl/Legacy/Likelihood/NNIHomogeneousTreeLikelihood.h>

+ Inheritance diagram for bpp::BranchLikelihood:
+ Collaboration diagram for bpp::BranchLikelihood:

Public Member Functions

 BranchLikelihood (const std::vector< unsigned int > &weights)
 
 BranchLikelihood (const BranchLikelihood &bl)
 
BranchLikelihoodoperator= (const BranchLikelihood &bl)
 
virtual ~BranchLikelihood ()
 
BranchLikelihoodclone () const
 
void initModel (std::shared_ptr< const TransitionModelInterface > model, std::shared_ptr< const DiscreteDistributionInterface > rDist)
 
void initLikelihoods (const VVVdouble *array1, const VVVdouble *array2)
 
void resetLikelihoods ()
 
void setParameters (const ParameterList &parameters)
 
double getValue () const
 
void fireParameterChanged (const ParameterList &parameters)
 
virtual double f (const ParameterList &parameters)
 
virtual bool hasParameter (const std::string &name) const=0
 
virtual const ParameterListgetParameters () const=0
 
virtual const Parameterparameter (const std::string &name) const=0
 
virtual double getParameterValue (const std::string &name) const=0
 
virtual void setAllParametersValues (const ParameterList &parameters)=0
 
virtual void setParameterValue (const std::string &name, double value)=0
 
virtual void setParametersValues (const ParameterList &parameters)=0
 
virtual bool matchParametersValues (const ParameterList &parameters)=0
 
virtual void removeConstraint (const std::string &name)=0
 
virtual void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint)=0
 
virtual size_t getNumberOfParameters () const=0
 
virtual void setNamespace (const std::string &prefix)=0
 
virtual std::string getNamespace () const=0
 
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const=0
 
bool hasParameter (const std::string &name) const override
 
const ParameterListgetParameters () const override
 
const Parameterparameter (const std::string &name) const override
 
const std::shared_ptr< Parameter > & getParameter (const std::string &name) const
 
double getParameterValue (const std::string &name) const override
 
void setAllParametersValues (const ParameterList &parameters) override
 
void setParameterValue (const std::string &name, double value) override
 
void setParametersValues (const ParameterList &parameters) override
 
bool matchParametersValues (const ParameterList &parameters) override
 
void removeConstraint (const std::string &name) override
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 
size_t getNumberOfParameters () const override
 
void setNamespace (const std::string &prefix) override
 
std::string getNamespace () const override
 
std::string getParameterNameWithoutNamespace (const std::string &name) const override
 

Protected Member Functions

void computeAllTransitionProbabilities ()
 
void computeLogLikelihood ()
 
virtual ParameterListgetParameters_ ()=0
 
const std::shared_ptr< Parameter > & getParameter (size_t i) const
 
std::shared_ptr< Parameter > & getParameter (size_t i)
 
virtual void addParameter_ (Parameter *parameter)
 
virtual void addParameters_ (const ParameterList &parameters)
 
virtual void shareParameter_ (const std::shared_ptr< Parameter > &parameter)
 
virtual void shareParameters_ (const ParameterList &parameters)
 
virtual void includeParameters_ (const ParameterList &parameters)
 
virtual void deleteParameter_ (size_t index)
 
virtual void deleteParameter_ (std::string &name)
 
virtual void deleteParameters_ (const std::vector< std::string > &names)
 
void resetParameters_ ()
 
ParametergetParameter_ (const std::string &name)
 
ParametergetParameter_ (size_t index)
 
const ParametergetParameter_ (size_t index) const
 
ParametergetParameterWithNamespace_ (const std::string &name)
 
const ParametergetParameterWithNamespace_ (const std::string &name) const
 
ParameterListgetParameters_ () override
 

Protected Attributes

const VVVdoublearray1_
 
const VVVdoublearray2_
 
std::shared_ptr< const TransitionModelInterfacemodel_
 
std::shared_ptr< const DiscreteDistributionInterfacerDist_
 
size_t nbStates_
 
size_t nbClasses_
 
VVVdouble pxy_
 
double lnL_
 
std::vector< unsigned int > weights_
 

Private Attributes

ParameterList parameters_
 
std::string prefix_
 

Detailed Description

Compute likelihood for a 4-tree.

This class is used internally by DRHomogeneousTreeLikelihood to test NNI movements. This function needs:

  • two likelihood arrays corresponding to the conditional likelihoods at top and bottom nodes,
  • a substitution model and a rate distribution, whose parameters will not be estimated but taken "as is", It takes only one parameter, the branch length.

Definition at line 27 of file NNIHomogeneousTreeLikelihood.h.

Constructor & Destructor Documentation

◆ BranchLikelihood() [1/2]

bpp::BranchLikelihood::BranchLikelihood ( const std::vector< unsigned int > &  weights)
inline

Definition at line 41 of file NNIHomogeneousTreeLikelihood.h.

References bpp::AbstractParametrizable::addParameter_().

Referenced by clone().

◆ BranchLikelihood() [2/2]

bpp::BranchLikelihood::BranchLikelihood ( const BranchLikelihood bl)
inline

Definition at line 56 of file NNIHomogeneousTreeLikelihood.h.

◆ ~BranchLikelihood()

virtual bpp::BranchLikelihood::~BranchLikelihood ( )
inlinevirtual

Definition at line 84 of file NNIHomogeneousTreeLikelihood.h.

Member Function Documentation

◆ clone()

BranchLikelihood* bpp::BranchLikelihood::clone ( ) const
inlinevirtual

Implements bpp::AbstractParametrizable.

Definition at line 86 of file NNIHomogeneousTreeLikelihood.h.

References BranchLikelihood().

◆ computeAllTransitionProbabilities()

void BranchLikelihood::computeAllTransitionProbabilities ( )
protected

Definition at line 39 of file NNIHomogeneousTreeLikelihood.cpp.

Referenced by fireParameterChanged().

◆ computeLogLikelihood()

void BranchLikelihood::computeLogLikelihood ( )
protected

Definition at line 60 of file NNIHomogeneousTreeLikelihood.cpp.

References bpp::log().

Referenced by fireParameterChanged().

◆ fireParameterChanged()

void bpp::BranchLikelihood::fireParameterChanged ( const ParameterList parameters)
inlinevirtual

◆ getValue()

double bpp::BranchLikelihood::getValue ( ) const
inlinevirtual

Implements bpp::FunctionInterface.

Definition at line 114 of file NNIHomogeneousTreeLikelihood.h.

References lnL_.

◆ initLikelihoods()

void bpp::BranchLikelihood::initLikelihoods ( const VVVdouble array1,
const VVVdouble array2 
)
inline
Warning
No checking on alphabet size or number of rate classes is performed, use with care!

Definition at line 97 of file NNIHomogeneousTreeLikelihood.h.

References array1_, and array2_.

◆ initModel()

void BranchLikelihood::initModel ( std::shared_ptr< const TransitionModelInterface model,
std::shared_ptr< const DiscreteDistributionInterface rDist 
)

Definition at line 19 of file NNIHomogeneousTreeLikelihood.cpp.

◆ operator=()

BranchLikelihood& bpp::BranchLikelihood::operator= ( const BranchLikelihood bl)
inline

Definition at line 69 of file NNIHomogeneousTreeLikelihood.h.

References array1_, array2_, lnL_, model_, nbClasses_, nbStates_, pxy_, rDist_, and weights_.

◆ resetLikelihoods()

void bpp::BranchLikelihood::resetLikelihoods ( )
inline

Definition at line 103 of file NNIHomogeneousTreeLikelihood.h.

References array1_, and array2_.

◆ setParameters()

void bpp::BranchLikelihood::setParameters ( const ParameterList parameters)
inlinevirtual

Member Data Documentation

◆ array1_

const VVVdouble* bpp::BranchLikelihood::array1_
protected

Definition at line 32 of file NNIHomogeneousTreeLikelihood.h.

Referenced by initLikelihoods(), operator=(), and resetLikelihoods().

◆ array2_

const VVVdouble * bpp::BranchLikelihood::array2_
protected

Definition at line 32 of file NNIHomogeneousTreeLikelihood.h.

Referenced by initLikelihoods(), operator=(), and resetLikelihoods().

◆ lnL_

double bpp::BranchLikelihood::lnL_
protected

Definition at line 37 of file NNIHomogeneousTreeLikelihood.h.

Referenced by getValue(), and operator=().

◆ model_

std::shared_ptr<const TransitionModelInterface> bpp::BranchLikelihood::model_
protected

Definition at line 33 of file NNIHomogeneousTreeLikelihood.h.

Referenced by operator=().

◆ nbClasses_

size_t bpp::BranchLikelihood::nbClasses_
protected

Definition at line 35 of file NNIHomogeneousTreeLikelihood.h.

Referenced by operator=().

◆ nbStates_

size_t bpp::BranchLikelihood::nbStates_
protected

Definition at line 35 of file NNIHomogeneousTreeLikelihood.h.

Referenced by operator=().

◆ pxy_

VVVdouble bpp::BranchLikelihood::pxy_
protected

Definition at line 36 of file NNIHomogeneousTreeLikelihood.h.

Referenced by operator=().

◆ rDist_

std::shared_ptr<const DiscreteDistributionInterface> bpp::BranchLikelihood::rDist_
protected

Definition at line 34 of file NNIHomogeneousTreeLikelihood.h.

Referenced by operator=().

◆ weights_

std::vector<unsigned int> bpp::BranchLikelihood::weights_
protected

Definition at line 38 of file NNIHomogeneousTreeLikelihood.h.

Referenced by operator=().


The documentation for this class was generated from the following files: