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 // ============================================================================
9 // ============================================================================
10 // CLHEP
11 // ============================================================================
12 #include "CLHEP/GenericFunctions/AbsFunction.hh"
13 // ============================================================================
14 
15 namespace Genfun
16 {
17  namespace GaudiMathImplementation
18  {
34  class GAUDI_API NumericalDerivative : public AbsFunction
35  {
36  public:
38  enum Type
39  { Central ,
41  Backward } ;
42  public:
44  FUNCTION_OBJECT_DEF( NumericalDerivative )
45 
46  public:
47 
84  ( const AbsFunction& function ,
85  const size_t index ,
86  const Type& type = Central ) ;
87 
90  ( const NumericalDerivative& right ) ;
91 
93  virtual ~NumericalDerivative () = default;
94 
96  virtual unsigned int dimensionality() const { return m_DIM ; }
97 
99  virtual double operator() ( double argument ) const ;
101  virtual double operator() ( const Argument& argument ) const ;
102 
104  virtual bool hasAnalyticDerivative() const { return true ;}
105 
107  virtual Derivative partial ( unsigned int index ) const;
108 
109  public:
110 
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 
128  StatusCode Exception
129  ( const std::string& message ,
130  const StatusCode& sc = StatusCode::FAILURE ) const ;
131 
132  private:
133 
134  // default constructor is disabled
136  // assignement operator is disabled
137  NumericalDerivative& operator=( const NumericalDerivative& ) ;
138 
139  private:
141  size_t m_index ;
142  size_t m_DIM ;
144  //
145  mutable Argument m_argument ;
146  mutable double m_result ;
147  mutable double m_error ;
148  };
149 
150  } // end of namespace GaudiMathImplementation
151 } // end of namespace GenFun
152 
153 // ============================================================================
154 // The END
155 // ============================================================================
156 #endif // GAUDIMATH_NUMERICALDERIVATIVE_H
157 // ============================================================================
double error() const
the absolute error estimate for the last call
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition: GaudiMath.h:29
STL class.
string type
Definition: gaudirun.py:151
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Numerical derivative (using GSL adaptive numerical differentiation)
CLHEP.
Definition: IEqSolver.h:13
virtual bool hasAnalyticDerivative() const
Does this function have an analytic derivative?
#define GAUDI_API
Definition: Kernel.h:107
Type
the list of available types for ntuples
Definition: TupleObj.h:79
double result() const
the result of the last call