Gaudi Framework, version v20r2

Generated: 18 Jul 2008

NumericalDerivative.h

Go to the documentation of this file.
00001 // $Id: NumericalDerivative.h,v 1.1 2003/11/19 17:09:40 mato Exp $
00002 // ============================================================================
00003 #ifndef GAUDIMATH_NUMERICALDERIVATIVE_H 
00004 #define GAUDIMATH_NUMERICALDERIVATIVE_H 1
00005 // ============================================================================
00006 // Include files
00007 // ============================================================================
00008 // GaudiKernel
00009 // ============================================================================
00010 #include "GaudiKernel/StatusCode.h"
00011 // ============================================================================
00012 // CLHEP
00013 // ============================================================================
00014 #include "CLHEP/GenericFunctions/AbsFunction.hh"
00015 // ============================================================================
00016 
00017 namespace Genfun 
00018 {
00019   namespace GaudiMathImplementation
00020   { 
00036     class NumericalDerivative : public AbsFunction
00037     { 
00038     public:
00040       enum Type 
00041         { Central  , 
00042           Forward  , 
00043           Backward } ;
00044     public: 
00046       FUNCTION_OBJECT_DEF( NumericalDerivative ) ;
00047       
00048     public:
00049       
00085       NumericalDerivative 
00086       ( const AbsFunction&   function          ,
00087         const size_t         index             , 
00088         const Type&          type    = Central ) ;
00089       
00091       NumericalDerivative 
00092       ( const NumericalDerivative&   right    ) ;
00093       
00095       virtual ~NumericalDerivative () ;
00096 
00098       virtual unsigned int dimensionality() const { return m_DIM ; }
00099       
00101       virtual double operator() ( double          argument ) const ;   
00103       virtual double operator() ( const Argument& argument ) const ; 
00104       
00106       virtual bool hasAnalyticDerivative() const { return true ;}
00107       
00109       virtual Derivative partial ( unsigned int index ) const;
00110       
00111     public:
00112       
00114       const AbsFunction&  function () const { return *m_function ; }
00116       const size_t        index    () const { return  m_index    ; }
00118       const Type&         type     () const { return  m_type     ; }
00119       
00121       const Type&         setType  ( const Type& value );
00122       
00124       const double        result   () const { return m_result    ; }
00126       const double        error    () const { return m_error     ; }
00127       
00128     protected:
00129       
00130       StatusCode Exception 
00131       ( const std::string& message                       ,
00132         const StatusCode&  sc      = StatusCode::FAILURE ) const ;
00133       
00134     private:
00135       
00136       // default constructor  is disabled 
00137       NumericalDerivative ();
00138       // assignement operator is disabled  
00139       NumericalDerivative& operator=( const NumericalDerivative& ) ;
00140       
00141     private:
00142       const AbsFunction* m_function  ;
00143       size_t             m_index     ; 
00144       size_t             m_DIM       ;
00145       Type               m_type      ;
00146       // 
00147       mutable Argument   m_argument  ;
00148       mutable double     m_result    ;
00149       mutable double     m_error     ;
00150     };
00151     
00152   }; // end of namespace GaudiMathImplementation
00153 }; // end of namespace GenFun
00154 
00155 // ============================================================================
00156 // The END 
00157 // ============================================================================
00158 #endif // GAUDIMATH_NUMERICALDERIVATIVE_H
00159 // ============================================================================

Generated at Fri Jul 18 11:59:19 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004