1 #ifndef GAUDIMATH_NUMERICALDEFINITEINTEGRAL_H
2 #define GAUDIMATH_NUMERICALDEFINITEINTEGRAL_H 1
12 #include "GaudiKernel/StatusCode.h"
16 #include "GaudiMath/Integration.h"
20 #include "CLHEP/GenericFunctions/AbsFunction.hh"
22 #include "gsl/gsl_integration.h"
26 namespace GaudiMathImplementation
71 class GAUDI_API NumericalDefiniteIntegral :
public AbsFunction
74 struct _Workspace { gsl_integration_workspace* ws ; };
79 typedef std::vector<double> Points ;
84 FUNCTION_OBJECT_DEF( NumericalDefiniteIntegral )
139 NumericalDefiniteIntegral
140 ( const AbsFunction& function ,
148 const
double epsabs = 1.e-10 ,
149 const
double epsrel = 1.e-7 ,
150 const
size_t size = 1000 );
181 NumericalDefiniteIntegral
182 ( const AbsFunction& function ,
186 const Points& points ,
187 const
double epsabs = 1e-9 ,
188 const
double epsrel = 1.e-6 ,
189 const
size_t size = 1000 ) ;
217 NumericalDefiniteIntegral
218 ( const AbsFunction& function ,
223 const
double epsabs = 1e-9 ,
224 const
double epsrel = 1.e-6 ,
225 const
size_t size = 1000 ) ;
252 NumericalDefiniteIntegral
253 ( const AbsFunction& function ,
257 const
double epsabs = 1e-9 ,
258 const
double epsrel = 1.e-6 ,
259 const
size_t size = 1000 ) ;
284 NumericalDefiniteIntegral
285 ( const AbsFunction& function ,
290 const
float epsabs = 1e-9 ,
291 const
float epsrel = 1.e-6 ,
292 const
size_t size = 1000 ) ;
295 NumericalDefiniteIntegral ( const NumericalDefiniteIntegral& ) ;
298 virtual ~NumericalDefiniteIntegral() =
default;
303 virtual
unsigned int dimensionality()
const {
return m_DIM ; }
306 virtual double operator() (
double argument )
const ;
308 virtual double operator() (
const Argument& argument )
const ;
311 virtual bool hasAnalyticDerivative()
const {
return true ;}
319 const AbsFunction&
function ()
const {
return *m_function ; }
321 double a ()
const {
return m_a ; }
322 double b ()
const {
return m_b ; }
324 const Points& points ()
const {
return m_points ; }
326 double epsabs ()
const {
return m_epsabs ; }
328 double epsrel ()
const {
return m_epsrel ; }
331 double result ()
const {
return m_result ; }
333 double error ()
const {
return m_error ; }
336 size_t size ()
const {
return m_size ; }
340 type ()
const {
return m_type ; }
343 category ()
const {
return m_category ; }
346 rule ()
const {
return m_rule ; }
351 double QAGI ( _Function*
fun )
const ;
353 double QAGP ( _Function*
fun )
const ;
355 double QNG ( _Function*
fun )
const ;
357 double QAG ( _Function*
fun )
const ;
359 double QAGS ( _Function*
fun )
const ;
362 _Workspace* allocate ()
const ;
364 _Workspace* ws ()
const
365 {
return m_ws.get() ; };
369 (
const std::string& message ,
375 NumericalDefiniteIntegral();
377 NumericalDefiniteIntegral& operator=(
const NumericalDefiniteIntegral& );
380 struct gsl_ws_deleter {
381 void operator()(_Workspace *p)
const {
382 if (p) gsl_integration_workspace_free ( p->ws ) ;
388 std::unique_ptr<const AbsFunction> m_function ;
402 std::unique_ptr<double[]> m_pdata ;
407 mutable double m_result ;
408 mutable double m_error ;
411 mutable std::unique_ptr<_Workspace,gsl_ws_deleter> m_ws;
413 mutable Argument m_argument ;
414 mutable Argument m_argF ;
424 #endif // GAUDIMATH_NUMERICALDEFINITEINTEGRAL_H
Category
integration category
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
This class is used for returning status codes from appropriate routines.
Type
type of integration (for finite limits)
double fun(const std::vector< double > &x)
GaudiMath.h GaudiMath/GaudiMath.h.
KronrodRule
integration rule
Type
the list of available types for ntuples
collection of common types for classes NumericalIndefiniteIntegral and NumericalDefiniteIntegral ...