bpp-core3  3.0.0
FivePointsNumericalDerivative.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_FIVEPOINTSNUMERICALDERIVATIVE_H
6 #define BPP_NUMERIC_FUNCTION_FIVEPOINTSNUMERICALDERIVATIVE_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 {
53 {
54 private:
55  double f1_, f2_, f3_, f4_, f5_;
56 
57 public:
58  FivePointsNumericalDerivative(std::shared_ptr<FunctionInterface> function) :
60  f1_(),
61  f2_(),
62  f3_(),
63  f4_(),
64  f5_() {}
65  FivePointsNumericalDerivative(std::shared_ptr<FirstOrderDerivable> function) :
67  f1_(),
68  f2_(),
69  f3_(),
70  f4_(),
71  f5_() {}
72  FivePointsNumericalDerivative(std::shared_ptr<SecondOrderDerivable> function) :
74  f1_(),
75  f2_(),
76  f3_(),
77  f4_(),
78  f5_() {}
80 
81  FivePointsNumericalDerivative* clone() const override { return new FivePointsNumericalDerivative(*this); }
82 
83 public:
84  double getValue() const override
85  {
86  return f3_;
87  }
88 
89  double getSecondOrderDerivative(const std::string& variable1, const std::string& variable2) const override
90  {
91  throw Exception("Unimplemented cross derivative.");
92  }
93 
94 protected:
95  void updateDerivatives(const ParameterList& parameters) override;
96 };
97 } // end of namespace bpp.
98 #endif // BPP_NUMERIC_FUNCTION_FIVEPOINTSNUMERICALDERIVATIVE_H
FivePointsNumericalDerivative * clone() const override
Create a copy of this object and send a pointer to it.
Numerical derivative function wrapper, partial implementation.
FivePointsNumericalDerivative(std::shared_ptr< FunctionInterface > function)
The parameter list object.
Definition: ParameterList.h:27
void updateDerivatives(const ParameterList &parameters) override
Compute derivatives.
FivePointsNumericalDerivative(std::shared_ptr< FirstOrderDerivable > function)
Exception base class. Overload exception constructor (to control the exceptions mechanism). Destructor is already virtual (from std::exception)
Definition: Exceptions.h:20
FivePointsNumericalDerivative(std::shared_ptr< SecondOrderDerivable > function)
double getValue() const override
Get the value of the function at the current point.
Five points numerical derivative function wrapper.
double getSecondOrderDerivative(const std::string &variable1, const std::string &variable2) const override
Get the value of the cross derivative of the function according to a given set of parameters...