GSLFunAdapters.h
Go to the documentation of this file.
1 #ifndef GAUDIMATH_GSLFUNADAPTERS_H
2 #define GAUDIMATH_GSLFUNADAPTERS_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 #include <memory>
7 // ============================================================================
8 // from CLHEP
9 // ============================================================================
10 #include "CLHEP/GenericFunctions/GenericFunctions.hh"
11 #include "CLHEP/GenericFunctions/Argument.hh"
12 #include "CLHEP/GenericFunctions/AbsFunction.hh"
13 // ============================================================================
14 // GaudiGSL/GaudiMath
15 // ============================================================================
16 #include "GaudiMath/FunAdapters.h"
17 // ============================================================================
18 // GSL
19 // ============================================================================
20 #include "gsl/gsl_mode.h"
21 #include "gsl/gsl_sf_result.h"
22 // ============================================================================
23 #include "GaudiKernel/Kernel.h"
24 
25 #if defined(__clang__) || defined(__CLING__)
26 #pragma clang diagnostic push
27 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
28 #elif defined(__GNUC__) && __GNUC__ >= 5
29 #pragma GCC diagnostic push
30 #pragma GCC diagnostic ignored "-Wsuggest-override"
31 #endif
32 
33 namespace Genfun
34 {
35  namespace GaudiMathImplementation
36  {
39 
40  class GAUDI_API GSLFunctionWithError : public AbsFunction
41  {
42  public:
44  typedef int (*Function)( double , gsl_sf_result* ) ;
45  public:
47  FUNCTION_OBJECT_DEF( GSLFunctionWithError )
48  public:
50  GSLFunctionWithError ( Function function ) ;
54  ~GSLFunctionWithError () override = default;
56  double operator() ( double x ) const override;
57  double operator() ( const Argument& x ) const override;
58  bool hasAnalyticDerivative () const override { return true ; }
59  unsigned int dimensionality () const override { return 1 ; }
60  Genfun::Derivative partial ( unsigned int i ) const override;
61 
63  Function function () const ;
65  const gsl_sf_result& result () const ;
67  double error () const ;
68  private:
69  // default constructor is disabled
71  // assignement operator is disabled
73  private:
76  };
78  FUNCTION_OBJECT_IMP( GSLFunctionWithError )
79 
80  class GAUDI_API GSLFunctionWithMode : public AbsFunction
81  {
82  public:
84  typedef double (*Function)( double , gsl_mode_t ) ;
85  public:
87  FUNCTION_OBJECT_DEF( GSLFunctionWithMode )
88  public:
91  const gsl_mode_t& mode ) ;
95  ~GSLFunctionWithMode () override = default;
97  double operator() ( double x ) const override;
98  double operator() ( const Argument& x ) const override;
99  bool hasAnalyticDerivative () const override { return true ; }
100  unsigned int dimensionality () const override { return 1 ; }
101  Genfun::Derivative partial ( unsigned int i ) const override ;
103  Function function () const ;
105  const gsl_mode_t& mode () const ;
106  private:
107  // default constructor is disabled
109  // assignement operator is disabled
111  private:
113  gsl_mode_t* m_mode ;
114  };
116  FUNCTION_OBJECT_IMP( GSLFunctionWithMode )
117 
119  {
120  public:
122  typedef int (*Function)( double ,
123  gsl_mode_t ,
124  gsl_sf_result* ) ;
125  public:
127  FUNCTION_OBJECT_DEF( GSLFunctionWithModeAndError )
128  public:
131  const gsl_mode_t& mode ) ;
135  ~GSLFunctionWithModeAndError () override = default;
137  double operator() ( double x ) const override;
138  double operator() ( const Argument& x ) const override;
139  bool hasAnalyticDerivative () const override { return true ; }
140  unsigned int dimensionality () const override { return 1 ; }
141  Genfun::Derivative partial ( unsigned int i ) const override;
143  Function function () const ;
145  const gsl_mode_t& mode () const ;
147  const gsl_sf_result& result () const ;
149  double error () const ;
150  private:
151  // default constructor is disabled
153  // assignement operator is disabled
154  GSLFunctionWithModeAndError& operator=
155  ( const GSLFunctionWithModeAndError & ) ;
156  private:
160  };
162  FUNCTION_OBJECT_IMP( GSLFunctionWithModeAndError )
163 
164  } // end of namespace GaudiMath Implemnentation
165 } // end of namespace Genfun
166 
167 #if defined(__clang__) || defined(__CLING__)
168 #pragma clang diagnostic pop
169 #elif defined(__GNUC__) && __GNUC__ >= 5
170 #pragma GCC diagnostic pop
171 #endif
172 
173 #endif // GAUDIMATH_GSLFUNADAPTERS_H
174 // ============================================================================
Genfun::GaudiMathImplementation::GSLFunctionWithMode GSLFunctionWithMode
Definition: Adapters.h:25
Genfun::GaudiMathImplementation::GSLFunctionWithError GSLFunctionWithError
Definition: Adapters.h:27
mandatory macro from CLHEP/GenericFunctions
Definition: FunAdapters.h:216
Genfun::AbsFunction Function
Definition: GaudiMath.h:24
#define class
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition: GaudiMath.h:29
PropertyMgr & operator=(const PropertyMgr &)=delete
Genfun::GaudiMathImplementation::SimpleFunction GSLFunction
the actual type for primitive adaptor
mandatory macro from CLHEP/GenericFunctions
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError GSLFunctionWithModeAndError
Definition: Adapters.h:29
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
CLHEP.
Definition: IEqSolver.h:13
#define GAUDI_API
Definition: Kernel.h:107
mandatory macro from CLHEP/GenericFunctions