All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
NumericalDerivative.h
Go to the documentation of this file.
1 // $Id: NumericalDerivative.h,v 1.2 2008/10/27 19:22:20 marcocle Exp $
2 // ============================================================================
3 #ifndef GAUDIMATH_NUMERICALDERIVATIVE_H
4 #define GAUDIMATH_NUMERICALDERIVATIVE_H 1
5 // ============================================================================
6 // Include files
7 // ============================================================================
8 // GaudiKernel
9 // ============================================================================
10 #include "GaudiKernel/StatusCode.h"
11 // ============================================================================
12 // CLHEP
13 // ============================================================================
14 #include "CLHEP/GenericFunctions/AbsFunction.hh"
15 // ============================================================================
16 
17 namespace Genfun
18 {
19  namespace GaudiMathImplementation
20  {
36  class GAUDI_API NumericalDerivative : public AbsFunction
37  {
38  public:
40  enum Type
41  { Central ,
43  Backward } ;
44  public:
46  FUNCTION_OBJECT_DEF( NumericalDerivative )
47 
48  public:
49 
86  ( const AbsFunction& function ,
87  const size_t index ,
88  const Type& type = Central ) ;
89 
92  ( const NumericalDerivative& right ) ;
93 
95  virtual ~NumericalDerivative () ;
96 
98  virtual unsigned int dimensionality() const { return m_DIM ; }
99 
101  virtual double operator() ( double argument ) const ;
103  virtual double operator() ( const Argument& argument ) const ;
104 
106  virtual bool hasAnalyticDerivative() const { return true ;}
107 
109  virtual Derivative partial ( unsigned int index ) const;
110 
111  public:
112 
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 
130  StatusCode Exception
131  ( const std::string& message ,
132  const StatusCode& sc = StatusCode::FAILURE ) const ;
133 
134  private:
135 
136  // default constructor is disabled
138  // assignement operator is disabled
139  NumericalDerivative& operator=( const NumericalDerivative& ) ;
140 
141  private:
142  const AbsFunction* m_function ;
143  size_t m_index ;
144  size_t m_DIM ;
146  //
147  mutable Argument m_argument ;
148  mutable double m_result ;
149  mutable double m_error ;
150  };
151 
152  } // end of namespace GaudiMathImplementation
153 } // end of namespace GenFun
154 
155 // ============================================================================
156 // The END
157 // ============================================================================
158 #endif // GAUDIMATH_NUMERICALDERIVATIVE_H
159 // ============================================================================
double error() const
the absolute error estimate for the last call
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition: GaudiMath.h:31
string type
Definition: gaudirun.py:126
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Numerical derivative (using GSL adaptive numerical differentiation)
virtual bool hasAnalyticDerivative() const
Does this function have an analytic derivative?
#define GAUDI_API
Definition: Kernel.h:108
Type
the list of available types for ntuples
Definition: TupleObj.h:63
double result() const
the result of the last call