| The Gaudi Framework v29r1 (5cd95fa2)

- 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 #if defined( __clang__ ) || defined( __CLING__ )
16 #pragma clang diagnostic push
17 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
18 #elif defined( __GNUC__ ) && __GNUC__ >= 5
19 #pragma GCC diagnostic push
20 #pragma GCC diagnostic ignored "-Wsuggest-override"
21 #endif
22
23 namespace Genfun
24 {
25 namespace GaudiMathImplementation
26 {
42 class GAUDI_API NumericalDerivative : public AbsFunction
43 {
44 public:
46 enum Type { Central, Forward, Backward };
47
48 public:
50 FUNCTION_OBJECT_DEF( NumericalDerivative )
51
52 public:
88 NumericalDerivative( const AbsFunction& function, const size_t index, const Type& type = Central );
89
91 NumericalDerivative( const NumericalDerivative& right );
92
94 ~NumericalDerivative() override = default;
95
97 unsigned int dimensionality() const override { return m_DIM; }
98
100 double operator()( double argument ) const override;
102 double operator()( const Argument& argument ) const override;
103
105 bool hasAnalyticDerivative() const override { return true; }
106
108 Derivative partial( unsigned int index ) const override;
109
110 public:
112 const AbsFunction& function() const { return *m_function; }
114 size_t index() const { return m_index; }
116 const Type& type() const { return m_type; }
117
119 const Type& setType( const Type& value );
120
122 double result() const { return m_result; }
124 double error() const { return m_error; }
125
126 protected:
127 StatusCode Exception( const std::string& message, const StatusCode& sc = StatusCode::FAILURE ) const;
128
129 private:
130 // default constructor is disabled
131 NumericalDerivative();
132 // assignement operator is disabled
133 NumericalDerivative& operator=( const NumericalDerivative& );
134
135 private:
136 std::unique_ptr<const AbsFunction> m_function;
137 size_t m_index;
138 size_t m_DIM;
139 Type m_type;
140 //
141 mutable Argument m_argument;
142 mutable double m_result;
143 mutable double m_error;
144 };
146 FUNCTION_OBJECT_IMP( NumericalDerivative )
147
148 } // end of namespace GaudiMathImplementation
149 } // end of namespace GenFun
150
151 #if defined( __clang__ ) || defined( __CLING__ )
152 #pragma clang diagnostic pop
153 #elif defined( __GNUC__ ) && __GNUC__ >= 5
154 #pragma GCC diagnostic pop
155 #endif
156
157 // ============================================================================
158 // The END
159 // ============================================================================
160 #endif // GAUDIMATH_NUMERICALDERIVATIVE_H
161 // ============================================================================
Genfun::GaudiMathImplementation::NumericalDerivative::index
size_t index() const
index
Definition: NumericalDerivative.h:114
StatusCode::FAILURE
Definition: StatusCode.h:31
Genfun::GaudiMathImplementation::NumericalDerivative::hasAnalyticDerivative
bool hasAnalyticDerivative() const override
Does this function have an analytic derivative?
Definition: NumericalDerivative.h:105
Genfun::GaudiMathImplementation::NumericalDerivative::error
double error() const
the absolute error estimate for the last call
Definition: NumericalDerivative.h:124
Genfun::GaudiMathImplementation::NumericalDerivative::type
const Type & type() const
type
Definition: NumericalDerivative.h:116
Genfun::GaudiMathImplementation::NumericalDerivative::Type
Type
the type of numerical differentiation
Definition: NumericalDerivative.h:46
Genfun::GaudiMathImplementation::NumericalDerivative::m_argument
Argument m_argument
Definition: NumericalDerivative.h:141
Genfun::GaudiMathImplementation::NumericalDerivative::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalDerivative.h:136
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:143
Genfun::GaudiMathImplementation::NumericalDerivative::dimensionality
unsigned int dimensionality() const override
dimensionality of the problem
Definition: NumericalDerivative.h:97
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
gaudirun.type
type
Definition: gaudirun.py:133
Genfun::GaudiMathImplementation::NumericalDerivative::m_index
size_t m_index
Definition: NumericalDerivative.h:137
Genfun::GaudiMathImplementation::NumericalDerivative::m_DIM
size_t m_DIM
Definition: NumericalDerivative.h:138
Genfun::GaudiMathImplementation::NumericalDerivative
Numerical derivative (using GSL adaptive numerical differentiation)
Definition: NumericalDerivative.h:42
Genfun::GaudiMathImplementation::NumericalDerivative::m_type
Type m_type
Definition: NumericalDerivative.h:139
Genfun::GaudiMathImplementation::NumericalDerivative::m_result
double m_result
Definition: NumericalDerivative.h:142
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
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:122