| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 namespace Genfun
26 {
27 namespace GaudiMathImplementation
28 {
30 typedef Genfun::GaudiMathImplementation::SimpleFunction GSLFunction ;
31
32 class GAUDI_API GSLFunctionWithError : public AbsFunction
33 {
34 public:
36 typedef int (*Function)( double , gsl_sf_result* ) ;
37 public:
39 FUNCTION_OBJECT_DEF( GSLFunctionWithError )
40 public:
42 GSLFunctionWithError ( Function function ) ;
44 GSLFunctionWithError ( const GSLFunctionWithError& ) ;
46 virtual ~GSLFunctionWithError () = default;
48 virtual double operator() ( double x ) const ;
49 virtual double operator() ( const Argument& x ) const ;
50 virtual bool hasAnalyticDerivative () const { return true ; }
51 virtual unsigned int dimensionality () const { return 1 ; }
52 Genfun::Derivative partial ( unsigned int i ) const ;
53
55 Function function () const ;
57 const gsl_sf_result& result () const ;
59 double error () const ;
60 private:
61 // default constructor is disabled
62 GSLFunctionWithError () ;
63 // assignement operator is disabled
64 GSLFunctionWithError& operator=( const GSLFunctionWithError & ) ;
65 private:
66 Function m_function ;
67 std::unique_ptr<gsl_sf_result> m_result ;
68 };
69
70 class GAUDI_API GSLFunctionWithMode : public AbsFunction
71 {
72 public:
74 typedef double (*Function)( double , gsl_mode_t ) ;
75 public:
77 FUNCTION_OBJECT_DEF( GSLFunctionWithMode )
78 public:
80 GSLFunctionWithMode ( Function fun ,
81 const gsl_mode_t& mode ) ;
83 GSLFunctionWithMode ( const GSLFunctionWithMode& ) ;
85 virtual ~GSLFunctionWithMode () = default;
87 virtual double operator() ( double x ) const ;
88 virtual double operator() ( const Argument& x ) const ;
89 virtual bool hasAnalyticDerivative () const { return true ; }
90 virtual unsigned int dimensionality () const { return 1 ; }
91 Genfun::Derivative partial ( unsigned int i ) const ;
93 Function function () const ;
95 const gsl_mode_t& mode () const ;
96 private:
97 // default constructor is disabled
98 GSLFunctionWithMode () ;
99 // assignement operator is disabled
100 GSLFunctionWithMode& operator=( const GSLFunctionWithError & ) ;
101 private:
102 Function m_function ;
103 gsl_mode_t* m_mode ;
104 };
105
106 class GAUDI_API GSLFunctionWithModeAndError : public AbsFunction
107 {
108 public:
110 typedef int (*Function)( double ,
111 gsl_mode_t ,
112 gsl_sf_result* ) ;
113 public:
115 FUNCTION_OBJECT_DEF( GSLFunctionWithModeAndError )
116 public:
118 GSLFunctionWithModeAndError ( Function fun ,
119 const gsl_mode_t& mode ) ;
121 GSLFunctionWithModeAndError ( const GSLFunctionWithModeAndError& ) ;
123 virtual ~GSLFunctionWithModeAndError () = default;
125 virtual double operator() ( double x ) const ;
126 virtual double operator() ( const Argument& x ) const ;
127 virtual bool hasAnalyticDerivative () const { return true ; }
128 virtual unsigned int dimensionality () const { return 1 ; }
129 Genfun::Derivative partial ( unsigned int i ) const ;
131 Function function () const ;
133 const gsl_mode_t& mode () const ;
135 const gsl_sf_result& result () const ;
137 double error () const ;
138 private:
139 // default constructor is disabled
140 GSLFunctionWithModeAndError () ;
141 // assignement operator is disabled
142 GSLFunctionWithModeAndError& operator=
143 ( const GSLFunctionWithModeAndError & ) ;
144 private:
145 Function m_function ;
146 std::unique_ptr<gsl_mode_t> m_mode ;
147 std::unique_ptr<gsl_sf_result> m_result ;
148 };
149
150 } // end of namespace GaudiMath Implemnentation
151 } // end of namespace Genfun
152
153 #endif // GAUDIMATH_GSLFUNADAPTERS_H
154 // ============================================================================
GaudiMath::GSLFunctionWithMode
Genfun::GaudiMathImplementation::GSLFunctionWithMode GSLFunctionWithMode
Definition: Adapters.h:25
Kernel.h
GaudiMath::GSLFunctionWithError
Genfun::GaudiMathImplementation::GSLFunctionWithError GSLFunctionWithError
Definition: Adapters.h:27
Genfun::GaudiMathImplementation::GSLFunctionWithMode::m_mode
gsl_mode_t * m_mode
Definition: GSLFunAdapters.h:103
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError::m_mode
std::unique_ptr< gsl_mode_t > m_mode
Definition: GSLFunAdapters.h:146
Genfun::GaudiMathImplementation::SimpleFunction
Definition: FunAdapters.h:202
GaudiMath::Function
Genfun::AbsFunction Function
Definition: GaudiMath.h:24
GaudiMath::Derivative
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition: GaudiMath.h:29
Genfun::GaudiMathImplementation::GSLFunction
Genfun::GaudiMathImplementation::SimpleFunction GSLFunction
the actual type for primitive adaptor
Definition: GSLFunAdapters.h:30
FunAdapters.h
Genfun::GaudiMathImplementation::GSLFunctionWithMode
Definition: GSLFunAdapters.h:70
Genfun::GaudiMathImplementation::GSLFunctionWithError::m_result
std::unique_ptr< gsl_sf_result > m_result
Definition: GSLFunAdapters.h:67
Genfun::GaudiMathImplementation::GSLFunctionWithError::dimensionality
virtual unsigned int dimensionality() const
Definition: GSLFunAdapters.h:51
merge_files.default
list default
Definition: merge_files.py:105
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError::m_result
std::unique_ptr< gsl_sf_result > m_result
Definition: GSLFunAdapters.h:147
Genfun::GaudiMathImplementation::GSLFunctionWithMode::dimensionality
virtual unsigned int dimensionality() const
Definition: GSLFunAdapters.h:90
GaudiMath::GSLFunctionWithModeAndError
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError GSLFunctionWithModeAndError
Definition: Adapters.h:29
std::unique_ptr< gsl_sf_result >
fun
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError::dimensionality
virtual unsigned int dimensionality() const
Definition: GSLFunAdapters.h:128
Genfun::GaudiMathImplementation::GSLFunctionWithError::m_function
Function m_function
Definition: GSLFunAdapters.h:66
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError::m_function
Function m_function
Definition: GSLFunAdapters.h:145
Genfun
CLHEP.
Definition: IEqSolver.h:13
Genfun::GaudiMathImplementation::GSLFunctionWithError
Definition: GSLFunAdapters.h:32
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:107
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError
Definition: GSLFunAdapters.h:106
ana.i
list i
Definition: ana.py:128
Genfun::GaudiMathImplementation::GSLFunctionWithMode::m_function
Function m_function
Definition: GSLFunAdapters.h:102