3 #ifndef GAUDIMATH_FUNADAPTERS_H
4 #define GAUDIMATH_FUNADAPTERS_H 1
10 #include "CLHEP/GenericFunctions/GenericFunctions.hh"
11 #include "CLHEP/GenericFunctions/Argument.hh"
12 #include "CLHEP/GenericFunctions/AbsFunction.hh"
14 #include "GaudiKernel/Kernel.h"
16 namespace AIDA {
class IFunction ; }
20 namespace GaudiMathImplementation
31 class GAUDI_API AdapterIFunction :
public AbsFunction
35 FUNCTION_OBJECT_DEF( AdapterIFunction )
40 AdapterIFunction ( const
AIDA::IFunction&
fun) ;
42 AdapterIFunction ( const AdapterIFunction& );
44 virtual ~AdapterIFunction() ;
46 virtual
double operator() (
double a ) const ;
48 virtual
double operator() ( const Argument& x ) const;
50 virtual
unsigned int dimensionality ()
const {
return m_dim ; }
53 virtual bool hasAnalyticDerivative()
const {
return true ; }
59 AdapterIFunction& operator=(
const AdapterIFunction&);
61 const AIDA::IFunction* m_fun ;
63 mutable std::vector<double> m_arg ;
91 class GAUDI_API Adapter2DoubleFunction :
public AbsFunction
95 typedef double (*
Function)(
const double ,
99 FUNCTION_OBJECT_DEF( Adapter2DoubleFunction )
104 Adapter2DoubleFunction ( const Adapter2DoubleFunction& );
106 virtual ~Adapter2DoubleFunction () ;
108 virtual
double operator() (
double x ) const ;
110 virtual
double operator() ( const Argument& x ) const ;
112 virtual
unsigned int dimensionality()
const {
return 2 ; }
114 virtual bool hasAnalyticDerivative()
const {
return true ; }
118 double operator() (
const double x ,
const double y )
const ;
121 Adapter2DoubleFunction();
123 Adapter2DoubleFunction& operator = (
const Adapter2DoubleFunction&);
154 class GAUDI_API Adapter3DoubleFunction :
public AbsFunction
158 typedef double (*
Function)(
const double ,
163 FUNCTION_OBJECT_DEF( Adapter3DoubleFunction )
168 Adapter3DoubleFunction ( const Adapter3DoubleFunction& );
170 virtual ~Adapter3DoubleFunction () ;
172 virtual
double operator() (
double x ) const ;
174 virtual
double operator() ( const Argument& x ) const ;
176 virtual
unsigned int dimensionality()
const {
return 3 ; }
178 virtual bool hasAnalyticDerivative()
const {
return true ; }
182 double operator() (
const double x ,
184 const double z )
const ;
187 Adapter3DoubleFunction();
189 Adapter3DoubleFunction& operator = (
const Adapter3DoubleFunction&);
205 typedef double (*Function1)(
const double ) ;
206 typedef double (*Function2)(
const double* ) ;
207 typedef double (*Function3)(
const std::vector<double>& ) ;
209 enum Case { TrivialArg , ArrayArg , VectorArg } ;
239 virtual ~SimpleFunction();
243 virtual
unsigned int dimensionality ()
const {
return m_DIM ; }
245 virtual bool hasAnalyticDerivative ()
const {
return true ; }
247 virtual double operator() (
double )
const ;
249 virtual double operator() (
const Argument& )
const ;
271 mutable std::vector<double> m_arg3 ;
278 #endif // GAUDIMATH_FUNADAPTERS_H
Genfun::AbsFunction Function
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
double fun(const std::vector< double > &x)
Genfun::GaudiMathImplementation::SimpleFunction SimpleFunction