| The Gaudi Framework v28r2p1 (f1a77ff4)

- 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
47 { Central ,
48 Forward ,
49 Backward } ;
50 public:
52 FUNCTION_OBJECT_DEF( NumericalDerivative )
53
54 public:
55
91 NumericalDerivative
92 ( const AbsFunction& function ,
93 const size_t index ,
94 const Type& type = Central ) ;
95
97 NumericalDerivative
98 ( const NumericalDerivative& right ) ;
99
101 ~NumericalDerivative () override = default;
102
104 unsigned int dimensionality() const override { return m_DIM ; }
105
107 double operator() ( double argument ) const override ;
109 double operator() ( const Argument& argument ) const override ;
110
112 bool hasAnalyticDerivative() const override { return true ;}
113
115 Derivative partial ( unsigned int index ) const override;
116
117 public:
118
120 const AbsFunction& function () const { return *m_function ; }
122 size_t index () const { return m_index ; }
124 const Type& type () const { return m_type ; }
125
127 const Type& setType ( const Type& value );
128
130 double result () const { return m_result ; }
132 double error () const { return m_error ; }
133
134 protected:
135
136 StatusCode Exception
137 ( const std::string& message ,
138 const StatusCode& sc = StatusCode::FAILURE ) const ;
139
140 private:
141
142 // default constructor is disabled
143 NumericalDerivative ();
144 // assignement operator is disabled
145 NumericalDerivative& operator=( const NumericalDerivative& ) ;
146
147 private:
148 std::unique_ptr<const AbsFunction> m_function ;
149 size_t m_index ;
150 size_t m_DIM ;
151 Type m_type ;
152 //
153 mutable Argument m_argument ;
154 mutable double m_result ;
155 mutable double m_error ;
156 };
158 FUNCTION_OBJECT_IMP( NumericalDerivative )
159
160 } // end of namespace GaudiMathImplementation
161 } // end of namespace GenFun
162
163 #if defined(__clang__) || defined(__CLING__)
164 #pragma clang diagnostic pop
165 #elif defined(__GNUC__) && __GNUC__ >= 5
166 #pragma GCC diagnostic pop
167 #endif
168
169 // ============================================================================
170 // The END
171 // ============================================================================
172 #endif // GAUDIMATH_NUMERICALDERIVATIVE_H
173 // ============================================================================
Genfun::GaudiMathImplementation::NumericalDerivative::index
size_t index() const
index
Definition: NumericalDerivative.h:122
StatusCode::FAILURE
Definition: StatusCode.h:29
Genfun::GaudiMathImplementation::NumericalDerivative::hasAnalyticDerivative
bool hasAnalyticDerivative() const override
Does this function have an analytic derivative?
Definition: NumericalDerivative.h:112
gaudirun.default
default
Definition: gaudirun.py:141
Genfun::GaudiMathImplementation::NumericalDerivative::error
double error() const
the absolute error estimate for the last call
Definition: NumericalDerivative.h:132
Genfun::GaudiMathImplementation::NumericalDerivative::type
const Type & type() const
type
Definition: NumericalDerivative.h:124
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:153
Genfun::GaudiMathImplementation::NumericalDerivative::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalDerivative.h:148
GaudiMath::Derivative
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition: GaudiMath.h:29
operator=
PropertyMgr & operator=(const PropertyMgr &)=delete
std::string
STL class.
Genfun::GaudiMathImplementation::NumericalDerivative::m_error
double m_error
Definition: NumericalDerivative.h:155
Genfun::GaudiMathImplementation::NumericalDerivative::Forward
Definition: NumericalDerivative.h:48
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
gaudirun.type
type
Definition: gaudirun.py:125
Genfun::GaudiMathImplementation::NumericalDerivative::m_index
size_t m_index
Definition: NumericalDerivative.h:149
Genfun::GaudiMathImplementation::NumericalDerivative::m_DIM
size_t m_DIM
Definition: NumericalDerivative.h:150
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:151
Genfun::GaudiMathImplementation::NumericalDerivative::Central
Definition: NumericalDerivative.h:47
Genfun::GaudiMathImplementation::NumericalDerivative::m_result
double m_result
Definition: NumericalDerivative.h:154
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:107
Genfun::GaudiMathImplementation::NumericalDerivative::result
double result() const
the result of the last call
Definition: NumericalDerivative.h:130