|
||||
File indexing completed on 2025-01-18 10:10:22
0001 // @(#)root/mathcore:$Id$ 0002 // Author: Magdalena Slawinska 10/2007 0003 0004 0005 /********************************************************************** 0006 * * 0007 * Copyright (c) 2007 LCG ROOT Math Team, CERN/PH-SFT * 0008 * * 0009 * * 0010 **********************************************************************/ 0011 0012 // Header file for class Minimizer 0013 0014 #ifndef ROOT_Math_VirtualIntegrator 0015 #define ROOT_Math_VirtualIntegrator 0016 0017 #include "Math/IFunctionfwd.h" 0018 0019 #include "Math/Error.h" 0020 0021 #include "Math/IntegratorOptions.h" 0022 0023 0024 #include <vector> 0025 0026 0027 namespace ROOT { 0028 namespace Math { 0029 0030 //___________________________________________________________________ 0031 /** 0032 Abstract class for all numerical integration methods (1D and multi-dim) 0033 Interface defining the common methods for the 0034 numerical integrator classes of one and multi dimensions 0035 The derived class VirtualIntegratorOneDim defines the methods 0036 for one-dimensional integration. 0037 The derived class VirtualIntegratorMultiDim defines the method for 0038 multi-dimensional integration. 0039 The concrete classes for one dimension (e.g. GSLIntegrator) or 0040 multi-dimension (e.g. GSLMCIntegrator) can be created using the 0041 plug-in manager. 0042 Users should not use directly this class but the concrete classes ROOT::Math::IntegratorOneDim or 0043 ROOT::Math::IntegratorMultiDim 0044 0045 @ingroup Integration 0046 0047 */ 0048 class VirtualIntegrator{ 0049 0050 public: 0051 0052 /// destructor: no operation 0053 virtual ~VirtualIntegrator() {} 0054 0055 /** 0056 set the desired relative Error 0057 */ 0058 virtual void SetRelTolerance(double ) = 0; 0059 0060 /** 0061 set the desired absolute Error 0062 */ 0063 virtual void SetAbsTolerance(double ) = 0; 0064 0065 /** 0066 return the Result of the last Integral calculation 0067 */ 0068 virtual double Result() const = 0; 0069 0070 /** 0071 return the estimate of the absolute Error of the last Integral calculation 0072 */ 0073 virtual double Error() const = 0; 0074 0075 /** 0076 return the Error Status of the last Integral calculation 0077 */ 0078 virtual int Status() const = 0; 0079 0080 /** 0081 return number of function evaluations in calculating the integral 0082 (if integrator do not implement this function returns -1) 0083 */ 0084 virtual int NEval() const { return -1; } 0085 0086 }; 0087 0088 0089 //___________________________________________________________________ 0090 /** 0091 Interface (abstract) class for 1D numerical integration 0092 It must be implemented by the concrete Integrator classes like 0093 ROOT::Math::GSLIntegrator. 0094 Plug-in's exist in ROOT to be able to instantiate the derived classes via the 0095 plug-in manager. 0096 Users should not use directly this class but the concrete classes ROOT::Math::IntegratorOneDim. 0097 0098 @ingroup Integration 0099 0100 */ 0101 class VirtualIntegratorOneDim : public VirtualIntegrator { 0102 0103 public: 0104 0105 /// destructor: no operation 0106 ~VirtualIntegratorOneDim() override {} 0107 0108 /// evaluate integral 0109 virtual double Integral(double a, double b) = 0; 0110 0111 /// set integration function 0112 virtual void SetFunction(const IGenFunction &) = 0; 0113 0114 /// evaluate un-defined integral (between -inf, + inf) 0115 virtual double Integral() = 0; 0116 0117 /// evaluate integral over the (a, +inf) 0118 virtual double IntegralUp(double a) = 0; 0119 0120 /// evaluate integral over the (-inf, b) 0121 virtual double IntegralLow(double b) = 0; 0122 0123 /// evaluate integral with singular points 0124 virtual double Integral( const std::vector<double> & pts) = 0; 0125 0126 /// evaluate Cauchy integral 0127 virtual double IntegralCauchy(double a, double b, double c) = 0; 0128 0129 /// get the option used for the integration 0130 /// must be implemented by derived class 0131 virtual ROOT::Math::IntegratorOneDimOptions Options() const = 0; 0132 0133 /// return type of integrator 0134 virtual ROOT::Math::IntegrationOneDim::Type Type() const { 0135 return Options().IntegratorType(); 0136 } 0137 0138 /// set the options 0139 /// (should be re-implemented by derived classes -if more options than tolerance exist 0140 virtual void SetOptions(const ROOT::Math::IntegratorOneDimOptions & opt) { 0141 SetRelTolerance(opt.RelTolerance() ); 0142 SetAbsTolerance(opt.AbsTolerance() ); 0143 } 0144 0145 }; 0146 0147 0148 //___________________________________________________________________ 0149 /** 0150 Interface (abstract) class for multi numerical integration 0151 It must be implemented by the concrete Integrator classes like 0152 ROOT::Math::GSLMCIntegrator. 0153 Plug-in's exist in ROOT to be able to instantiate the derived classes via the 0154 plug-in manager. 0155 Users should not use directly this class but the concrete classes ROOT::Math::IntegratorMultiDim. 0156 0157 @ingroup Integration 0158 0159 */ 0160 class VirtualIntegratorMultiDim : public VirtualIntegrator { 0161 0162 public: 0163 0164 /// destructor: no operation 0165 ~VirtualIntegratorMultiDim() override {} 0166 0167 /// evaluate multi-dim integral 0168 virtual double Integral(const double*, const double*) = 0; 0169 0170 /// setting a multi-dim function 0171 virtual void SetFunction(const IMultiGenFunction &) = 0; 0172 0173 /// get the option used for the integration 0174 /// implement by derived class otherwise return default ones 0175 virtual ROOT::Math::IntegratorMultiDimOptions Options() const = 0; 0176 0177 /// return type of integrator 0178 virtual ROOT::Math::IntegrationMultiDim::Type Type() const { 0179 return Options().IntegratorType(); 0180 } 0181 0182 /// set the options (if needed must be re-implemented by derived classes) 0183 virtual void SetOptions(const ROOT::Math::IntegratorMultiDimOptions & opt) { 0184 SetRelTolerance(opt.RelTolerance() ); 0185 SetAbsTolerance(opt.AbsTolerance() ); 0186 } 0187 0188 }; 0189 0190 0191 }//namespace Math 0192 }//namespace ROOT 0193 0194 0195 #endif /* ROOT_Math_VirtualIntegrator */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |