| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral Class Reference

This class allows the numerical evaluation of the following functions: More...

`#include <GaudiMath/NumericalDefiniteIntegral.h>`

Inheritance diagram for Genfun::GaudiMathImplementation::NumericalDefiniteIntegral:
[legend]
Collaboration diagram for Genfun::GaudiMathImplementation::NumericalDefiniteIntegral:
[legend]

## Classes
struct | _Function
struct | _Workspace
struct | gsl_ws_deleter

## Public Types
typedef std::vector< double > | Points
| typedef for vector of singular points More...

## Public Member Functions
| NumericalDefiniteIntegral (const AbsFunction &function, const size_t index, const double a, const double b, const GaudiMath::Integration::Type type=GaudiMath::Integration::Adaptive, const GaudiMath::Integration::KronrodRule rule=GaudiMath::Integration::Default, const double epsabs=1.e-10, const double epsrel=1.e-7, const size_t size=1000)
| From CLHEP/GenericFunctions. More...
| NumericalDefiniteIntegral (const AbsFunction &function, const size_t index, const double a, const double b, const Points &points, const double epsabs=1e-9, const double epsrel=1.e-6, const size_t size=1000)
| Standard constructor The function created with this constructor compute the following integral: More...
| NumericalDefiniteIntegral (const AbsFunction &function, const size_t index, const double a, const GaudiMath::Integration::Inf b=GaudiMath::Integration::Infinity, const double epsabs=1e-9, const double epsrel=1.e-6, const size_t size=1000)
| Standard constructor The function created with this constructor compute the following integral: More...
| NumericalDefiniteIntegral (const AbsFunction &function, const size_t index, const GaudiMath::Integration::Inf a, const double b, const double epsabs=1e-9, const double epsrel=1.e-6, const size_t size=1000)
| Standard constructor The function created with this constructor compute the following integral: More...
| NumericalDefiniteIntegral (const AbsFunction &function, const size_t index, const float epsabs=1e-9, const float epsrel=1.e-6, const size_t size=1000)
| Standard constructor The function created with this constructor compute the following integral: More...
| NumericalDefiniteIntegral (const NumericalDefiniteIntegral &)
| copy constructor More...
| ~NumericalDefiniteIntegral () override=default
| destructor More...
unsigned int | dimensionality () const override
| dimensionality of the problem More...
double | operator() (double argument) const override
| Function value. More...
double | operator() (const Argument &argument) const override
| Function value. More...
bool | hasAnalyticDerivative () const override
| Does this function have an analytic derivative? More...
Genfun::Derivative | partial (unsigned int index) const override
| Derivatives. More...
const AbsFunction & | function () const
| accessor to the function itself More...
double | a () const
| integration limit More...
double | b () const
const Points & | points () const
| known singularities More...
double | epsabs () const
| absolute precision More...
double | epsrel () const
| relatiove precision More...
double | result () const
| previous result More...
double | error () const
| evaluate of previous error More...
size_t | size () const
GaudiMath::Integration::Type | type () const
| integration type More...
GaudiMath::Integration::Category | category () const
| integration category More...
GaudiMath::Integration::KronrodRule | rule () const
| integration rule More...

## Protected Member Functions
double | QAGI (_Function *fun) const
double | QAGP (_Function *fun) const
double | QNG (_Function *fun) const
double | QAG (_Function *fun) const
double | QAGS (_Function *fun) const
_Workspace * | allocate () const
| allocate the integration workspace More...
_Workspace * | ws () const
StatusCode | Exception (const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const

## Private Member Functions
| NumericalDefiniteIntegral ()
NumericalDefiniteIntegral & | operator= (const NumericalDefiniteIntegral &)

## Private Attributes
std::unique_ptr< const AbsFunction > | m_function
size_t | m_DIM = 0
size_t | m_index
double | m_a = -std::numeric_limits<double>::infinity()
double | m_b = std::numeric_limits<double>::infinity()
GaudiMath::Integration::Type | m_type
GaudiMath::Integration::Category | m_category
GaudiMath::Integration::KronrodRule | m_rule
Points | m_points
double | m_epsabs
double | m_epsrel
double | m_result = -std::numeric_limits<double>::infinity()
double | m_error = std::numeric_limits<double>::infinity()
size_t | m_size
std::unique_ptr< _Workspace, gsl_ws_deleter > | m_ws
Argument | m_argument
Argument | m_argF

## Detailed Description

This class allows the numerical evaluation of the following functions:

\[ {\mathcal{F}}_i \left(x_1, \dots , x_{i-1}, x_{i+1}, \dots , x_n \right) = \int\limits_{a}^{b} f \left(x_1, \dots , x_{i-1}, \hat{x}_i , x_{i+1}, \dots , x_n \right) \, {\mathrm{d}} \hat{x}_i \]

\[ {\mathcal{F}}_i \left(x_1, \dots , x_{i-1}, x_{i+1}, \dots , x_n \right) = \int\limits_{a}^{+\infty} f \left(x_1, \dots , x_{i-1}, \hat{x}_i , x_{i+1}, \dots , x_n \right) \, {\mathrm{d}} \hat{x}_i \]

\[ {\mathcal{F}}_i \left(x_1, \dots , x_{i-1}, x_{i+1}, \dots , x_n \right) = \int\limits_{-\infty}^{b} f \left(x_1, \dots , x_{i-1}, \hat{x}_i , x_{i+1}, \dots , x_n \right) \, {\mathrm{d}} \hat{x}_i \]

\[ {\mathcal{F}}_i \left(x_1, \dots , x_{i-1}, x_{i+1}, \dots , x_n \right) = \int\limits_{-\infty}^{+\infty} f \left(x_1, \dots , x_{i-1}, \hat{x}_i , x_{i+1}, \dots , x_n \right) \, {\mathrm{d}} \hat{x}_i \]

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2003-08-31

Definition at line 79 of file NumericalDefiniteIntegral.h.

## Member Typedef Documentation

typedef std::vector<double> Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Points

typedef for vector of singular points

Definition at line 85 of file NumericalDefiniteIntegral.h.

## Constructor & Destructor Documentation

Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::NumericalDefiniteIntegral | ( | const AbsFunction & | function,
|  | const size_t | index,
|  | const double | a,
|  | const double | b,
|  | const GaudiMath::Integration::Type | type = `GaudiMath::Integration::Adaptive`,
|  | const GaudiMath::Integration::KronrodRule | rule = `GaudiMath::Integration::Default`,
|  | const double | epsabs = `1.e-10`,
|  | const double | epsrel = `1.e-7`,
|  | const size_t | size = `1000`
| ) |  |

From CLHEP/GenericFunctions.

Standard constructor The function created with this constructor compute the following integral:

Standard constructor The function created with this constructor compute the following integral:

\[ {\mathcal{F}}_i \left(x_1, \dots , x_{i-1}, x_{i+1}, \dots , x_n \right) = \int\limits_{a}^{b} f \left(x_1, \dots , x_{i-1}, \hat{x}_i , x_{i+1}, \dots , x_n \right) \, {\mathrm{d}} \hat{x}_i \]

If function contains singularities, the `type` = `Type::AdaptiveSingular` need to be used

For faster integration of smooth function non-adaptive integration can be used: `type` = `Type::NonAdaptive` need to be used

For adaptive integration `type` = `Type>>Adaptive` one can specify the order of Gauss-Kronrad integration rule `rule` = `KronrodRule::Gauss15` The higher-order rules give better accuracy for smooth functions, while lower-order rules save the time when the function contains local difficulties, such as discontinuites.

- The GSL routine `gsl_integration_qng` is used for `type` = `Type:NonAdaptive` :

The GSL routine `gsl_integration_qag` is used for `type` = `Type:Adaptive` :

- The GSL routine `gsl_integration_qags` is used for `type` = `Type:AdaptiveSingular` :

Parameters

  function | funtion to be integrated
  index | variable index
  a | lower intgeration limit
  b | high integration limit
  type | integration type
  rule | integration rule (for adaptive integration)
  epsabs | required absolute precision
  epsrel | required relative precision
  size | maximal number of bisections for adaptive integration

\[ {\mathcal{F}}_i \left(x_1, \dots , x_{i-1}, x_{i+1}, \dots , x_n \right) = \int\limits_{a}^{b} f \left(x_1, \dots , x_{i-1}, \hat{x}_i , x_{i+1}, \dots , x_n \right) \, {\mathrm{d}} \hat{x}_i \]

If function contains singularities, the `type` = `Type::AdaptiveSingular` need to be used

For faster integration of smooth function non-adaptive integration can be used: `type` = `Type::NonAdaptive` need to be used

For adaptive integration `type` = `Type>>Adaptive` one can specify the order of Gauss-Kronrad integration rule `rule` = `KronrodRule::Gauss15` The higher-order rules give better accuracy for smooth functions, while lower-order rules save the time when the function contains local difficulties, such as discontinuites.

- The GSL routine `gsl_integration_qng` is used for `type` = `Type:NonAdaptive` :
- The GSL routine `gsl_integration_qag` is used for `type` = `Type:Adaptive` :
- The GSL routine `gsl_integration_qags` is used for `type` = `Type:AdaptiveSingular` :

Parameters

  function | funtion to be integrated
  index | variable index
  a | lower intgeration limit
  b | high integration limit
  type | integration type
  rule | integration rule (for adaptive integration)
  epsabs | required absolute precision
  epsrel | required relative precision
  size | maximal number of bisections for adaptive integration

Definition at line 102 of file NumericalDefiniteIntegral.cpp.

107 : m_function( function.clone() )
108 , m_index( index )
109 , m_a( a )
110 , m_b( b )
111 , m_type( type )
112 , m_category( GaudiMath::Integration::Finite )
113 , m_rule( rule )
114 , m_epsabs( epsabs )
115 , m_epsrel( epsrel )
116 , m_size( size )
117 {
118 if ( GaudiMath::Integration::Fixed == m_rule ) {
119 m_rule = GaudiMath::Integration::Default;
120 }
121 if ( function.dimensionality() < 2 ) {
122 Exception( "::constructor: invalid dimensionality " );
123 }
124 if ( m_index >= function.dimensionality() ) {
125 Exception( "::constructor: invalid variable index" );
126 }
127
128 m_DIM = function.dimensionality() - 1;
129 m_argument = Argument( m_DIM );
130 m_argF = Argument( m_DIM + 1 );
131 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalDefiniteIntegral.h:369
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::size
size_t size() const
Definition: NumericalDefiniteIntegral.h:311
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalDefiniteIntegral.cpp:351
GaudiMath::Integration::Finite
Definition: Integration.h:26
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalDefiniteIntegral.h:364
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalDefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_size
size_t m_size
Definition: NumericalDefiniteIntegral.h:375
GaudiMath::Integration::Fixed
Definition: Integration.h:29
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_b
double m_b
Definition: NumericalDefiniteIntegral.h:361
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalDefiniteIntegral.h:357
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::dimensionality
unsigned int dimensionality() const override
dimensionality of the problem
Definition: NumericalDefiniteIntegral.h:279
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_index
size_t m_index
Definition: NumericalDefiniteIntegral.h:358
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::epsabs
double epsabs() const
absolute precision
Definition: NumericalDefiniteIntegral.h:301
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalDefiniteIntegral.h:365
GaudiMath::Integration::Default
Definition: Integration.h:36
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::epsrel
double epsrel() const
relatiove precision
Definition: NumericalDefiniteIntegral.h:303
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_a
double m_a
Definition: NumericalDefiniteIntegral.h:360
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalDefiniteIntegral.h:363
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::type
GaudiMath::Integration::Type type() const
integration type
Definition: NumericalDefiniteIntegral.h:314
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalDefiniteIntegral.h:356
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argF
Argument m_argF
Definition: NumericalDefiniteIntegral.h:379
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::b
double b() const
Definition: NumericalDefiniteIntegral.h:297
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalDefiniteIntegral.h:378
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::rule
GaudiMath::Integration::KronrodRule rule() const
integration rule
Definition: NumericalDefiniteIntegral.h:318
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::a
double a() const
integration limit
Definition: NumericalDefiniteIntegral.h:296

Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::NumericalDefiniteIntegral | ( | const AbsFunction & | function,
|  | const size_t | index,
|  | const double | a,
|  | const double | b,
|  | const Points & | points,
|  | const double | epsabs = `1e-9`,
|  | const double | epsrel = `1.e-6`,
|  | const size_t | size = `1000`
| ) |  |

Standard constructor The function created with this constructor compute the following integral:

standard constructor

\[ {\mathcal{F}}_i \left(x_1, \dots , x_{i-1}, x_{i+1}, \dots , x_n \right) = \int\limits_{a}^{b} f \left(x_1, \dots , x_{i-1}, \hat{x}_i , x_{i+1}, \dots , x_n \right) \, {\mathrm{d}} \hat{x}_i \]

where function have known singulatities

- The GSL routine `gsl_integration_qagp` is used for integration

Parameters

  function | funtion to be integrated
  index | variable index
  a | lower intgeration limit
  b | high integration limit
  pointns | vector of know singular points
  epsabs | required absolute precision
  epsrel | required relative precision
  size | maximal number of bisections for adaptive integration
  function | the base function
  index | the variable index
  a | integration limit
  b | integration limit
  points | list of known function singularities
  epsabs | absolute precision for integration
  epsrel | relative precision for integration

Definition at line 142 of file NumericalDefiniteIntegral.cpp.

146 : m_function( function.clone() )
147 , m_index( index )
148 , m_a( a )
149 , m_b( b )
150 , m_type( GaudiMath::Integration::Other )
151 , m_category( GaudiMath::Integration::Singular )
152 , m_rule( GaudiMath::Integration::Fixed )
153 , m_points( points )
154 , m_epsabs( epsabs )
155 , m_epsrel( epsrel )
156 , m_size( size )
157 {
158 if ( function.dimensionality() < 2 ) {
159 Exception( "::constructor: invalid dimensionality " );
160 }
161 if ( m_index >= function.dimensionality() ) {
162 Exception( "::constructor: invalid variable index" );
163 }
164
165 m_DIM = function.dimensionality() - 1;
166 m_argument = Argument( m_DIM );
167 m_argF = Argument( m_DIM + 1 );
168
169 const auto lim = std::minmax( a, b );
170 m_points.push_back( lim.first );
171 m_points.push_back( lim.second );
172 auto end = std::remove_if( m_points.begin(), m_points.end(),
173 [&]( double x ) { return x < lim.first || lim.second < x; } );
174 std::sort( m_points.begin(), end );
175 m_points.erase( std::unique( m_points.begin(), end ), m_points.end() );
176 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalDefiniteIntegral.h:369
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::size
size_t size() const
Definition: NumericalDefiniteIntegral.h:311
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalDefiniteIntegral.cpp:351
std::minmax
T minmax(T...args)
GaudiMath::Integration::Other
Definition: Integration.h:24
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalDefiniteIntegral.h:364
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalDefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_size
size_t m_size
Definition: NumericalDefiniteIntegral.h:375
GaudiMath::Integration::Fixed
Definition: Integration.h:29
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_b
double m_b
Definition: NumericalDefiniteIntegral.h:361
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalDefiniteIntegral.h:357
std::vector::end
T end(T...args)
std::remove_if
T remove_if(T...args)
GaudiMath::Integration::Singular
Definition: Integration.h:26
std::unique
T unique(T...args)
std::vector::push_back
T push_back(T...args)
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::dimensionality
unsigned int dimensionality() const override
dimensionality of the problem
Definition: NumericalDefiniteIntegral.h:279
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_index
size_t m_index
Definition: NumericalDefiniteIntegral.h:358
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::epsabs
double epsabs() const
absolute precision
Definition: NumericalDefiniteIntegral.h:301
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_points
Points m_points
Definition: NumericalDefiniteIntegral.h:367
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalDefiniteIntegral.h:365
std::vector::erase
T erase(T...args)
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:64
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::epsrel
double epsrel() const
relatiove precision
Definition: NumericalDefiniteIntegral.h:303
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_a
double m_a
Definition: NumericalDefiniteIntegral.h:360
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalDefiniteIntegral.h:363
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalDefiniteIntegral.h:356
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::points
const Points & points() const
known singularities
Definition: NumericalDefiniteIntegral.h:299
std::vector::begin
T begin(T...args)
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argF
Argument m_argF
Definition: NumericalDefiniteIntegral.h:379
std::sort
T sort(T...args)
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::b
double b() const
Definition: NumericalDefiniteIntegral.h:297
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalDefiniteIntegral.h:378
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::a
double a() const
integration limit
Definition: NumericalDefiniteIntegral.h:296

Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::NumericalDefiniteIntegral | ( | const AbsFunction & | function,
|  | const size_t | index,
|  | const double | a,
|  | const GaudiMath::Integration::Inf | b = `GaudiMath::Integration::Infinity`,
|  | const double | epsabs = `1e-9`,
|  | const double | epsrel = `1.e-6`,
|  | const size_t | size = `1000`
| ) |  |

Standard constructor The function created with this constructor compute the following integral:

\[ {\mathcal{F}}_i \left(x_1, \dots , x_{i-1}, x_{i+1}, \dots , x_n \right) = \int\limits_{a}^{+\infty} f \left(x_1, \dots , x_{i-1}, \hat{x}_i , x_{i+1}, \dots , x_n \right) \, {\mathrm{d}} \hat{x}_i \]

- The GSL routine `gsl_integration_qagiu` is used for integration

Parameters

  function | funtion to be integrated
  index | variable index
  a | lower intgeration limit
  b | indication for infinity
  epsabs | required absolute precision
  epsrel | required relative precision
  size | maximal number of bisections for adaptive integration

Definition at line 203 of file NumericalDefiniteIntegral.cpp.

206 : m_function( function.clone() )
207 , m_DIM( 0 )
208 , m_index( index )
209 , m_a( a )
210 , m_type( GaudiMath::Integration::Other )
211 , m_category( GaudiMath::Integration::Infinite )
212 , m_rule( GaudiMath::Integration::Fixed )
213 , m_epsabs( epsabs )
214 , m_epsrel( epsrel )
215 , m_size( size )
216 {
217 if ( function.dimensionality() < 2 ) {
218 Exception( "::constructor: invalid dimensionality " );
219 }
220 if ( m_index >= function.dimensionality() ) {
221 Exception( "::constructor: invalid variable index" );
222 }
223
224 m_DIM = function.dimensionality() - 1;
225 m_argument = Argument( m_DIM );
226 m_argF = Argument( m_DIM + 1 );
227 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalDefiniteIntegral.h:369
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::size
size_t size() const
Definition: NumericalDefiniteIntegral.h:311
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalDefiniteIntegral.cpp:351
GaudiMath::Integration::Other
Definition: Integration.h:24
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalDefiniteIntegral.h:364
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalDefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_size
size_t m_size
Definition: NumericalDefiniteIntegral.h:375
GaudiMath::Integration::Fixed
Definition: Integration.h:29
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalDefiniteIntegral.h:357
GaudiMath::Integration::Infinite
Definition: Integration.h:26
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::dimensionality
unsigned int dimensionality() const override
dimensionality of the problem
Definition: NumericalDefiniteIntegral.h:279
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_index
size_t m_index
Definition: NumericalDefiniteIntegral.h:358
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::epsabs
double epsabs() const
absolute precision
Definition: NumericalDefiniteIntegral.h:301
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalDefiniteIntegral.h:365
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::epsrel
double epsrel() const
relatiove precision
Definition: NumericalDefiniteIntegral.h:303
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_a
double m_a
Definition: NumericalDefiniteIntegral.h:360
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalDefiniteIntegral.h:363
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalDefiniteIntegral.h:356
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argF
Argument m_argF
Definition: NumericalDefiniteIntegral.h:379
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalDefiniteIntegral.h:378
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::a
double a() const
integration limit
Definition: NumericalDefiniteIntegral.h:296

Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::NumericalDefiniteIntegral | ( | const AbsFunction & | function,
|  | const size_t | index,
|  | const GaudiMath::Integration::Inf | a,
|  | const double | b,
|  | const double | epsabs = `1e-9`,
|  | const double | epsrel = `1.e-6`,
|  | const size_t | size = `1000`
| ) |  |

Standard constructor The function created with this constructor compute the following integral:

\[ {\mathcal{F}}_i \left(x_1, \dots , x_{i-1}, x_{i+1}, \dots , x_n \right) = \int\limits_{-\infty}^{b} f \left(x_1, \dots , x_{i-1}, \hat{x}_i , x_{i+1}, \dots , x_n \right) \, {\mathrm{d}} \hat{x}_i \]

- The GSL routine `gsl_integration_qagiu` is used for integration

Parameters

  function | funtion to be integrated
  index | variable index
  a | lower intgeration limit
  b | indication for infinity
  epsabs | required absolute precision
  epsrel | required relative precision
  size | maximal number of bisections for adaptive integration

Definition at line 254 of file NumericalDefiniteIntegral.cpp.

257 : m_function( function.clone() )
258 , m_DIM( 0 )
259 , m_index( index )
260 , m_b( b )
261 , m_type( GaudiMath::Integration::Other )
262 , m_category( GaudiMath::Integration::Infinite )
263 , m_rule( GaudiMath::Integration::Fixed )
264 , m_epsabs( epsabs )
265 , m_epsrel( epsrel )
266 //
267 , m_size( size )
268 {
269 if ( function.dimensionality() < 2 ) {
270 Exception( "::constructor: invalid dimensionality " );
271 }
272 if ( m_index >= function.dimensionality() ) {
273 Exception( "::constructor: invalid variable index" );
274 }
275
276 m_DIM = function.dimensionality() - 1;
277 m_argument = Argument( m_DIM );
278 m_argF = Argument( m_DIM + 1 );
279 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalDefiniteIntegral.h:369
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::size
size_t size() const
Definition: NumericalDefiniteIntegral.h:311
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalDefiniteIntegral.cpp:351
GaudiMath::Integration::Other
Definition: Integration.h:24
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalDefiniteIntegral.h:364
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalDefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_size
size_t m_size
Definition: NumericalDefiniteIntegral.h:375
GaudiMath::Integration::Fixed
Definition: Integration.h:29
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_b
double m_b
Definition: NumericalDefiniteIntegral.h:361
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalDefiniteIntegral.h:357
GaudiMath::Integration::Infinite
Definition: Integration.h:26
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::dimensionality
unsigned int dimensionality() const override
dimensionality of the problem
Definition: NumericalDefiniteIntegral.h:279
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_index
size_t m_index
Definition: NumericalDefiniteIntegral.h:358
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::epsabs
double epsabs() const
absolute precision
Definition: NumericalDefiniteIntegral.h:301
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalDefiniteIntegral.h:365
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::epsrel
double epsrel() const
relatiove precision
Definition: NumericalDefiniteIntegral.h:303
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalDefiniteIntegral.h:363
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalDefiniteIntegral.h:356
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argF
Argument m_argF
Definition: NumericalDefiniteIntegral.h:379
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::b
double b() const
Definition: NumericalDefiniteIntegral.h:297
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalDefiniteIntegral.h:378

Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::NumericalDefiniteIntegral | ( | const AbsFunction & | function,
|  | const size_t | index,
|  | const float | epsabs = `1e-9`,
|  | const float | epsrel = `1.e-6`,
|  | const size_t | size = `1000`
| ) |  |

Standard constructor The function created with this constructor compute the following integral:

\[ {\mathcal{F}}_i \left(x_1, \dots , x_{i-1}, x_{i+1}, \dots , x_n \right) = \int\limits_{-\infty}^{+\infty} f \left(x_1, \dots , x_{i-1}, \hat{x}_i , x_{i+1}, \dots , x_n \right) \, {\mathrm{d}} \hat{x}_i \]

- The GSL routine `gsl_integration_qagi` is used for integration

Parameters

  function | funtion to be integrated
  index | variable index
  epsabs | required absolute precision
  epsrel | required relative precision
  size | maximal number of bisections for adaptive integration

Definition at line 304 of file NumericalDefiniteIntegral.cpp.

306 : m_function( function.clone() )
307 , m_DIM( 0 )
308 , m_index( index )
309 , m_type( GaudiMath::Integration::Other )
310 , m_category( GaudiMath::Integration::Infinite )
311 , m_rule( GaudiMath::Integration::Fixed )
312 , m_epsabs( epsabs )
313 , m_epsrel( epsrel )
314 , m_size( size )
315 {
316 if ( function.dimensionality() < 2 ) {
317 Exception( "::constructor: invalid dimensionality " );
318 }
319 if ( m_index >= function.dimensionality() ) {
320 Exception( "::constructor: invalid variable index" );
321 }
322
323 m_DIM = function.dimensionality() - 1;
324 m_argument = Argument( m_DIM );
325 m_argF = Argument( m_DIM + 1 );
326 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalDefiniteIntegral.h:369
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::size
size_t size() const
Definition: NumericalDefiniteIntegral.h:311
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalDefiniteIntegral.cpp:351
GaudiMath::Integration::Other
Definition: Integration.h:24
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalDefiniteIntegral.h:364
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalDefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_size
size_t m_size
Definition: NumericalDefiniteIntegral.h:375
GaudiMath::Integration::Fixed
Definition: Integration.h:29
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalDefiniteIntegral.h:357
GaudiMath::Integration::Infinite
Definition: Integration.h:26
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::dimensionality
unsigned int dimensionality() const override
dimensionality of the problem
Definition: NumericalDefiniteIntegral.h:279
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_index
size_t m_index
Definition: NumericalDefiniteIntegral.h:358
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::epsabs
double epsabs() const
absolute precision
Definition: NumericalDefiniteIntegral.h:301
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalDefiniteIntegral.h:365
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::epsrel
double epsrel() const
relatiove precision
Definition: NumericalDefiniteIntegral.h:303
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalDefiniteIntegral.h:363
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalDefiniteIntegral.h:356
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argF
Argument m_argF
Definition: NumericalDefiniteIntegral.h:379
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalDefiniteIntegral.h:378

Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::NumericalDefiniteIntegral | ( | const NumericalDefiniteIntegral & | right | ) |

copy constructor

Definition at line 329 of file NumericalDefiniteIntegral.cpp.

330 : AbsFunction()
331 , m_function( right.m_function->clone() )
332 , m_DIM( right.m_DIM )
333 , m_index( right.m_index )
334 , m_a( right.m_a )
335 , m_b( right.m_b )
336 , m_type( right.m_type )
337 , m_category( right.m_category )
338 , m_rule( right.m_rule )
339 , m_points( right.m_points )
340 , m_epsabs( right.m_epsabs )
341 , m_epsrel( right.m_epsrel )
342 , m_size( right.m_size )
343 , m_argument( right.m_argument )
344 , m_argF( right.m_argF )
345 {
346 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalDefiniteIntegral.h:369
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalDefiniteIntegral.h:364
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalDefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_size
size_t m_size
Definition: NumericalDefiniteIntegral.h:375
std::right
T right(T...args)
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_b
double m_b
Definition: NumericalDefiniteIntegral.h:361
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalDefiniteIntegral.h:357
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_index
size_t m_index
Definition: NumericalDefiniteIntegral.h:358
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_points
Points m_points
Definition: NumericalDefiniteIntegral.h:367
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalDefiniteIntegral.h:365
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_a
double m_a
Definition: NumericalDefiniteIntegral.h:360
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalDefiniteIntegral.h:363
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalDefiniteIntegral.h:356
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argF
Argument m_argF
Definition: NumericalDefiniteIntegral.h:379
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalDefiniteIntegral.h:378

Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::~NumericalDefiniteIntegral | ( |  | ) |
| override default

destructor

Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::NumericalDefiniteIntegral | ( |  | ) |
| private

## Member Function Documentation

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::a | ( |  | ) | const
| inline

integration limit

Definition at line 296 of file NumericalDefiniteIntegral.h.

296 { return m_a; }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_a
double m_a
Definition: NumericalDefiniteIntegral.h:360

NumericalDefiniteIntegral::_Workspace * Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::allocate | ( |  | ) | const
| protected

allocate the integration workspace

Definition at line 459 of file NumericalDefiniteIntegral.cpp.

460 {
461 if ( !m_ws ) {
462 m_ws.reset( new _Workspace() );
463 m_ws->ws = gsl_integration_workspace_alloc( size() );
464 if ( !m_ws->ws ) {
465 Exception( "allocate()::invalid workspace" );
466 };
467 }
468 return m_ws.get();
469 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::size
size_t size() const
Definition: NumericalDefiniteIntegral.h:311
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalDefiniteIntegral.cpp:351
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_ws
std::unique_ptr< _Workspace, gsl_ws_deleter > m_ws
Definition: NumericalDefiniteIntegral.h:376

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::b | ( |  | ) | const
| inline

Definition at line 297 of file NumericalDefiniteIntegral.h.

297 { return m_b; }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_b
double m_b
Definition: NumericalDefiniteIntegral.h:361

GaudiMath::Integration::Category Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::category | ( |  | ) | const
| inline

integration category

Definition at line 316 of file NumericalDefiniteIntegral.h.

316 { return m_category; }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalDefiniteIntegral.h:364

unsigned int Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::dimensionality | ( |  | ) | const
| inline override

dimensionality of the problem

Definition at line 279 of file NumericalDefiniteIntegral.h.

279 { return m_DIM; }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalDefiniteIntegral.h:357

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::epsabs | ( |  | ) | const
| inline

absolute precision

Definition at line 301 of file NumericalDefiniteIntegral.h.

301 { return m_epsabs; }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalDefiniteIntegral.h:369

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::epsrel | ( |  | ) | const
| inline

relatiove precision

Definition at line 303 of file NumericalDefiniteIntegral.h.

303 { return m_epsrel; }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalDefiniteIntegral.h:370

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::error | ( |  | ) | const
| inline

evaluate of previous error

Definition at line 308 of file NumericalDefiniteIntegral.h.

308 { return m_error; }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_error
double m_error
Definition: NumericalDefiniteIntegral.h:373

StatusCode Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception | ( | const std::string & | message,
|  | const StatusCode & | sc = `StatusCode::FAILURE`
| ) |  | const
| protected

Definition at line 351 of file NumericalDefiniteIntegral.cpp.

352 {
353 throw GaudiException( "NumericalDefiniteIntegral::" + message, "*GaudiMath*", sc );
354 return sc;
355 }
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:22

const AbsFunction& Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::function | ( |  | ) | const
| inline

accessor to the function itself

Definition at line 294 of file NumericalDefiniteIntegral.h.

294 { return *m_function; }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalDefiniteIntegral.h:356

bool Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::hasAnalyticDerivative | ( |  | ) | const
| inline override

Does this function have an analytic derivative?

Definition at line 287 of file NumericalDefiniteIntegral.h.

287 { return true; }

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::operator() | ( | double | argument | ) | const
| override

Function value.

evaluate the function

Definition at line 361 of file NumericalDefiniteIntegral.cpp.

362 {
363 // reset the result and the error
364 m_result = -std::numeric_limits<double>::infinity();
365 m_error = std::numeric_limits<double>::infinity();
366
367 // check the argument
368 if ( 1 != m_DIM ) {
369 Exception( "operator(): invalid argument size " );
370 };
371
372 m_argument[0] = argument;
373 return ( *this )( m_argument );
374 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_error
double m_error
Definition: NumericalDefiniteIntegral.h:373
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalDefiniteIntegral.cpp:351
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalDefiniteIntegral.h:357
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_result
double m_result
Definition: NumericalDefiniteIntegral.h:372
std::numeric_limits::infinity
T infinity(T...args)
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalDefiniteIntegral.h:378

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::operator() | ( | const Argument & | argument | ) | const
| override

Function value.

evaluate the function

Definition at line 394 of file NumericalDefiniteIntegral.cpp.

395 {
396 // reset the result and the error
397 m_result = -std::numeric_limits<double>::infinity();
398 m_error = std::numeric_limits<double>::infinity();
399
400 // check the argument
401 if ( argument.dimension() != m_DIM ) {
402 Exception( "operator(): invalid argument size " );
403 };
404
405 // copy the argument
406
407 for ( size_t i = 0; i < m_DIM; ++i ) {
408 m_argument[i] = argument[i];
409 const size_t j = i < m_index ? i : i + 1;
410 m_argF[j] = argument[i];
411 };
412
413 // create the helper object
414 GSL_Helper helper( *m_function, m_argF, m_index );
415
416 // use GSL to evaluate the numerical derivative
417 gsl_function F;
418 F.function = &GSL_Adaptor;
419 F.params = &helper;
420 _Function F1;
421 F1.fn = &F;
422
423 if ( GaudiMath::Integration::Infinite == category() ) {
424 return QAGI( &F1 );
425 } // RETURN
426
427 if ( m_a == m_b ) {
428 m_result = 0;
429 m_error = 0; // EXACT
430 return m_result; // RETURN
431 }
432
433 switch ( category() ) {
434 case GaudiMath::Integration::Singular:
435 return QAGP( &F1 );
436 case GaudiMath::Integration::Finite:
437 switch ( type() ) {
438 case GaudiMath::Integration::NonAdaptive:
439 return QNG( &F1 );
440 case GaudiMath::Integration::Adaptive:
441 return QAG( &F1 );
442 case GaudiMath::Integration::AdaptiveSingular:
443 return QAGS( &F1 );
444 default:
445 Exception( "::operator(): invalid type " );
446 }
447 break;
448 default:
449 Exception( "::operator(): invalid category " );
450 }
451
452 return 0;
453 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::category
GaudiMath::Integration::Category category() const
integration category
Definition: NumericalDefiniteIntegral.h:316
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_error
double m_error
Definition: NumericalDefiniteIntegral.h:373
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalDefiniteIntegral.cpp:351
GaudiMath::Integration::Finite
Definition: Integration.h:26
GaudiMath::Integration::NonAdaptive
Definition: Integration.h:24
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_b
double m_b
Definition: NumericalDefiniteIntegral.h:361
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalDefiniteIntegral.h:357
GaudiMath::Integration::Adaptive
Definition: Integration.h:24
GaudiMath::Integration::Singular
Definition: Integration.h:26
GaudiMath::Integration::Infinite
Definition: Integration.h:26
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_index
size_t m_index
Definition: NumericalDefiniteIntegral.h:358
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_result
double m_result
Definition: NumericalDefiniteIntegral.h:372
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::QAG
double QAG(_Function *fun) const
Definition: NumericalDefiniteIntegral.cpp:562
Genfun::GaudiMathImplementation::GSL_Adaptor
double GSL_Adaptor(double x, void *params)
Definition: Helpers.cpp:31
std::numeric_limits::infinity
T infinity(T...args)
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_a
double m_a
Definition: NumericalDefiniteIntegral.h:360
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::type
GaudiMath::Integration::Type type() const
integration type
Definition: NumericalDefiniteIntegral.h:314
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalDefiniteIntegral.h:356
GaudiMath::Integration::AdaptiveSingular
Definition: Integration.h:24
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::QAGP
double QAGP(_Function *fun) const
Definition: NumericalDefiniteIntegral.cpp:508
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argF
Argument m_argF
Definition: NumericalDefiniteIntegral.h:379
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::QNG
double QNG(_Function *fun) const
Definition: NumericalDefiniteIntegral.cpp:537
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::QAGI
double QAGI(_Function *fun) const
Definition: NumericalDefiniteIntegral.cpp:475
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalDefiniteIntegral.h:378
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::QAGS
double QAGS(_Function *fun) const
Definition: NumericalDefiniteIntegral.cpp:590

NumericalDefiniteIntegral& Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::operator= | ( | const NumericalDefiniteIntegral & |  | ) |
| private

Genfun::Derivative Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::partial | ( | unsigned int | index | ) | const
| override

Derivatives.

Definition at line 380 of file NumericalDefiniteIntegral.cpp.

381 {
382 if ( idx >= m_DIM ) {
383 Exception( "::partial(i): invalid variable index " );
384 };
385 //
386 const AbsFunction& aux = NumericalDerivative( *this, idx );
387 return Genfun::FunctionNoop( &aux );
388 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalDefiniteIntegral.cpp:351
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalDefiniteIntegral.h:357

const Points& Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::points | ( |  | ) | const
| inline

known singularities

Definition at line 299 of file NumericalDefiniteIntegral.h.

299 { return m_points; }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_points
Points m_points
Definition: NumericalDefiniteIntegral.h:367

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::QAG | ( | _Function * | fun | ) | const
| protected

Definition at line 562 of file NumericalDefiniteIntegral.cpp.

563 {
564 if ( !F ) {
565 Exception( "QAG::invalid function" );
566 }
567
568 // allocate workspace
569 allocate();
570
571 // integration limits
572 const auto lim = std::minmax( m_a, m_b );
573
574 int ierror = gsl_integration_qag( F->fn, lim.first, lim.second, m_epsabs, m_epsrel, size(), (int)rule(), ws()->ws,
575 &m_result, &m_error );
576
577 if ( ierror ) {
578 gsl_error( "NumericalDefiniteIntegral::QAG ", __FILE__, __LINE__, ierror );
579 }
580 // sign
581 if ( m_b < m_a ) m_result = -m_result;
582
583 return m_result;
584 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalDefiniteIntegral.h:369
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::size
size_t size() const
Definition: NumericalDefiniteIntegral.h:311
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_error
double m_error
Definition: NumericalDefiniteIntegral.h:373
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalDefiniteIntegral.cpp:351
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::ws
_Workspace * ws() const
Definition: NumericalDefiniteIntegral.h:335
std::minmax
T minmax(T...args)
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalDefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_b
double m_b
Definition: NumericalDefiniteIntegral.h:361
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_result
double m_result
Definition: NumericalDefiniteIntegral.h:372
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_a
double m_a
Definition: NumericalDefiniteIntegral.h:360
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::allocate
_Workspace * allocate() const
allocate the integration workspace
Definition: NumericalDefiniteIntegral.cpp:459
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::rule
GaudiMath::Integration::KronrodRule rule() const
integration rule
Definition: NumericalDefiniteIntegral.h:318

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::QAGI | ( | _Function * | fun | ) | const
| protected

Definition at line 475 of file NumericalDefiniteIntegral.cpp.

476 {
477 // check the argument
478 if ( !F ) {
479 Exception( "::QAGI: invalid function" );
480 }
481
482 // allocate workspace
483 allocate();
484
485 int ierror = 0;
486
487 if ( m_a == -std::numeric_limits<double>::infinity() && m_b == std::numeric_limits<double>::infinity() ) {
488 ierror = gsl_integration_qagi( F->fn, m_epsabs, m_epsrel, size(), ws()->ws, &m_result, &m_error );
489 } else if ( m_a == -std::numeric_limits<double>::infinity() ) {
490 ierror = gsl_integration_qagil( F->fn, m_b, m_epsabs, m_epsrel, size(), ws()->ws, &m_result, &m_error );
491 } else if ( m_b == std::numeric_limits<double>::infinity() ) {
492 ierror = gsl_integration_qagiu( F->fn, m_a, m_epsabs, m_epsrel, size(), ws()->ws, &m_result, &m_error );
493 } else {
494 Exception( "::QAGI: invalid mode" );
495 };
496
497 if ( ierror ) {
498 gsl_error( "NumericalDefiniteIntegral::QAGI", __FILE__, __LINE__, ierror );
499 }
500
501 return m_result;
502 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalDefiniteIntegral.h:369
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::size
size_t size() const
Definition: NumericalDefiniteIntegral.h:311
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_error
double m_error
Definition: NumericalDefiniteIntegral.h:373
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalDefiniteIntegral.cpp:351
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::ws
_Workspace * ws() const
Definition: NumericalDefiniteIntegral.h:335
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalDefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_b
double m_b
Definition: NumericalDefiniteIntegral.h:361
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_result
double m_result
Definition: NumericalDefiniteIntegral.h:372
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_a
double m_a
Definition: NumericalDefiniteIntegral.h:360
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::allocate
_Workspace * allocate() const
allocate the integration workspace
Definition: NumericalDefiniteIntegral.cpp:459
std::numeric_limits

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::QAGP | ( | _Function * | fun | ) | const
| protected

Definition at line 508 of file NumericalDefiniteIntegral.cpp.

509 {
510 if ( !F ) {
511 Exception( "QAGP::invalid function" );
512 }
513
514 // no known singular points ?
515 if ( points().empty() ) {
516 return QAGS( F );
517 }
518
519 // use GSL
520 int ierror = gsl_integration_qagp( F->fn, const_cast<double*>( points().data() ), points().size(), m_epsabs,
521 m_epsrel, size(), ws()->ws, &m_result, &m_error );
522
523 if ( ierror ) {
524 gsl_error( "NumericalDefiniteIntegral::QAGI ", __FILE__, __LINE__, ierror );
525 }
526
527 // the sign
528 if ( m_b < m_a ) m_result = -m_result;
529
530 return m_result;
531 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalDefiniteIntegral.h:369
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::size
size_t size() const
Definition: NumericalDefiniteIntegral.h:311
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_error
double m_error
Definition: NumericalDefiniteIntegral.h:373
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalDefiniteIntegral.cpp:351
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::ws
_Workspace * ws() const
Definition: NumericalDefiniteIntegral.h:335
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalDefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_b
double m_b
Definition: NumericalDefiniteIntegral.h:361
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_result
double m_result
Definition: NumericalDefiniteIntegral.h:372
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_a
double m_a
Definition: NumericalDefiniteIntegral.h:360
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::points
const Points & points() const
known singularities
Definition: NumericalDefiniteIntegral.h:299
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::QAGS
double QAGS(_Function *fun) const
Definition: NumericalDefiniteIntegral.cpp:590

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::QAGS | ( | _Function * | fun | ) | const
| protected

Definition at line 590 of file NumericalDefiniteIntegral.cpp.

591 {
592 if ( !F ) {
593 Exception( "QAG::invalid function" );
594 }
595
596 if ( m_a == m_b ) {
597 m_result = 0;
598 m_error = 0; // EXACT !
599 return m_result;
600 }
601
602 // allocate workspace
603 allocate();
604
605 // integration limits
606 const auto lim = std::minmax( m_a, m_b );
607
608 int ierror = gsl_integration_qags( F->fn, lim.first, lim.second, m_epsabs, m_epsrel, size(), ws()->ws, &m_result,
609 &m_error );
610
611 if ( ierror ) {
612 gsl_error( "NumericalDefiniteIntegral::QAGS ", __FILE__, __LINE__, ierror );
613 }
614
615 // sign
616 if ( m_b < m_a ) m_result = -m_result;
617
618 return m_result;
619 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalDefiniteIntegral.h:369
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::size
size_t size() const
Definition: NumericalDefiniteIntegral.h:311
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_error
double m_error
Definition: NumericalDefiniteIntegral.h:373
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalDefiniteIntegral.cpp:351
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::ws
_Workspace * ws() const
Definition: NumericalDefiniteIntegral.h:335
std::minmax
T minmax(T...args)
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalDefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_b
double m_b
Definition: NumericalDefiniteIntegral.h:361
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_result
double m_result
Definition: NumericalDefiniteIntegral.h:372
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_a
double m_a
Definition: NumericalDefiniteIntegral.h:360
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::allocate
_Workspace * allocate() const
allocate the integration workspace
Definition: NumericalDefiniteIntegral.cpp:459

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::QNG | ( | _Function * | fun | ) | const
| protected

Definition at line 537 of file NumericalDefiniteIntegral.cpp.

538 {
539 if ( !F ) {
540 Exception( "QNG::invalid function" );
541 }
542
543 // integration limits
544 const auto lim = std::minmax( m_a, m_b );
545
546 size_t neval = 0;
547 int ierror = gsl_integration_qng( F->fn, lim.first, lim.second, m_epsabs, m_epsrel, &m_result, &m_error, &neval );
548
549 if ( ierror ) {
550 gsl_error( "NumericalIndefiniteIntegral::QNG ", __FILE__, __LINE__, ierror );
551 }
552 // sign
553 if ( m_b < m_a ) m_result = -m_result;
554
555 return m_result;
556 }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalDefiniteIntegral.h:369
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_error
double m_error
Definition: NumericalDefiniteIntegral.h:373
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalDefiniteIntegral.cpp:351
std::minmax
T minmax(T...args)
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalDefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_b
double m_b
Definition: NumericalDefiniteIntegral.h:361
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_result
double m_result
Definition: NumericalDefiniteIntegral.h:372
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_a
double m_a
Definition: NumericalDefiniteIntegral.h:360

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::result | ( |  | ) | const
| inline

previous result

Definition at line 306 of file NumericalDefiniteIntegral.h.

306 { return m_result; }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_result
double m_result
Definition: NumericalDefiniteIntegral.h:372

GaudiMath::Integration::KronrodRule Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::rule | ( |  | ) | const
| inline

integration rule

Definition at line 318 of file NumericalDefiniteIntegral.h.

318 { return m_rule; }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalDefiniteIntegral.h:365

size_t Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::size | ( |  | ) | const
| inline

Definition at line 311 of file NumericalDefiniteIntegral.h.

311 { return m_size; }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_size
size_t m_size
Definition: NumericalDefiniteIntegral.h:375

GaudiMath::Integration::Type Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::type | ( |  | ) | const
| inline

integration type

Definition at line 314 of file NumericalDefiniteIntegral.h.

314 { return m_type; }
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalDefiniteIntegral.h:363

_Workspace* Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::ws | ( |  | ) | const
| inline protected

Definition at line 335 of file NumericalDefiniteIntegral.h.

335 { return m_ws.get(); };
Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_ws
std::unique_ptr< _Workspace, gsl_ws_deleter > m_ws
Definition: NumericalDefiniteIntegral.h:376

## Member Data Documentation

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_a = -std::numeric_limits<double>::infinity()
| private

Definition at line 360 of file NumericalDefiniteIntegral.h.

Argument Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argF
| mutable private

Definition at line 379 of file NumericalDefiniteIntegral.h.

Argument Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_argument
| mutable private

Definition at line 378 of file NumericalDefiniteIntegral.h.

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_b = std::numeric_limits<double>::infinity()
| private

Definition at line 361 of file NumericalDefiniteIntegral.h.

GaudiMath::Integration::Category Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_category
| private

Definition at line 364 of file NumericalDefiniteIntegral.h.

size_t Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_DIM = 0
| private

Definition at line 357 of file NumericalDefiniteIntegral.h.

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsabs
| private

Definition at line 369 of file NumericalDefiniteIntegral.h.

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_epsrel
| private

Definition at line 370 of file NumericalDefiniteIntegral.h.

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_error = std::numeric_limits<double>::infinity()
| mutable private

Definition at line 373 of file NumericalDefiniteIntegral.h.

std::unique_ptr<const AbsFunction> Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_function
| private

Definition at line 356 of file NumericalDefiniteIntegral.h.

size_t Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_index
| private

Definition at line 358 of file NumericalDefiniteIntegral.h.

Points Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_points
| private

Definition at line 367 of file NumericalDefiniteIntegral.h.

double Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_result = -std::numeric_limits<double>::infinity()
| mutable private

Definition at line 372 of file NumericalDefiniteIntegral.h.

GaudiMath::Integration::KronrodRule Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_rule
| private

Definition at line 365 of file NumericalDefiniteIntegral.h.

size_t Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_size
| private

Definition at line 375 of file NumericalDefiniteIntegral.h.

GaudiMath::Integration::Type Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_type
| private

Definition at line 363 of file NumericalDefiniteIntegral.h.

std::unique_ptr<_Workspace, gsl_ws_deleter> Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::m_ws
| mutable private

Definition at line 376 of file NumericalDefiniteIntegral.h.

The documentation for this class was generated from the following files:

- GaudiGSL/GaudiMath/NumericalDefiniteIntegral.h
- GaudiGSL/src/Lib/NumericalDefiniteIntegral.cpp