ROOT  6.06/09
Reference Guide
VirtualIntegrator.h
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Author: Magdalena Slawinska 10/2007
3 
4 
5 /**********************************************************************
6  * *
7  * Copyright (c) 2007 LCG ROOT Math Team, CERN/PH-SFT *
8  * *
9  * *
10  **********************************************************************/
11 
12 // Header file for class Minimizer
13 
14 #ifndef ROOT_Math_VirtualIntegrator
15 #define ROOT_Math_VirtualIntegrator
16 
17 #ifndef ROOT_Math_IFunctionfwd
18 #include "Math/IFunctionfwd.h"
19 #endif
20 
21 #ifndef ROOT_Math_Error
22 #include "Math/Error.h"
23 #endif
24 
25 #ifndef ROOT_Math_IntegratorOptions
26 #include "Math/IntegratorOptions.h"
27 #endif
28 
29 
30 #include <vector>
31 
32 
33 namespace ROOT {
34 namespace Math {
35 
36 //___________________________________________________________________
37 /**
38  Abstract class for all numerical integration methods (1D and multi-dim)
39  Interface defining the common methods for the
40  numerical integrator classes of one and multi dimensions
41  The derived class VirtualIntegratorOneDim defines the methods
42  for one-dimensional integration.
43  The derived class VirtualIntegratorMultiDim defines the method for
44  multi-dimensional integration.
45  The concrete classes for one dimension (e.g. GSLIntegrator) or
46  multi-dimension (e.g. GSLMCIntegrator) can be created using the
47  plug-in manager.
48  Users should not use directly this class but the concrete classes ROOT::Math::IntegratorOneDim or
49  ROOT::Math::IntegratorMultiDim
50 
51 
52  @ingroup Integration
53 
54 */
56 
57 public:
58 
59  // destructor: no operation
60  virtual ~VirtualIntegrator() {}
61 
62  /**
63  set the desired relative Error
64  */
65  virtual void SetRelTolerance(double ) = 0;
66 
67  /**
68  set the desired absolute Error
69  */
70  virtual void SetAbsTolerance(double ) = 0;
71 
72  /**
73  return the Result of the last Integral calculation
74  */
75  virtual double Result() const = 0;
76 
77  /**
78  return the estimate of the absolute Error of the last Integral calculation
79  */
80  virtual double Error() const = 0;
81 
82  /**
83  return the Error Status of the last Integral calculation
84  */
85  virtual int Status() const = 0;
86 
87  /**
88  return number of function evaluations in calculating the integral
89  (if integrator do not implement this function returns -1)
90  */
91  virtual int NEval() const { return -1; }
92 
93 
94 
95 
96 };
97 
98 //___________________________________________________________________
99 /**
100  Interface (abstract) class for 1D numerical integration
101  It must be implemented by the concrate Integrator classes like
102  ROOT::Math::GSLIntegrator.
103  Plug-in's exist in ROOT to be able to instantiate the derived classes via the
104  plug-in manager.
105  Users should not use directly this class but the concrete classes ROOT::Math::IntegratorOneDim.
106 
107 
108  @ingroup Integration
109 
110 */
112 
113 public:
114 
115  /// destructor: no operation
117 
118  /// evaluate integral
119  virtual double Integral(double a, double b) = 0;
120 
121  /// set integration function
122  virtual void SetFunction(const IGenFunction &) = 0;
123 
124  /// evaluate un-defined integral (between -inf, + inf)
125  virtual double Integral() = 0;
126 
127  /// evaluate integral over the (a, +inf)
128  virtual double IntegralUp(double a) = 0;
129 
130  /// evaluate integral over the (-inf, b)
131  virtual double IntegralLow(double b) = 0;
132 
133  /// evaluate integral with singular points
134  virtual double Integral( const std::vector<double> & pts) = 0;
135 
136  /// evaluate Cauchy integral
137  virtual double IntegralCauchy(double a, double b, double c) = 0;
138 
139  /// get the option used for the integration
140  /// must be implemented by derived class
141  virtual ROOT::Math::IntegratorOneDimOptions Options() const = 0;
142 
143  // return type of integrator
145  return Options().IntegratorType();
146  }
147 
148  /// set the options
149  /// (should be re-implemented by derived classes -if more options than tolerance exist
153  }
154 
155 
156 
157 };
158 
159 //___________________________________________________________________
160 /**
161  Interface (abstract) class for multi numerical integration
162  It must be implemented by the concrete Integrator classes like
163  ROOT::Math::GSLMCIntegrator.
164  Plug-in's exist in ROOT to be able to instantiate the derived classes via the
165  plug-in manager.
166  Users should not use directly this class but the concrete classes ROOT::Math::IntegratorMultiDim.
167 
168 
169  @ingroup Integration
170 
171 */
173 
174 public:
175 
176  /// destructor: no operation
178 
179  /// evaluate multi-dim integral
180  virtual double Integral(const double*, const double*) = 0;
181 
182  /// setting a multi-dim function
183  virtual void SetFunction(const IMultiGenFunction &) = 0;
184 
185  /// get the option used for the integration
186  /// impelement by derived class otherwise return default ones
188 
189  // return type of integrator
191  return Options().IntegratorType();
192  }
193 
194  /// set the options (if needed must be re-implemented by derived classes)
198  }
199 
200 
201 };
202 
203 
204 }//namespace Math
205 }//namespace ROOT
206 
207 
208 #endif /* ROOT_Math_VirtualIntegrator */
virtual void SetRelTolerance(double)=0
set the desired relative Error
Interface (abstract) class for 1D numerical integration It must be implemented by the concrate Integr...
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Definition: IFunction.h:133
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
Type
enumeration specifying the integration types.
virtual double Result() const =0
return the Result of the last Integral calculation
virtual ~VirtualIntegratorOneDim()
destructor: no operation
TArc * a
Definition: textangle.C:12
virtual ROOT::Math::IntegrationMultiDim::Type Type() const
virtual ROOT::Math::IntegrationOneDim::Type Type() const
virtual void SetFunction(const IGenFunction &)=0
set integration function
virtual ~VirtualIntegratorMultiDim()
destructor: no operation
virtual ROOT::Math::IntegratorOneDimOptions Options() const =0
get the option used for the integration must be implemented by derived class
virtual double Error() const =0
return the estimate of the absolute Error of the last Integral calculation
Abstract class for all numerical integration methods (1D and multi-dim) Interface defining the common...
virtual double IntegralLow(double b)=0
evaluate integral over the (-inf, b)
virtual ROOT::Math::IntegratorMultiDimOptions Options() const =0
get the option used for the integration impelement by derived class otherwise return default ones ...
virtual void SetOptions(const ROOT::Math::IntegratorOneDimOptions &opt)
set the options (should be re-implemented by derived classes -if more options than tolerance exist ...
virtual double IntegralCauchy(double a, double b, double c)=0
evaluate Cauchy integral
virtual void SetFunction(const IMultiGenFunction &)=0
setting a multi-dim function
Numerical multi dimensional integration options.
Interface (abstract) class for multi numerical integration It must be implemented by the concrete Int...
Numerical one dimensional integration options.
virtual int Status() const =0
return the Error Status of the last Integral calculation
IntegrationMultiDim::Type IntegratorType() const
type of the integrator (return the enumeration type)
Type
enumeration specifying the integration types.
virtual double Integral()=0
evaluate un-defined integral (between -inf, + inf)
double RelTolerance() const
absolute tolerance
IntegrationOneDim::Type IntegratorType() const
type of the integrator (return the enumeration type)
virtual void SetOptions(const ROOT::Math::IntegratorMultiDimOptions &opt)
set the options (if needed must be re-implemented by derived classes)
Namespace for new Math classes and functions.
virtual double IntegralUp(double a)=0
evaluate integral over the (a, +inf)
virtual void SetAbsTolerance(double)=0
set the desired absolute Error
double AbsTolerance() const
non-static methods for retrivieng options
virtual double Integral(const double *, const double *)=0
evaluate multi-dim integral
virtual int NEval() const
return number of function evaluations in calculating the integral (if integrator do not implement thi...
Documentation for the abstract class IBaseFunctionMultiDim.
Definition: IFunction.h:63