bpp-phyl3  3.0.0
GlobalClockTreeLikelihoodFunctionWrapper.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_GLOBALCLOCKTREELIKELIHOODFUNCTIONWRAPPER_H
6 #define BPP_PHYL_LEGACY_LIKELIHOOD_GLOBALCLOCKTREELIKELIHOODFUNCTIONWRAPPER_H
7 
8 
9 #include "TreeLikelihood.h"
10 
11 namespace bpp
12 {
14  public virtual SecondOrderDerivable,
16 {
17 private:
18  std::shared_ptr<TreeLikelihoodInterface> tl_;
19 
20 public:
21  GlobalClockTreeLikelihoodFunctionWrapper(std::shared_ptr<TreeLikelihoodInterface> tl) :
23  tl_(tl)
24  {
26  }
27 
29  AbstractParametrizable(gctlfw), tl_(gctlfw.tl_)
30  {}
31 
33  {
34  AbstractParametrizable::operator=(gctlfw);
35  tl_ = gctlfw.tl_;
36  return *this;
37  }
38 
40 
41 public:
42  void setParameters(const ParameterList& pl)
43  {
44  // For now we go the hard way and recompute everything:
46  }
47 
48  double getValue() const { return tl_->getValue(); }
49 
51 
52  void enableSecondOrderDerivatives(bool yn) { tl_->enableSecondOrderDerivatives(yn); }
53  bool enableSecondOrderDerivatives() const { return tl_->enableSecondOrderDerivatives(); }
54  void enableFirstOrderDerivatives(bool yn) { tl_->enableFirstOrderDerivatives(yn); }
55  bool enableFirstOrderDerivatives() const { return tl_->enableFirstOrderDerivatives(); }
56  double getSecondOrderDerivative(const std::string& variable1, const std::string& variable2) const { return tl_->getSecondOrderDerivative(variable1, variable2); }
57  double getSecondOrderDerivative(const std::string& variable) const { return tl_->getSecondOrderDerivative(variable); }
58  double getFirstOrderDerivative(const std::string& variable) const { return tl_->getFirstOrderDerivative(variable); }
59 
61 
62 private:
63  void initParameters_();
64  void computeBranchLengthsFromHeights_(const Node* node, double height, ParameterList& brlenPl);
65 };
66 } // end of namespace bpp.
67 #endif // BPP_PHYL_LEGACY_LIKELIHOOD_GLOBALCLOCKTREELIKELIHOODFUNCTIONWRAPPER_H
bool matchParametersValues(const ParameterList &parameters) override
GlobalClockTreeLikelihoodFunctionWrapper & operator=(const GlobalClockTreeLikelihoodFunctionWrapper &gctlfw)
double getSecondOrderDerivative(const std::string &variable1, const std::string &variable2) const
void computeBranchLengthsFromHeights_(const Node *node, double height, ParameterList &brlenPl)
GlobalClockTreeLikelihoodFunctionWrapper * clone() const
double getFirstOrderDerivative(const std::string &variable) const
GlobalClockTreeLikelihoodFunctionWrapper(const GlobalClockTreeLikelihoodFunctionWrapper &gctlfw)
GlobalClockTreeLikelihoodFunctionWrapper(std::shared_ptr< TreeLikelihoodInterface > tl)
double getSecondOrderDerivative(const std::string &variable) const
The phylogenetic node class.
Definition: Node.h:59
Defines the basic types of data flow nodes.