bpp-phyl3  3.0.0
bpp::PhyloLikelihoodFormula Class Referenceabstract

The PhyloLikelihoodFormula class, for phylogenetic likelihood on several independent data. More...

#include <Bpp/Phyl/Likelihood/PhyloLikelihoods/PhyloLikelihoodFormula.h>

+ Inheritance diagram for bpp::PhyloLikelihoodFormula:
+ Collaboration diagram for bpp::PhyloLikelihoodFormula:

Public Member Functions

 PhyloLikelihoodFormula (Context &context, std::shared_ptr< PhyloLikelihoodContainer > pC, const std::string &formula, bool inCollection=true)
 
virtual ~PhyloLikelihoodFormula ()
 
void readFormula (const std::string &formula, bool inCollection=true)
 
std::string output () const
 
std::shared_ptr< PhyloLikelihoodContainergetPhyloContainer () override
 
std::shared_ptr< const PhyloLikelihoodContainergetPhyloContainer () const override
 
const std::vector< size_t > & getNumbersOfPhyloLikelihoods () const override
 
virtual bool addPhyloLikelihood (size_t nPhyl, const std::string &suff="") override
 adds a PhyloLikelihood already stored in the PhyloLikelihoodContainer, iff it is an AbstractPhyloLikelihood. More...
 
const Contextcontext () const override
 
Contextcontext () override
 
ValueRef< DataLikgetLikelihoodNode () const override
 
virtual void enableSecondOrderDerivatives (bool yn)=0
 
virtual bool enableSecondOrderDerivatives () const=0
 
virtual void enableSecondOrderDerivatives (bool yn) override
 
bool enableSecondOrderDerivatives () const override
 
virtual double getSecondOrderDerivative (const std::string &variable) const=0
 
virtual double getSecondOrderDerivative (const std::string &variable1, const std::string &variable2) const=0
 
double getSecondOrderDerivative (const std::string &variable) const override
 
double getSecondOrderDerivative (const std::string &variable1, const std::string &variable2) const override
 
virtual double d2f (const std::string &variable, const ParameterList &parameters)
 
virtual double d2f (const std::string &variable1, const std::string &variable2, const ParameterList &parameters)
 
virtual void enableFirstOrderDerivatives (bool yn)=0
 
virtual bool enableFirstOrderDerivatives () const=0
 
virtual void enableFirstOrderDerivatives (bool yn) override
 Tell if derivatives must be computed: for Function inheritance. More...
 
bool enableFirstOrderDerivatives () const override
 
virtual double getFirstOrderDerivative (const std::string &variable) const=0
 
double getFirstOrderDerivative (const std::string &variable) const override
 
virtual double df (const std::string &variable, const ParameterList &parameters)
 
virtual void setParameters (const ParameterList &parameters)=0
 
void setParameters (const ParameterList &parameters) override
 
virtual double getValue () const=0
 
double getValue () const override
 
virtual double f (const ParameterList &parameters)
 
virtual bool hasParameter (const std::string &name) const=0
 
bool hasParameter (const std::string &name) const override
 
virtual const ParameterListgetParameters () const=0
 
const ParameterListgetParameters () const override
 
virtual const Parameterparameter (const std::string &name) const=0
 
const Parameterparameter (const std::string &name) const override
 
virtual double getParameterValue (const std::string &name) const=0
 
double getParameterValue (const std::string &name) const override
 
virtual void setAllParametersValues (const ParameterList &parameters)=0
 
void setAllParametersValues (const ParameterList &parameters) override
 
virtual void setParameterValue (const std::string &name, double value)=0
 
void setParameterValue (const std::string &name, double value) override
 
virtual void setParametersValues (const ParameterList &parameters)=0
 
void setParametersValues (const ParameterList &parameters) override
 
virtual bool matchParametersValues (const ParameterList &parameters)=0
 
bool matchParametersValues (const ParameterList &parameters) override
 
virtual void removeConstraint (const std::string &name)=0
 
void removeConstraint (const std::string &name) override
 
virtual void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint)=0
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 
virtual size_t getNumberOfParameters () const=0
 
size_t getNumberOfParameters () const override
 
virtual void setNamespace (const std::string &prefix)=0
 
void setNamespace (const std::string &prefix) override
 
virtual std::string getNamespace () const=0
 
std::string getNamespace () const override
 
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const=0
 
std::string getParameterNameWithoutNamespace (const std::string &name) const override
 
void shareParameters (const ParameterList &variableNodes)
 Share Parameters, that are DF_parameters. More...
 
ValueRef< DataLikfirstOrderDerivativeNode (const std::string &variable) const
 
ValueRef< DataLiksecondOrderDerivativeNode (const std::string &variable1, const std::string &variable2) const
 
const std::shared_ptr< Parameter > & getParameter (const std::string &name) const
 
The PhyloLikelihood storage.
bool hasPhyloLikelihood (size_t nPhyl) override
 
std::shared_ptr< const PhyloLikelihoodInterfacegetPhyloLikelihood (size_t nPhyl) const override
 
std::shared_ptr< PhyloLikelihoodInterfacegetPhyloLikelihood (size_t nPhyl) override
 
Inherited from PhyloLikelihood
bool isInitialized () const override
 
virtual void fireParameterChanged (const ParameterList &params) override
 
Retrieve some particular parameters subsets.
ParameterList getNonDerivableParameters () const override
 
ParameterList getDerivableParameters () const override
 
ParameterList getBranchLengthParameters () const override
 Get the branch lengths parameters. More...
 
ParameterList getSubstitutionModelParameters () const override
 Get the parameters associated to substitution model(s). More...
 
ParameterList getRateDistributionParameters () const override
 Get the parameters associated to the rate distribution(s). More...
 
ParameterList getRootFrequenciesParameters () const override
 Get the parameters associated to the root frequencies(s). More...
 
The data functions
virtual const Contextcontext () const =0
 
virtual Contextcontext ()=0
 
The likelihood functions.
virtual ValueRef< DataLikgetLikelihoodNode () const =0
 
double getLogLikelihood () const
 Get the logarithm of the likelihood for the whole dataset. More...
 

Protected Member Functions

 PhyloLikelihoodFormula (const PhyloLikelihoodFormula &sd)
 
PhyloLikelihoodFormulaoperator= (const PhyloLikelihoodFormula &sd)
 
PhyloLikelihoodFormulaclone () const
 
virtual ParameterListgetParameters_ ()=0
 
ParameterListgetParameters_ () override
 
Node_DFaccessVariableNode (const std::string &name) const
 
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
 

Static Protected Member Functions

static Node_DFaccessVariableNode (const Parameter &param)
 

Protected Attributes

std::shared_ptr< PhyloLikelihoodContainerpPhyloCont_
 pointer to a PhyloLikelihoodContainer More...
 
std::vector< size_t > nPhylo_
 vector of AbstractPhyloLikelihood numbers More...
 
std::vector< std::shared_ptr< LikelihoodCalculation > > vLikCal_
 
Contextcontext_
 
DataLik minusLogLik_
 the value More...
 
std::unordered_map< std::string, ValueRef< DataLik > > firstOrderDerivativeNodes_
 For Dataflow computing. More...
 
std::unordered_map< std::pair< std::string, std::string >, ValueRef< DataLik >, StringPairHashsecondOrderDerivativeNodes_
 

Private Attributes

std::unique_ptr< ComputationTreecompTree_
 
std::shared_ptr< LikelihoodCalculationlikCal_
 
ParameterList parameters_
 
std::string prefix_
 

The likelihood functions.

LikelihoodCalculationlikelihoodCalculation () const
 
std::shared_ptr< LikelihoodCalculationgetLikelihoodCalculation () const
 
ValueRef< DataLikmakeLikelihoods ()
 Build the LikelihoodNode from the computation Tree. More...
 
ValueRef< DataLikmakeLikelihoodsFromOperator (std::shared_ptr< Operator > op)
 Build the LikelihoodNode from a node of the computation Tree. More...
 

Detailed Description

The PhyloLikelihoodFormula class, for phylogenetic likelihood on several independent data.

WARNING: This formula applies on the log-likelihoods (ie getValues())

Definition at line 21 of file PhyloLikelihoodFormula.h.

Constructor & Destructor Documentation

◆ PhyloLikelihoodFormula() [1/2]

PhyloLikelihoodFormula::PhyloLikelihoodFormula ( Context context,
std::shared_ptr< PhyloLikelihoodContainer pC,
const std::string &  formula,
bool  inCollection = true 
)

Definition at line 16 of file PhyloLikelihoodFormula.cpp.

Referenced by clone().

◆ ~PhyloLikelihoodFormula()

virtual bpp::PhyloLikelihoodFormula::~PhyloLikelihoodFormula ( )
inlinevirtual

Definition at line 32 of file PhyloLikelihoodFormula.h.

◆ PhyloLikelihoodFormula() [2/2]

bpp::PhyloLikelihoodFormula::PhyloLikelihoodFormula ( const PhyloLikelihoodFormula sd)
inlineprotected

Definition at line 35 of file PhyloLikelihoodFormula.h.

Member Function Documentation

◆ accessVariableNode() [1/2]

◆ accessVariableNode() [2/2]

Node_DF& bpp::AbstractPhyloLikelihood::accessVariableNode ( const std::string &  name) const
inlineprotectedinherited

◆ addPhyloLikelihood()

◆ clone()

PhyloLikelihoodFormula* bpp::PhyloLikelihoodFormula::clone ( ) const
inlineprotectedvirtual

Implements bpp::AbstractParametrizable.

Definition at line 52 of file PhyloLikelihoodFormula.h.

References PhyloLikelihoodFormula().

◆ context() [1/4]

virtual const Context& bpp::PhyloLikelihoodInterface::context ( ) const
pure virtualinherited

◆ context() [2/4]

◆ context() [3/4]

Context& bpp::AbstractPhyloLikelihood::context ( )
inlineoverridevirtualinherited

◆ context() [4/4]

virtual Context& bpp::PhyloLikelihoodInterface::context ( )
pure virtualinherited

◆ enableFirstOrderDerivatives() [1/2]

bool bpp::AbstractPhyloLikelihood::enableFirstOrderDerivatives ( ) const
inlineoverridevirtualinherited

Implements bpp::SecondOrderDerivable.

Definition at line 115 of file AbstractPhyloLikelihood.h.

◆ enableFirstOrderDerivatives() [2/2]

virtual void bpp::AbstractPhyloLikelihood::enableFirstOrderDerivatives ( bool  yn)
inlineoverridevirtualinherited

Tell if derivatives must be computed: for Function inheritance.

Implements bpp::SecondOrderDerivable.

Definition at line 113 of file AbstractPhyloLikelihood.h.

◆ enableSecondOrderDerivatives() [1/2]

bool bpp::AbstractPhyloLikelihood::enableSecondOrderDerivatives ( ) const
inlineoverridevirtualinherited

Implements bpp::SecondOrderDerivable.

Definition at line 116 of file AbstractPhyloLikelihood.h.

◆ enableSecondOrderDerivatives() [2/2]

virtual void bpp::AbstractPhyloLikelihood::enableSecondOrderDerivatives ( bool  yn)
inlineoverridevirtualinherited

Implements bpp::SecondOrderDerivable.

Definition at line 114 of file AbstractPhyloLikelihood.h.

◆ fireParameterChanged()

◆ firstOrderDerivativeNode()

◆ getBranchLengthParameters()

ParameterList AbstractPhyloLikelihoodSet::getBranchLengthParameters ( ) const
overridevirtualinherited

Get the branch lengths parameters.

Returns
A ParameterList with all branch lengths.

Implements bpp::PhyloLikelihoodInterface.

Definition at line 107 of file PhyloLikelihoodSet.cpp.

References bpp::AbstractPhyloLikelihoodSet::getPhyloLikelihood(), bpp::ParameterList::includeParameters(), and bpp::AbstractPhyloLikelihoodSet::nPhylo_.

◆ getDerivableParameters()

ParameterList AbstractPhyloLikelihoodSet::getDerivableParameters ( ) const
overridevirtualinherited

◆ getFirstOrderDerivative()

double bpp::AbstractPhyloLikelihood::getFirstOrderDerivative ( const std::string &  variable) const
inlineoverridevirtualinherited

◆ getLikelihoodCalculation()

std::shared_ptr<LikelihoodCalculation> bpp::PhyloLikelihoodFormula::getLikelihoodCalculation ( ) const
inlinevirtual
Returns
A shared pointer toward the LikelihoodCalculation.

Implements bpp::PhyloLikelihoodInterface.

Definition at line 80 of file PhyloLikelihoodFormula.h.

References likCal_.

◆ getLikelihoodNode() [1/2]

virtual ValueRef<DataLik> bpp::PhyloLikelihoodInterface::getLikelihoodNode ( ) const
pure virtualinherited
Returns
the LikDF node where the Likelihood is computed.

Implemented in bpp::AbstractPhyloLikelihood.

◆ getLikelihoodNode() [2/2]

ValueRef<DataLik> bpp::AbstractPhyloLikelihood::getLikelihoodNode ( ) const
inlineoverridevirtualinherited

◆ getLogLikelihood()

double bpp::PhyloLikelihoodInterface::getLogLikelihood ( ) const
inlineinherited

Get the logarithm of the likelihood for the whole dataset.

Returns
The logarithm of the likelihood of the dataset.

Definition at line 66 of file PhyloLikelihood.h.

References bpp::SecondOrderDerivable::getValue().

◆ getNonDerivableParameters()

ParameterList AbstractPhyloLikelihoodSet::getNonDerivableParameters ( ) const
overridevirtualinherited

◆ getNumbersOfPhyloLikelihoods()

const std::vector<size_t>& bpp::AbstractPhyloLikelihoodSet::getNumbersOfPhyloLikelihoods ( ) const
inlineoverridevirtualinherited

◆ getPhyloContainer() [1/2]

std::shared_ptr<const PhyloLikelihoodContainer> bpp::AbstractPhyloLikelihoodSet::getPhyloContainer ( ) const
inlineoverridevirtualinherited

◆ getPhyloContainer() [2/2]

◆ getPhyloLikelihood() [1/2]

◆ getPhyloLikelihood() [2/2]

std::shared_ptr<PhyloLikelihoodInterface> bpp::AbstractPhyloLikelihoodSet::getPhyloLikelihood ( size_t  nPhyl)
inlineoverridevirtualinherited

◆ getRateDistributionParameters()

ParameterList AbstractPhyloLikelihoodSet::getRateDistributionParameters ( ) const
overridevirtualinherited

Get the parameters associated to the rate distribution(s).

Returns
A ParameterList.

Implements bpp::PhyloLikelihoodInterface.

Definition at line 129 of file PhyloLikelihoodSet.cpp.

References bpp::AbstractPhyloLikelihoodSet::getPhyloLikelihood(), bpp::ParameterList::includeParameters(), and bpp::AbstractPhyloLikelihoodSet::nPhylo_.

◆ getRootFrequenciesParameters()

ParameterList AbstractPhyloLikelihoodSet::getRootFrequenciesParameters ( ) const
overridevirtualinherited

Get the parameters associated to the root frequencies(s).

Returns
A ParameterList.

Implements bpp::PhyloLikelihoodInterface.

Definition at line 140 of file PhyloLikelihoodSet.cpp.

References bpp::AbstractPhyloLikelihoodSet::getPhyloLikelihood(), bpp::ParameterList::includeParameters(), and bpp::AbstractPhyloLikelihoodSet::nPhylo_.

◆ getSecondOrderDerivative() [1/2]

double bpp::AbstractPhyloLikelihood::getSecondOrderDerivative ( const std::string &  variable) const
inlineoverridevirtualinherited

Implements bpp::SecondOrderDerivable.

Definition at line 155 of file AbstractPhyloLikelihood.h.

◆ getSecondOrderDerivative() [2/2]

double bpp::AbstractPhyloLikelihood::getSecondOrderDerivative ( const std::string &  variable1,
const std::string &  variable2 
) const
inlineoverridevirtualinherited

◆ getSubstitutionModelParameters()

ParameterList AbstractPhyloLikelihoodSet::getSubstitutionModelParameters ( ) const
overridevirtualinherited

◆ getValue()

double bpp::AbstractPhyloLikelihood::getValue ( ) const
inlineoverridevirtualinherited

◆ hasPhyloLikelihood()

bool bpp::AbstractPhyloLikelihoodSet::hasPhyloLikelihood ( size_t  nPhyl)
inlineoverridevirtualinherited

Implements bpp::PhyloLikelihoodSetInterface.

Definition at line 164 of file PhyloLikelihoodSet.h.

References bpp::AbstractPhyloLikelihoodSet::nPhylo_.

Referenced by readFormula().

◆ isInitialized()

bool bpp::AbstractPhyloLikelihoodSet::isInitialized ( ) const
inlineoverridevirtualinherited
Returns
'true' is the likelihood function has been initialized.

Reimplemented from bpp::AbstractPhyloLikelihood.

Definition at line 197 of file PhyloLikelihoodSet.h.

References bpp::AbstractPhyloLikelihoodSet::getPhyloLikelihood(), and bpp::AbstractPhyloLikelihoodSet::nPhylo_.

◆ likelihoodCalculation()

LikelihoodCalculation& bpp::PhyloLikelihoodFormula::likelihoodCalculation ( ) const
inlinevirtual
Returns
The LikelihoodCalculation.

Implements bpp::PhyloLikelihoodInterface.

Definition at line 75 of file PhyloLikelihoodFormula.h.

References likCal_.

◆ makeLikelihoods()

ValueRef<DataLik> bpp::PhyloLikelihoodFormula::makeLikelihoods ( )
inlineprivate

Build the LikelihoodNode from the computation Tree.

Definition at line 90 of file PhyloLikelihoodFormula.h.

References compTree_, and makeLikelihoodsFromOperator().

◆ makeLikelihoodsFromOperator()

◆ operator=()

PhyloLikelihoodFormula& bpp::PhyloLikelihoodFormula::operator= ( const PhyloLikelihoodFormula sd)
inlineprotected

◆ output()

std::string PhyloLikelihoodFormula::output ( ) const

◆ readFormula()

◆ secondOrderDerivativeNode()

ValueRef<DataLik> bpp::AbstractPhyloLikelihood::secondOrderDerivativeNode ( const std::string &  variable1,
const std::string &  variable2 
) const
inlineinherited

◆ setParameters()

void bpp::AbstractPhyloLikelihood::setParameters ( const ParameterList parameters)
inlineoverridevirtualinherited

◆ shareParameters()

void bpp::AbstractPhyloLikelihood::shareParameters ( const ParameterList variableNodes)
inlineinherited

Member Data Documentation

◆ compTree_

std::unique_ptr<ComputationTree> bpp::PhyloLikelihoodFormula::compTree_
private

Definition at line 25 of file PhyloLikelihoodFormula.h.

Referenced by makeLikelihoods(), operator=(), output(), and readFormula().

◆ context_

◆ firstOrderDerivativeNodes_

std::unordered_map<std::string, ValueRef<DataLik> > bpp::AbstractPhyloLikelihood::firstOrderDerivativeNodes_
mutableprotectedinherited

For Dataflow computing.

Definition at line 44 of file AbstractPhyloLikelihood.h.

Referenced by bpp::AbstractPhyloLikelihood::firstOrderDerivativeNode().

◆ likCal_

std::shared_ptr<LikelihoodCalculation> bpp::PhyloLikelihoodFormula::likCal_
private

◆ minusLogLik_

DataLik bpp::AbstractPhyloLikelihood::minusLogLik_
mutableprotectedinherited

◆ nPhylo_

◆ pPhyloCont_

◆ secondOrderDerivativeNodes_

std::unordered_map<std::pair<std::string, std::string>, ValueRef<DataLik>, StringPairHash> bpp::AbstractPhyloLikelihood::secondOrderDerivativeNodes_
mutableprotectedinherited

◆ vLikCal_

std::vector<std::shared_ptr<LikelihoodCalculation> > bpp::AbstractPhyloLikelihoodSet::vLikCal_
mutableprotectedinherited

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