Logo ROOT  
Reference Guide
Integrator.h
Go to the documentation of this file.
1 // @(#)root/mathmore:$Id$
2 // Authors: L. Moneta, M. Slawinska 10/2007
3 
4  /**********************************************************************
5  * *
6  * Copyright (c) 2007 ROOT Foundation, CERN/PH-SFT *
7  * *
8  * *
9  **********************************************************************/
10 
11 // Header file for class Integrator
12 //
13 //
14 #ifndef ROOT_Math_Integrator
15 #define ROOT_Math_Integrator
16 
18 
19 #include "Math/IntegratorOptions.h"
20 
21 #include "Math/IFunction.h"
22 
23 #include "Math/VirtualIntegrator.h"
24 
25 #include <memory>
26 #include <vector>
27 #include <string>
28 
29 
30 /**
31  @defgroup NumAlgo Numerical Algorithms
32  Numerical Algorithm classes from the \ref MathCorePage and \ref MathMorePage libraries.
33  @ingroup MathCore
34  @ingroup MathMore
35  */
36 
37 
38 /**
39 
40 @defgroup Integration Numerical Integration
41 
42 Classes for numerical integration of functions.
43 These classes provide algorithms for integration of one-dimensional functions, with several adaptive and non-adaptive methods
44 and for integration of multi-dimensional function using an adaptive method or MonteCarlo Integration (GSLMCIntegrator).
45 The basic classes ROOT::Math::IntegratorOneDim provides a common interface for the one-dimensional methods while the class
46 ROOT::Math::IntegratorMultiDim provides the interface for the multi-dimensional ones.
47 The methods can be configured (e.g setting the default method with its defult parameters) using the ROOT::Math::IntegratorOneDimOptions and
48 ROOT::Math::IntegratorMultiDimOptions classes.
49 
50 @ingroup NumAlgo
51 
52 */
53 
54 
55 
56 namespace ROOT {
57 namespace Math {
58 
59 
60 
61 
62 //____________________________________________________________________________________________
63 /**
64 
65 User Class for performing numerical integration of a function in one dimension.
66 It uses the plug-in manager to load advanced numerical integration algorithms from GSL, which reimplements the
67 algorithms used in the QUADPACK, a numerical integration package written in Fortran.
68 
69 Various types of adaptive and non-adaptive integration are supported. These include
70 integration over infinite and semi-infinite ranges and singular integrals.
71 
72 The integration type is selected using the Integration::type enumeration
73 in the class constructor.
74 The default type is adaptive integration with singularity
75 (ADAPTIVESINGULAR or QAGS in the QUADPACK convention) applying a Gauss-Kronrod 21-point integration rule.
76 In the case of ADAPTIVE type, the integration rule can also be specified via the
77 Integration::GKRule. The default rule is 31 points.
78 
79 In the case of integration over infinite and semi-infinite ranges, the type used is always
80 ADAPTIVESINGULAR applying a transformation from the original interval into (0,1).
81 
82 The ADAPTIVESINGULAR type is the most sophicticated type. When performances are
83 important, it is then recommened to use the NONADAPTIVE type in case of smooth functions or
84  ADAPTIVE with a lower Gauss-Kronrod rule.
85 
86 For detailed description on GSL integration algorithms see the
87 <A HREF="http://www.gnu.org/software/gsl/manual/gsl-ref_16.html#SEC248">GSL Manual</A>.
88 
89 
90  @ingroup Integration
91 
92 */
93 
94 
96 
97 public:
98 
99  typedef IntegrationOneDim::Type Type; // for the enumerations defining the types
100 
101  // constructors
102 
103 
104  /**
105  Constructor of one dimensional Integrator, default type is adaptive
106 
107  @param type integration type (adaptive, non-adaptive, etc..)
108  @param absTol desired absolute Error
109  @param relTol desired relative Error
110  @param size maximum number of sub-intervals
111  @param rule Gauss-Kronrod integration rule (only for GSL kADAPTIVE type)
112 
113  Possible type values are : kGAUSS (simple Gauss method), kADAPTIVE (from GSL), kADAPTIVESINGULAR (from GSL), kNONADAPTIVE (from GSL)
114  Possible rule values are kGAUS15 (rule = 1), kGAUS21( rule = 2), kGAUS31(rule =3), kGAUS41 (rule=4), kGAUS51 (rule =5), kGAUS61(rule =6)
115  lower rules are indicated for singular functions while higher for smooth functions to get better accuracies
116 
117  NOTE: When the default values are passed, the values used are taken from the default defined in ROOT::Math::IntegratorOneDimOptions
118  */
119  explicit
120  IntegratorOneDim(IntegrationOneDim::Type type = IntegrationOneDim::kDEFAULT, double absTol = -1, double relTol = -1, unsigned int size = 0, unsigned int rule = 0) :
121  fIntegrator(0), fFunc(0)
122  {
123  fIntegrator = CreateIntegrator(type, absTol, relTol, size, rule);
124  }
125 
126  /**
127  Constructor of one dimensional Integrator passing a function interface
128 
129  @param f integration function (1D interface). It is copied inside
130  @param type integration type (adaptive, non-adaptive, etc..)
131  @param absTol desired absolute tolerance. The algorithm will stop when either the absolute OR the relative tolerance are satisfied.
132  @param relTol desired relative tolerance
133  @param size maximum number of sub-intervals
134  @param rule Gauss-Kronrod integration rule (only for GSL ADAPTIVE type)
135 
136  NOTE: When no values are passed, the values used are taken from the default defined in ROOT::Math::IntegratorOneDimOptions
137  */
138  explicit
139  IntegratorOneDim(const IGenFunction &f, IntegrationOneDim::Type type = IntegrationOneDim::kDEFAULT, double absTol = -1, double relTol = -1, unsigned int size = 0, int rule = 0) :
140  fIntegrator(0), fFunc(0)
141  {
142  fIntegrator = CreateIntegrator(type, absTol, relTol, size, rule);
143  SetFunction(f,true);
144  }
145 
146  /**
147  Template Constructor of one dimensional Integrator passing a generic function object
148 
149  @param f integration function (any C++ callable object implementing operator()(double x)
150  @param type integration type (adaptive, non-adaptive, etc..)
151  @param absTol desired absolute tolerance. The algorithm will stop when either the absolute OR the relative tolerance are satisfied.
152  @param relTol desired relative tolerance
153  @param size maximum number of sub-intervals
154  @param rule Gauss-Kronrod integration rule (only for GSL ADAPTIVE type)
155 
156  NOTE: When no values are passed, the values used are taken from the default defined in ROOT::Math::IntegratorOneDimOptions
157 
158  */
159 
160  template<class Function>
161  explicit
162  IntegratorOneDim(Function & f, IntegrationOneDim::Type type = IntegrationOneDim::kDEFAULT, double absTol = -1, double relTol = -1, unsigned int size = 0, int rule = 0) :
163  fIntegrator(0), fFunc(0)
164  {
165  fIntegrator = CreateIntegrator(type, absTol, relTol, size, rule);
166  SetFunction(f);
167  }
168 
169  /// destructor (will delete contained pointers)
170  virtual ~IntegratorOneDim() {
171  if (fIntegrator) delete fIntegrator;
172  if (fFunc) delete fFunc;
173  }
174 
175  // disable copy constructur and assignment operator
176 
177 private:
179  IntegratorOneDim & operator=(const IntegratorOneDim &) { return *this; }
180 
181 public:
182 
183 
184  // template methods for generic functors
185 
186  /**
187  method to set the a generic integration function
188  @param f integration function. The function type must implement the assigment operator, <em> double operator() ( double x ) </em>
189 
190  */
191 
192 
193  template<class Function>
194  inline void SetFunction(Function & f);
195 
196  /**
197  set one dimensional function for 1D integration
198  */
199  void SetFunction (const IGenFunction &f, bool copy = false) {
200  if (!fIntegrator) return;
201  if (copy) {
202  if (fFunc) delete fFunc;
203  fFunc = f.Clone();
205  return;
206  }
208  }
209 
210 
211  /**
212  Set integration function from a multi-dim function type.
213  Can be used in case of having 1D function implementing the generic interface
214  @param f integration function
215  @param icoord index of coordinate on which the integration is performed
216  @param x array of the passed variables values. In case of dim=1 a 0 can be passed
217  */
218  void SetFunction(const IMultiGenFunction &f, unsigned int icoord , const double * x );
219 
220  // integration methods using a function
221 
222  /**
223  evaluate the Integral of a function f over the defined interval (a,b)
224  @param f integration function. The function type must be a C++ callable object implementing operator()(double x)
225  @param a lower value of the integration interval
226  @param b upper value of the integration interval
227  */
228  template<class Function>
229  double Integral(Function & f, double a, double b);
230 
231 
232  /**
233  evaluate the Integral of a function f over the defined interval (a,b)
234  @param f integration function. The function type must implement the mathlib::IGenFunction interface
235  @param a lower value of the integration interval
236  @param b upper value of the integration interval
237  */
238  double Integral(const IGenFunction & f, double a, double b) {
239  SetFunction(f,false);
240  return Integral(a,b);
241  }
242 
243 
244  /**
245  evaluate the Integral of a function f over the infinite interval (-inf,+inf)
246  @param f integration function. The function type must be a C++ callable object implementing operator()(double x)
247  */
248 // template<class Function>
249 // double Integral(const Function & f);
250 
251  /**
252  evaluate the Integral of a function f over the infinite interval (-inf,+inf)
253  @param f integration function. The function type must implement the mathlib::IGenFunction interface
254  */
255  double Integral(const IGenFunction & f) {
256  SetFunction(f,false);
257  return Integral();
258  }
259 
260 
261  /**
262  evaluate the Integral of a function f over the semi-infinite interval (a,+inf)
263  @param f integration function. The function type must be a C++ callable object implementing operator()(double x)
264  @param a lower value of the integration interval
265  */
266 // template<class Function>
267 // double IntegralUp(Function & f, double a);
268 
269  /**
270  evaluate the Integral of a function f over the semi-infinite interval (a,+inf)
271  @param f integration function. The function type must implement the mathlib::IGenFunction interface
272  @param a lower value of the integration interval
273 
274  */
275  double IntegralUp(const IGenFunction & f, double a ) {
276  SetFunction(f,false);
277  return IntegralUp(a);
278  }
279 
280  /**
281  evaluate the Integral of a function f over the over the semi-infinite interval (-inf,b)
282  @param f integration function. The function type must be a C++ callable object implementing operator()(double x)
283  @param b upper value of the integration interval
284  */
285 // template<class Function>
286 // double IntegralLow(Function & f, double b);
287 
288  /**
289  evaluate the Integral of a function f over the over the semi-infinite interval (-inf,b)
290  @param f integration function. The function type must implement the mathlib::IGenFunction interface
291  @param b upper value of the integration interval
292  */
293  double IntegralLow(const IGenFunction & f, double b ) {
294  SetFunction(f,false);
295  return IntegralLow(b);
296  }
297 
298  /**
299  evaluate the Integral of a function f with known singular points over the defined Integral (a,b)
300  @param f integration function. The function type must be a C++ callable object implementing operator()(double x)
301  @param pts vector containing both the function singular points and the lower/upper edges of the interval. The vector must have as first element the lower edge of the integration Integral ( \a a) and last element the upper value.
302 
303  */
304  template<class Function>
305  double Integral(Function & f, const std::vector<double> & pts );
306 
307  /**
308  evaluate the Integral of a function f with known singular points over the defined Integral (a,b)
309  @param f integration function. The function type must implement the mathlib::IGenFunction interface
310  @param pts vector containing both the function singular points and the lower/upper edges of the interval. The vector must have as first element the lower edge of the integration Integral ( \a a) and last element the upper value.
311 
312  */
313  double Integral(const IGenFunction & f, const std::vector<double> & pts ) {
314  SetFunction(f,false);
315  return Integral(pts);
316  }
317 
318  /**
319  evaluate the Cauchy principal value of the integral of a function f over the defined interval (a,b) with a singularity at c
320  @param f integration function. The function type must be a C++ callable object implementing operator()(double x)
321  @param a lower value of the integration interval
322  @param b upper value of the integration interval
323  @param c position of singularity
324 
325  */
326  template<class Function>
327  double IntegralCauchy(Function & f, double a, double b, double c);
328 
329  /**
330  evaluate the Cauchy principal value of the integral of a function f over the defined interval (a,b) with a singularity at c
331  @param f integration function. The function type must implement the mathlib::IGenFunction interface
332  @param a lower value of the integration interval
333  @param b upper value of the integration interval
334  @param c position of singularity
335 
336  */
337  double IntegralCauchy(const IGenFunction & f, double a, double b, double c) {
338  SetFunction(f,false);
339  return IntegralCauchy(a,b,c);
340  }
341 
342 
343 
344  // integration method using cached function
345 
346  /**
347  evaluate the Integral over the defined interval (a,b) using the function previously set with Integrator::SetFunction method
348  @param a lower value of the integration interval
349  @param b upper value of the integration interval
350  */
351 
352  double Integral(double a, double b) {
353  return fIntegrator == 0 ? 0 : fIntegrator->Integral(a,b);
354  }
355 
356 
357  /**
358  evaluate the Integral over the infinite interval (-inf,+inf) using the function previously set with Integrator::SetFunction method.
359  */
360 
361  double Integral( ) {
362  return fIntegrator == 0 ? 0 : fIntegrator->Integral();
363  }
364 
365  /**
366  evaluate the Integral of a function f over the semi-infinite interval (a,+inf) using the function previously set with Integrator::SetFunction method.
367  @param a lower value of the integration interval
368  */
369  double IntegralUp(double a ) {
370  return fIntegrator == 0 ? 0 : fIntegrator->IntegralUp(a);
371  }
372 
373  /**
374  evaluate the Integral of a function f over the over the semi-infinite interval (-inf,b) using the function previously set with Integrator::SetFunction method.
375  @param b upper value of the integration interval
376  */
377  double IntegralLow( double b ) {
378  return fIntegrator == 0 ? 0 : fIntegrator->IntegralLow(b);
379  }
380  /**
381  define operator() for IntegralLow
382  */
383  double operator() (double x) {
384  return IntegralLow(x);
385  }
386 
387 
388  /**
389  evaluate the Integral over the defined interval (a,b) using the function previously set with Integrator::SetFunction method. The function has known singular points.
390  @param pts vector containing both the function singular points and the lower/upper edges of the interval. The vector must have as first element the lower edge of the integration Integral ( \a a) and last element the upper value.
391 
392  */
393  double Integral( const std::vector<double> & pts) {
394  return fIntegrator == 0 ? 0 : fIntegrator->Integral(pts);
395  }
396 
397  /**
398  evaluate the Cauchy principal value of the integral of a function f over the defined interval (a,b) with a singularity at c
399 
400  */
401  double IntegralCauchy(double a, double b, double c) {
402  return fIntegrator == 0 ? 0 : fIntegrator->IntegralCauchy(a,b,c);
403  }
404 
405  /**
406  return the Result of the last Integral calculation
407  */
408  double Result() const { return fIntegrator == 0 ? 0 : fIntegrator->Result(); }
409 
410  /**
411  return the estimate of the absolute Error of the last Integral calculation
412  */
413  double Error() const { return fIntegrator == 0 ? 0 : fIntegrator->Error(); }
414 
415  /**
416  return the Error Status of the last Integral calculation
417  */
418  int Status() const { return fIntegrator == 0 ? -1 : fIntegrator->Status(); }
419 
420  /**
421  return number of function evaluations in calculating the integral
422  (if integrator do not implement this function returns -1)
423  */
424  int NEval() const { return fIntegrator == 0 ? -1 : fIntegrator->NEval(); }
425 
426 
427  // setter for control Parameters (getters are not needed so far )
428 
429  /**
430  set the desired relative Error
431  */
432  void SetRelTolerance(double relTolerance) { if (fIntegrator) fIntegrator->SetRelTolerance(relTolerance); }
433 
434 
435  /**
436  set the desired absolute Error
437  */
438  void SetAbsTolerance(double absTolerance) { if (fIntegrator) fIntegrator->SetAbsTolerance(absTolerance); }
439 
440  /**
441  return a pointer to integrator object
442  */
444 
445  /**
446  set the options
447  */
449 
450  /**
451  retrieve the options
452  */
454 
455  /// return name of integrator
456  std::string Name() const { return (fIntegrator) ? Options().Integrator() : std::string(""); }
457 
458  /// static function to get the enumeration from a string
459  static IntegrationOneDim::Type GetType(const char * name);
460 
461  /// static function to get a string from the enumeration
462  static std::string GetName(IntegrationOneDim::Type);
463 
464 
465 protected:
466 
467  VirtualIntegratorOneDim * CreateIntegrator(IntegrationOneDim::Type type , double absTol, double relTol, unsigned int size, int rule);
468 
469 private:
470 
471  VirtualIntegratorOneDim * fIntegrator; // pointer to integrator interface class
472  IGenFunction * fFunc; // pointer to owned function
473 
474 };
475 
476 
478 
479 
480 } // namespace Math
481 } // namespace ROOT
482 
483 
484 #ifndef __CINT__
485 
486 
487 #include "Math/WrappedFunction.h"
488 
489 template<class Function>
492  // need to copy the wrapper function, the instance created here will be deleted after SetFunction()
493  SetFunction(wf, true);
494 }
495 
496 template<class Function>
499  SetFunction(wf,false); // no copy is needed in this case
500  return Integral(a,b);
501 }
502 
503 // remove because can create ambiguities
504 
505 // template<class Function>
506 // double ROOT::Math::IntegratorOneDim::Integral(const Function & f) {
507 // ROOT::Math::WrappedFunction<const Function &> wf(f);
508 // SetFunction(wf,false); // no copy is needed in this case
509 // return Integral();
510 // }
511 
512 // template<class Function>
513 // double ROOT::Math::IntegratorOneDim::IntegralLow(Function & f, double x) {
514 // ROOT::Math::WrappedFunction< Function &> wf(f);
515 // SetFunction(wf,false); // no copy is needed in this case
516 // return IntegralLow(x);
517 // }
518 
519 // template<class Function>
520 // double ROOT::Math::IntegratorOneDim::IntegralUp(Function & f, double x) {
521 // ROOT::Math::WrappedFunction<Function &> wf(f);
522 // SetFunction(wf,false); // no copy is needed in this case
523 // return IntegralUp(x);
524 // }
525 
526 template<class Function>
527 double ROOT::Math::IntegratorOneDim::Integral(Function & f, const std::vector<double> & pts) {
529  SetFunction(wf,false); // no copy is needed in this case
530  return Integral(pts);
531 }
532 
533 template<class Function>
534 double ROOT::Math::IntegratorOneDim::IntegralCauchy(Function & f, double a, double b, double c) {
536  SetFunction(wf,false); // no copy is needed in this case
537  return IntegralCauchy(a,b,c);
538 }
539 
540 
541 #endif
542 
543 
544 
545 #endif /* ROOT_Math_Integrator */
ROOT::Math::VirtualIntegratorOneDim::SetFunction
virtual void SetFunction(const IGenFunction &)=0
set integration function
c
#define c(i)
Definition: RSha256.hxx:119
ROOT::Math::IntegratorOneDim::Error
double Error() const
return the estimate of the absolute Error of the last Integral calculation
Definition: Integrator.h:413
AllIntegrationTypes.h
ROOT::Math::IntegratorOneDim::IntegralCauchy
double IntegralCauchy(Function &f, double a, double b, double c)
evaluate the Cauchy principal value of the integral of a function f over the defined interval (a,...
Definition: Integrator.h:534
ROOT::Math::WrappedFunction
Template class to wrap any C++ callable object which takes one argument i.e.
Definition: WrappedFunction.h:94
IFunction.h
f
#define f(i)
Definition: RSha256.hxx:122
ROOT::Math::IntegratorOneDim::fFunc
IGenFunction * fFunc
Definition: Integrator.h:472
ROOT::Math::IntegratorOneDim::CreateIntegrator
VirtualIntegratorOneDim * CreateIntegrator(IntegrationOneDim::Type type, double absTol, double relTol, unsigned int size, int rule)
Definition: Integrator.cxx:124
ROOT::Math::IntegratorOneDim::fIntegrator
VirtualIntegratorOneDim * fIntegrator
Definition: Integrator.h:471
ROOT::Math::IntegratorOneDim::IntegralCauchy
double IntegralCauchy(const IGenFunction &f, double a, double b, double c)
evaluate the Cauchy principal value of the integral of a function f over the defined interval (a,...
Definition: Integrator.h:337
ROOT::Math::IntegratorOneDim::Integral
double Integral(const IGenFunction &f, const std::vector< double > &pts)
evaluate the Integral of a function f with known singular points over the defined Integral (a,...
Definition: Integrator.h:313
ROOT::Math::IntegratorOneDim::IntegralLow
double IntegralLow(const IGenFunction &f, double b)
evaluate the Integral of a function f over the over the semi-infinite interval (-inf,...
Definition: Integrator.h:293
ROOT::Math::IntegratorOneDim::Options
ROOT::Math::IntegratorOneDimOptions Options() const
retrieve the options
Definition: Integrator.h:453
ROOT::Math::VirtualIntegratorOneDim::SetOptions
virtual void SetOptions(const ROOT::Math::IntegratorOneDimOptions &opt)
set the options (should be re-implemented by derived classes -if more options than tolerance exist
Definition: VirtualIntegrator.h:154
ROOT::Math::VirtualIntegratorOneDim::IntegralLow
virtual double IntegralLow(double b)=0
evaluate integral over the (-inf, b)
ROOT::Math::IntegratorOneDim::Integral
double Integral(const IGenFunction &f)
evaluate the Integral of a function f over the infinite interval (-inf,+inf)
Definition: Integrator.h:255
ROOT::Math::VirtualIntegrator::SetAbsTolerance
virtual void SetAbsTolerance(double)=0
set the desired absolute Error
ROOT::Math::IntegratorOneDim::SetFunction
void SetFunction(const IGenFunction &f, bool copy=false)
set one dimensional function for 1D integration
Definition: Integrator.h:199
ROOT::Math::IntegratorOneDim::operator()
double operator()(double x)
define operator() for IntegralLow
Definition: Integrator.h:383
ROOT::Math::IntegratorOneDim::SetFunction
void SetFunction(Function &f)
method to set the a generic integration function
Definition: Integrator.h:490
ROOT::Math::VirtualIntegrator::SetRelTolerance
virtual void SetRelTolerance(double)=0
set the desired relative Error
ROOT::Math::IntegratorOneDim::operator=
IntegratorOneDim & operator=(const IntegratorOneDim &)
Definition: Integrator.h:179
x
Double_t x[n]
Definition: legend1.C:17
ROOT::Math::VirtualIntegratorOneDim::IntegralCauchy
virtual double IntegralCauchy(double a, double b, double c)=0
evaluate Cauchy integral
ROOT::Math::IntegratorOneDim::Result
double Result() const
return the Result of the last Integral calculation
Definition: Integrator.h:408
ROOT::Math::IntegratorOneDim::Integral
double Integral()
evaluate the Integral over the infinite interval (-inf,+inf) using the function previously set with I...
Definition: Integrator.h:361
ROOT::Math::VirtualIntegrator::Result
virtual double Result() const =0
return the Result of the last Integral calculation
Function
Double_t(* Function)(Double_t)
Definition: Functor.C:4
ROOT::Math::IntegratorOneDim::IntegratorOneDim
IntegratorOneDim(IntegrationOneDim::Type type=IntegrationOneDim::kDEFAULT, double absTol=-1, double relTol=-1, unsigned int size=0, unsigned int rule=0)
Constructor of one dimensional Integrator, default type is adaptive.
Definition: Integrator.h:120
ROOT::Math::IntegrationOneDim::Type
Type
enumeration specifying the integration types.
Definition: AllIntegrationTypes.h:60
ROOT::Math::IntegratorOneDim::GetName
static std::string GetName(IntegrationOneDim::Type)
static function to get a string from the enumeration
Definition: Integrator.cxx:76
b
#define b(i)
Definition: RSha256.hxx:118
ROOT::Math::IntegratorOneDim::GetIntegrator
VirtualIntegratorOneDim * GetIntegrator()
return a pointer to integrator object
Definition: Integrator.h:443
ROOT::Math::IntegratorOneDim::Type
IntegrationOneDim::Type Type
Definition: Integrator.h:99
ROOT::Math::IntegrationOneDim::kDEFAULT
@ kDEFAULT
Definition: AllIntegrationTypes.h:65
ROOT::Math::IntegratorOneDim::Name
std::string Name() const
return name of integrator
Definition: Integrator.h:456
ROOT::Math::IntegratorOneDim::NEval
int NEval() const
return number of function evaluations in calculating the integral (if integrator do not implement thi...
Definition: Integrator.h:424
a
auto * a
Definition: textangle.C:12
ROOT::Math::IntegratorOneDim::IntegratorOneDim
IntegratorOneDim(Function &f, IntegrationOneDim::Type type=IntegrationOneDim::kDEFAULT, double absTol=-1, double relTol=-1, unsigned int size=0, int rule=0)
Template Constructor of one dimensional Integrator passing a generic function object.
Definition: Integrator.h:162
ROOT::Math::VirtualIntegratorOneDim::Integral
virtual double Integral(double a, double b)=0
evaluate integral
ROOT::Math::IntegratorOneDimOptions
Numerical one dimensional integration options.
Definition: IntegratorOptions.h:123
ROOT::Math::VirtualIntegratorOneDim::IntegralUp
virtual double IntegralUp(double a)=0
evaluate integral over the (a, +inf)
ROOT::Math::IntegratorOneDim::Integral
double Integral(double a, double b)
evaluate the Integral over the defined interval (a,b) using the function previously set with Integrat...
Definition: Integrator.h:352
ROOT::Math::IntegratorOneDim::IntegralUp
double IntegralUp(double a)
evaluate the Integral of a function f over the semi-infinite interval (a,+inf) using the function pre...
Definition: Integrator.h:369
IntegratorOptions.h
VirtualIntegrator.h
ROOT::Math::IntegratorOneDim::Status
int Status() const
return the Error Status of the last Integral calculation
Definition: Integrator.h:418
ROOT::Math::IBaseFunctionOneDim
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Definition: IFunction.h:135
ROOT::Math::IntegratorOneDim::Integral
double Integral(const std::vector< double > &pts)
evaluate the Integral over the defined interval (a,b) using the function previously set with Integrat...
Definition: Integrator.h:393
ROOT::Math::IntegratorOneDim::IntegratorOneDim
IntegratorOneDim(const IntegratorOneDim &)
Definition: Integrator.h:178
ROOT::Math::VirtualIntegrator::Status
virtual int Status() const =0
return the Error Status of the last Integral calculation
ROOT::Math::IntegratorOneDim::SetOptions
void SetOptions(const ROOT::Math::IntegratorOneDimOptions &opt)
set the options
Definition: Integrator.h:448
ROOT::Math::IntegratorOneDim::IntegratorOneDim
IntegratorOneDim(const IGenFunction &f, IntegrationOneDim::Type type=IntegrationOneDim::kDEFAULT, double absTol=-1, double relTol=-1, unsigned int size=0, int rule=0)
Constructor of one dimensional Integrator passing a function interface.
Definition: Integrator.h:139
ROOT::Math::VirtualIntegrator::NEval
virtual int NEval() const
return number of function evaluations in calculating the integral (if integrator do not implement thi...
Definition: VirtualIntegrator.h:100
ROOT::Math::IntegratorOneDim::SetRelTolerance
void SetRelTolerance(double relTolerance)
set the desired relative Error
Definition: Integrator.h:432
ROOT::Math::IntegratorOneDim::SetAbsTolerance
void SetAbsTolerance(double absTolerance)
set the desired absolute Error
Definition: Integrator.h:438
name
char name[80]
Definition: TGX11.cxx:110
ROOT::Math::IntegratorOneDim::IntegralLow
double IntegralLow(double b)
evaluate the Integral of a function f over the over the semi-infinite interval (-inf,...
Definition: Integrator.h:377
ROOT::Math::VirtualIntegratorOneDim::Options
virtual ROOT::Math::IntegratorOneDimOptions Options() const =0
get the option used for the integration must be implemented by derived class
ROOT::Math::IntegratorOneDim::Integral
double Integral(const IGenFunction &f, double a, double b)
evaluate the Integral of a function f over the defined interval (a,b)
Definition: Integrator.h:238
ROOT::Math::IntegratorOneDim
User Class for performing numerical integration of a function in one dimension.
Definition: Integrator.h:95
WrappedFunction.h
ROOT::Math::VirtualIntegratorOneDim
Interface (abstract) class for 1D numerical integration It must be implemented by the concrate Integr...
Definition: VirtualIntegrator.h:115
type
int type
Definition: TGX11.cxx:121
ROOT::Math::IBaseFunctionMultiDimTempl
Documentation for the abstract class IBaseFunctionMultiDim.
Definition: IFunction.h:62
ROOT::Math::IntegratorOneDim::IntegralUp
double IntegralUp(const IGenFunction &f, double a)
evaluate the Integral of a function f over the semi-infinite interval (a,+inf)
Definition: Integrator.h:275
ROOT::Math::VirtualIntegrator::Error
virtual double Error() const =0
return the estimate of the absolute Error of the last Integral calculation
ROOT::Math::IntegratorOneDimOptions::Integrator
std::string Integrator() const
name of 1D integrator
Definition: IntegratorOptions.cxx:214
ROOT::Math::IntegratorOneDim::IntegralCauchy
double IntegralCauchy(double a, double b, double c)
evaluate the Cauchy principal value of the integral of a function f over the defined interval (a,...
Definition: Integrator.h:401
ROOT::Math::IntegratorOneDim::GetType
static IntegrationOneDim::Type GetType(const char *name)
static function to get the enumeration from a string
Definition: Integrator.cxx:63
ROOT::Math::Integrator
IntegratorOneDim Integrator
Definition: Integrator.h:477
ROOT
VSD Structures.
Definition: StringConv.hxx:21
Math
ROOT::Math::IntegratorOneDim::~IntegratorOneDim
virtual ~IntegratorOneDim()
destructor (will delete contained pointers)
Definition: Integrator.h:170