bpp-core3  3.0.0
ThreePointsNumericalDerivative.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_NUMERIC_FUNCTION_THREEPOINTSNUMERICALDERIVATIVE_H
6 #define BPP_NUMERIC_FUNCTION_THREEPOINTSNUMERICALDERIVATIVE_H
7 
8 
9 #include "NumericalDerivative.h"
10 #include "Functions.h"
11 
12 // From the STL:
13 #include <map>
14 #include <vector>
15 #include <string>
16 
17 namespace bpp
18 {
52 {
53 private:
54  double f1_, f2_, f3_, f11_, f22_, f12_, f21_;
55 
56 public:
57  ThreePointsNumericalDerivative (std::shared_ptr<FunctionInterface> function) :
59  f1_(),
60  f2_(),
61  f3_(),
62  f11_(),
63  f22_(),
64  f12_(),
65  f21_() {}
66  ThreePointsNumericalDerivative(std::shared_ptr<FirstOrderDerivable> function) :
68  f1_(),
69  f2_(),
70  f3_(),
71  f11_(),
72  f22_(),
73  f12_(),
74  f21_() {}
75  ThreePointsNumericalDerivative(std::shared_ptr<SecondOrderDerivable> function) :
77  f1_(),
78  f2_(),
79  f3_(),
80  f11_(),
81  f22_(),
82  f12_(),
83  f21_() {}
85 
87  {
88  return new ThreePointsNumericalDerivative(*this);
89  }
90 
91 public:
92  double getValue() const override
93  {
94  return f2_;
95  }
96 
97 protected:
98  void updateDerivatives(const ParameterList& parameters) override;
99 };
100 } // end of namespace bpp.
101 #endif // BPP_NUMERIC_FUNCTION_THREEPOINTSNUMERICALDERIVATIVE_H
void updateDerivatives(const ParameterList &parameters) override
Compute derivatives.
ThreePointsNumericalDerivative(std::shared_ptr< SecondOrderDerivable > function)
ThreePointsNumericalDerivative(std::shared_ptr< FirstOrderDerivable > function)
Numerical derivative function wrapper, partial implementation.
The parameter list object.
Definition: ParameterList.h:27
ThreePointsNumericalDerivative(std::shared_ptr< FunctionInterface > function)
Three points numerical derivative function wrapper.
ThreePointsNumericalDerivative * clone() const override
Create a copy of this object and send a pointer to it.
double getValue() const override
Get the value of the function at the current point.