| The Gaudi Framework v30r0 (c919700c)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

NumericalDerivative.h
Go to the documentation of this file.
1 #ifndef GAUDIMATH_NUMERICALDERIVATIVE_H
2 #define GAUDIMATH_NUMERICALDERIVATIVE_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 // GaudiKernel
7 // ============================================================================
8 #include "GaudiKernel/StatusCode.h"
9 // ============================================================================
10 // CLHEP
11 // ============================================================================
12 #include "CLHEP/GenericFunctions/AbsFunction.hh"
13 // ============================================================================
14
15 #include <memory>
16
17 #if defined( __clang__ ) || defined( __CLING__ )
18 #pragma clang diagnostic push
19 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
20 #elif defined( __GNUC__ ) && __GNUC__ >= 5
21 #pragma GCC diagnostic push
22 #pragma GCC diagnostic ignored "-Wsuggest-override"
23 #endif
24
25 namespace Genfun
26 {
27 namespace GaudiMathImplementation
28 {
44 class GAUDI_API NumericalDerivative : public AbsFunction
45 {
46 public:
48 enum Type { Central, Forward, Backward };
49
50 public:
52 FUNCTION_OBJECT_DEF( NumericalDerivative )
53
54 public:
90 NumericalDerivative( const AbsFunction& function, const size_t index, const Type& type = Central );
91
93 NumericalDerivative( const NumericalDerivative& right );
94
96 ~NumericalDerivative() override = default;
97
99 unsigned int dimensionality() const override { return m_DIM; }
100
102 double operator()( double argument ) const override;
104 double operator()( const Argument& argument ) const override;
105
107 bool hasAnalyticDerivative() const override { return true; }
108
110 Derivative partial( unsigned int index ) const override;
111
112 public:
114 const AbsFunction& function() const { return *m_function; }
116 size_t index() const { return m_index; }
118 const Type& type() const { return m_type; }
119
121 const Type& setType( const Type& value );
122
124 double result() const { return m_result; }
126 double error() const { return m_error; }
127
128 protected:
129 StatusCode Exception( const std::string& message, const StatusCode& sc = StatusCode::FAILURE ) const;
130
131 private:
132 // default constructor is disabled
133 NumericalDerivative();
134 // assignement operator is disabled
135 NumericalDerivative& operator=( const NumericalDerivative& );
136
137 private:
138 std::unique_ptr<const AbsFunction> m_function;
139 size_t m_index;
140 size_t m_DIM;
141 Type m_type;
142 //
143 mutable Argument m_argument;
144 mutable double m_result;
145 mutable double m_error;
146 };
148 FUNCTION_OBJECT_IMP( NumericalDerivative )
149
150 } // end of namespace GaudiMathImplementation
151 } // end of namespace GenFun
152
153 #if defined( __clang__ ) || defined( __CLING__ )
154 #pragma clang diagnostic pop
155 #elif defined( __GNUC__ ) && __GNUC__ >= 5
156 #pragma GCC diagnostic pop
157 #endif
158
159 // ============================================================================
160 // The END
161 // ============================================================================
162 #endif // GAUDIMATH_NUMERICALDERIVATIVE_H
163 // ============================================================================
Genfun::GaudiMathImplementation::NumericalDerivative::index
size_t index() const
index
Definition: NumericalDerivative.h:116
Genfun::GaudiMathImplementation::NumericalDerivative::hasAnalyticDerivative
bool hasAnalyticDerivative() const override
Does this function have an analytic derivative?
Definition: NumericalDerivative.h:107
Genfun::GaudiMathImplementation::NumericalDerivative::error
double error() const
the absolute error estimate for the last call
Definition: NumericalDerivative.h:126
Genfun::GaudiMathImplementation::NumericalDerivative::type
const Type & type() const
type
Definition: NumericalDerivative.h:118
Genfun::GaudiMathImplementation::NumericalDerivative::Type
Type
the type of numerical differentiation
Definition: NumericalDerivative.h:48
Genfun::GaudiMathImplementation::NumericalDerivative::m_argument
Argument m_argument
Definition: NumericalDerivative.h:143
Genfun::GaudiMathImplementation::NumericalDerivative::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalDerivative.h:138
GaudiMath::Derivative
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition: GaudiMath.h:27
operator=
PropertyMgr & operator=(const PropertyMgr &)=delete
std::string
STL class.
Genfun::GaudiMathImplementation::NumericalDerivative::m_error
double m_error
Definition: NumericalDerivative.h:145
Genfun::GaudiMathImplementation::NumericalDerivative::dimensionality
unsigned int dimensionality() const override
dimensionality of the problem
Definition: NumericalDerivative.h:99
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
gaudirun.type
type
Definition: gaudirun.py:133
Genfun::GaudiMathImplementation::NumericalDerivative::m_index
size_t m_index
Definition: NumericalDerivative.h:139
Genfun::GaudiMathImplementation::NumericalDerivative::m_DIM
size_t m_DIM
Definition: NumericalDerivative.h:140
Genfun::GaudiMathImplementation::NumericalDerivative
Numerical derivative (using GSL adaptive numerical differentiation)
Definition: NumericalDerivative.h:44
Genfun::GaudiMathImplementation::NumericalDerivative::m_type
Type m_type
Definition: NumericalDerivative.h:141
Genfun::GaudiMathImplementation::NumericalDerivative::m_result
double m_result
Definition: NumericalDerivative.h:144
std::unique_ptr< const AbsFunction >
Gaudi::Functional::operator()
virtual Out operator()(const vector_of_const_< In > &inputs) const =0
Genfun
CLHEP.
Definition: IEqSolver.h:13
StatusCode.h
StatusCode::FAILURE
Definition: StatusCode.h:29
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
Genfun::GaudiMathImplementation::NumericalDerivative::result
double result() const
the result of the last call
Definition: NumericalDerivative.h:124