CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

FunctionNumDeriv.hh

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: FunctionNumDeriv.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
00003 //--------------------------FunctionNumDeriv--------------------------------//
00004 //                                                                          //
00005 // Class FunctionNumDeriv, providing numerical derivatives                  //
00006 // Joe Boudreau, Mark Fischler, February 2001                               //
00007 //                                                                          //
00008 //--------------------------------------------------------------------------//
00009 #ifndef FunctionNumDeriv_h
00010 #define FunctionNumDeriv_h 1
00011 #include "CLHEP/GenericFunctions/AbsFunction.hh"
00012 
00013 namespace Genfun {
00014 
00019   class FunctionNumDeriv : public AbsFunction {
00020   
00021     FUNCTION_OBJECT_DEF(FunctionNumDeriv)
00022 
00023       public:
00024 
00025     // Constructor
00026     FunctionNumDeriv(const AbsFunction *arg1, unsigned int index=0);
00027   
00028     // Copy constructor.
00029     FunctionNumDeriv(const FunctionNumDeriv &right);
00030   
00031     // Destructor
00032     virtual ~FunctionNumDeriv();
00033   
00034     // Retreive function value
00035     virtual double operator ()(double argument) const;
00036     virtual double operator ()(const Argument & a) const;
00037   
00038     // Dimensionality 
00039     virtual unsigned int dimensionality() const;
00040 
00041   private:
00042   
00043     // It is illegal to assign a FunctionNumDeriv
00044     const FunctionNumDeriv & operator=(const FunctionNumDeriv &right);
00045 
00046     // The function we're differntiating.
00047     const AbsFunction        *_arg1;
00048     const unsigned int       _wrtIndex;
00049 
00050     // helper data and methods to let us code Argument and double similarly
00051     double numericalDerivative 
00052         ( double (FunctionNumDeriv::*f)(double)const, double x ) const;
00053     double f_x   (double x) const;
00054     double f_Arg (double x) const;
00055     mutable Argument        _xArg;
00056 
00057   };
00058 } // namespace Genfun
00059 #endif

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7