All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
NumericalIndefiniteIntegral.h
Go to the documentation of this file.
1 // $Id: NumericalIndefiniteIntegral.h,v 1.2 2008/10/27 19:22:20 marcocle Exp $
2 // ============================================================================
3 #ifndef GAUDIMATH_NUMERICALINDEFINITEINTEGRAL_H
4 #define GAUDIMATH_NUMERICALINDEFINITEINTEGRAL_H 1
5 // ============================================================================
6 // Include files
7 // ============================================================================
8 // STD & STL
9 // ============================================================================
10 #include <string>
11 // ============================================================================
12 // GaudiKernel
13 // ============================================================================
14 #include "GaudiKernel/StatusCode.h"
15 // ============================================================================
16 // GaudiMath
17 // ============================================================================
18 #include "GaudiMath/Integration.h"
19 // ============================================================================
20 // CLHEP
21 // ============================================================================
22 #include "CLHEP/GenericFunctions/AbsFunction.hh"
23 // ============================================================================
24 
25 
27 
28 namespace Genfun
29 {
30  namespace GaudiMathImplementation
31  {
76  class GAUDI_API NumericalIndefiniteIntegral : public AbsFunction
77  {
78  public:
79  struct _Workspace ;
80  struct _Function ;
81  public:
82 
84  typedef std::vector<double> Points ;
85 
86  public:
87 
89  FUNCTION_OBJECT_DEF( NumericalIndefiniteIntegral )
90 
91  public:
92 
157  ( const AbsFunction& function ,
158  const size_t index ,
159  const double a ,
160  const GaudiMath::Integration::Limit limit =
161  GaudiMath::Integration::VariableHighLimit ,
162  const GaudiMath::Integration::Type type =
163  GaudiMath::Integration::Adaptive ,
164  const GaudiMath::Integration::KronrodRule rule =
165  GaudiMath::Integration::Default ,
166  const double epsabs = 1e-10 ,
167  const double epsrel = 1.e-7 ,
168  const size_t size = 1000 );
169 
212  ( const AbsFunction& function ,
213  const size_t index ,
214  const double a ,
215  const Points& points ,
216  const GaudiMath::Integration::Limit limit =
217  GaudiMath::Integration::VariableHighLimit ,
218  const double epsabs = 1e-9 ,
219  const double epsrel = 1.e-6 ,
220  const size_t size = 1000 ) ;
221 
260  ( const AbsFunction& function ,
261  const size_t index ,
262  const GaudiMath::Integration::Limit limit =
263  GaudiMath::Integration::VariableHighLimit ,
264  const double epsabs = 1e-9 ,
265  const double epsrel = 1.e-6 ,
266  const size_t size = 1000 ) ;
267 
270  ( const NumericalIndefiniteIntegral& ) ;
271 
273  virtual ~NumericalIndefiniteIntegral() ;
274 
275  public:
276 
278  virtual unsigned int dimensionality() const { return m_DIM ; }
279 
281  virtual double operator() ( double argument ) const ;
283  virtual double operator() ( const Argument& argument ) const ;
284 
286  virtual bool hasAnalyticDerivative() const { return true ;}
287 
289  virtual Genfun::Derivative partial ( unsigned int index ) const;
290 
291  public:
292 
294  const AbsFunction& function () const { return *m_function ; }
296  double a () const { return m_a ; }
298  const Points& points () const { return m_points ; }
300  double epsabs () const { return m_epsabs ; }
302  double epsrel () const { return m_epsrel ; }
303 
305  double result () const { return m_result ; }
307  double error () const { return m_error ; }
308 
309  // maximal number of bisection integvals for adaptive algorithms
310  size_t size () const { return m_size ; }
311 
314  limit () const { return m_limit ; }
317  type () const { return m_type ; }
320  category () const { return m_category ; }
323  rule () const { return m_rule ; }
324 
325  protected:
326 
327  // adaptive integration on infinite intervals
328  double QAGI ( _Function* fun ) const ;
329  // adaptive integration with known singular points
330  double QAGP ( _Function* fun ) const ;
331  // non-adaptive integration
332  double QNG ( _Function* fun ) const ;
333  // adaptive integration
334  double QAG ( _Function* fun ) const ;
335  // adaptive integral with singularities
336  double QAGS ( _Function* fun ) const ;
337 
338  // allocate the integration workspace
339  _Workspace* allocate () const ;
340  // the integration workspace
341  _Workspace* ws () const
342  { return m_ws ; };
343 
344  // throw the exception
345  StatusCode Exception
346  ( const std::string& message ,
347  const StatusCode& sc = StatusCode::FAILURE ) const ;
348 
349  private:
350 
351  // default constructor is disabled
353  // assignement operator is disabled
354  NumericalIndefiniteIntegral& operator=
355  ( const NumericalIndefiniteIntegral& ) ;
356 
357  private:
358 
359  const AbsFunction* m_function ;
360  size_t m_DIM ;
361  size_t m_index ;
362 
363  double m_a ;
364 
369 
371  double* m_pdata ;
372 
373  double m_epsabs ;
374  double m_epsrel ;
375 
376  mutable double m_result ;
377  mutable double m_error ;
378 
379  size_t m_size ;
380  mutable _Workspace* m_ws ;
381 
382  mutable Argument m_argument ;
383 
384  };
385 
386  } // end of namespace GaudiMathImplementation
387 } // end of namespace Genfun
388 
389 // ============================================================================
390 // The END
391 // ============================================================================
392 #endif // GAUDIMATH_NUMERICALINDEFINITEINTEGRAL_H
393 // ============================================================================
Category
integration category
Definition: Integration.h:32
GaudiMath::Integration::Limit limit() const
integration limit
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition: GaudiMath.h:31
virtual bool hasAnalyticDerivative() const
Does this function have an analytic derivative?
GaudiMath::Integration::Category category() const
integration category
string type
Definition: gaudirun.py:126
GaudiMath::Integration::KronrodRule rule() const
integration rule
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Type
type of integration (for finite limits)
Definition: Integration.h:27
GaudiMath::Integration::Type type() const
integration type
Limit
how to distinguish variable low and variable high limits
Definition: Integration.h:24
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:27
KronrodRule
integration rule
Definition: Integration.h:36
std::vector< double > Points
typedef for vector of singular points
#define GAUDI_API
Definition: Kernel.h:108
Type
the list of available types for ntuples
Definition: TupleObj.h:63
collection of common types for classes NumericalIndefiniteIntegral and NumericalDefiniteIntegral ...