| The Gaudi Framework v28r2p1 (f1a77ff4)

- 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::NumericalIndefiniteIntegral Class Reference

The simple class for numerical integrations. More...

`#include <GaudiMath/NumericalIndefiniteIntegral.h>`

Inheritance diagram for Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral:
[legend]
Collaboration diagram for Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral:
[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
| NumericalIndefiniteIntegral (const AbsFunction &function, const size_t index, const double a, const GaudiMath::Integration::Limit limit=GaudiMath::Integration::VariableHighLimit, const GaudiMath::Integration::Type type=GaudiMath::Integration::Adaptive, const GaudiMath::Integration::KronrodRule rule=GaudiMath::Integration::Default, const double epsabs=1e-10, const double epsrel=1.e-7, const size_t size=1000)
| From CLHEP/GenericFunctions. More...
| NumericalIndefiniteIntegral (const AbsFunction &function, const size_t index, const double a, const Points &points, const GaudiMath::Integration::Limit limit=GaudiMath::Integration::VariableHighLimit, const double epsabs=1e-9, const double epsrel=1.e-6, const size_t size=1000)
| standard constructor More...
| NumericalIndefiniteIntegral (const AbsFunction &function, const size_t index, const GaudiMath::Integration::Limit limit=GaudiMath::Integration::VariableHighLimit, const double epsabs=1e-9, const double epsrel=1.e-6, const size_t size=1000)
| standard constructor The function, created with this constructor evaluates following indefinite integral: More...
| NumericalIndefiniteIntegral (const NumericalIndefiniteIntegral &)
| copy constructor More...
| ~NumericalIndefiniteIntegral () 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...
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::Limit | limit () const
| integration limit More...
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
| NumericalIndefiniteIntegral ()
NumericalIndefiniteIntegral & | operator= (const NumericalIndefiniteIntegral &)

## Private Attributes
std::unique_ptr< const AbsFunction > | m_function
size_t | m_DIM
size_t | m_index
double | m_a
GaudiMath::Integration::Limit | m_limit
GaudiMath::Integration::Type | m_type
GaudiMath::Integration::Category | m_category
GaudiMath::Integration::KronrodRule | m_rule
Points | m_points
std::unique_ptr< double[]> | m_pdata
double | m_epsabs
double | m_epsrel
double | m_result
double | m_error
size_t | m_size
std::unique_ptr< _Workspace, gsl_ws_deleter > | m_ws
Argument | m_argument

## Detailed Description

The simple class for numerical integrations.

It allows to evaluate following indefinite integrals:

\[ {\mathcal{F}}_i \left(x_1, \dots , x_{i-1}, x_i , x_{i+1}, \dots , x_n \right) = \int\limits_{a}^{x_i} 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 , x_{i+1}, \dots , x_n \right) = \int\limits_{x_i}^{a} 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 , x_{i+1}, \dots , x_n \right) = \int\limits_{-\infty}^{x_i} 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 , x_{i+1}, \dots , x_n \right) = \int\limits_{x_i}^{+\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 83 of file NumericalIndefiniteIntegral.h.

## Member Typedef Documentation

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

typedef for vector of singular points

Definition at line 87 of file NumericalIndefiniteIntegral.h.

## Constructor & Destructor Documentation

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

From CLHEP/GenericFunctions.

Standard constructor.

Standard constructor The function, created with this constructor evaluates following indefinite integral:

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

for value of `limit` = `VariableHighLimit` and the integral

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

for value of `limit` = `VariableLowLimit`

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 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 | the base function
  index | the variable index
  a | integration limit
  limit | flag to distinguisch low variable limit from high variable limit
  type | the integration type (adaptive, non-adaptive or adaptive for singular functions
  key | Gauss-Kronrad integration rule
  epsabs | absolute precision for integration
  epsrel | relative precision for integration
  lim | bisection limit
  function | the base function
  index | the variable index
  a | integration limit
  limit | flag to distinguisch low variable limit from high variable limit
  type | the integration type (adaptive, non-adaptive or adaptive for singular functions
  key | Gauss-Kronrad integration rule
  epsabs | absolute precision for integration
  epsrel | relative precision for integration
  lim | bisection limit

Definition at line 74 of file NumericalIndefiniteIntegral.cpp.

83 : AbsFunction ()
84 , m_function ( function.clone() )
85 , m_DIM ( function.dimensionality() )
86 , m_index ( index )
87 , m_a ( a )
88 , m_limit ( limit )
89 , m_type ( type )
90 , m_category ( GaudiMath::Integration::Finite )
91 , m_rule ( rule )
92 //
93 , m_points ( )
94 //
95 , m_epsabs ( epsabs )
96 , m_epsrel ( epsrel )
97 //
98 , m_result ( GSL_NEGINF )
99 , m_error ( GSL_POSINF )
100 //
101 , m_size ( size )
102 , m_argument ( function.dimensionality() )
103 {
104 if ( GaudiMath::Integration::Fixed == m_rule )
105 { m_rule = GaudiMath::Integration::Default ; }
106 if ( m_index >= m_DIM )
107 { Exception("::constructor: invalid variable index") ; }
108 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:392
GaudiMath::Integration::Finite
Definition: Integration.h:30
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::epsrel
double epsrel() const
relatiove precision
Definition: NumericalIndefiniteIntegral.h:309
GaudiMath::Integration::Fixed
Definition: Integration.h:34
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:228
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:376
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:378
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit
GaudiMath::Integration::Limit limit() const
integration limit
Definition: NumericalIndefiniteIntegral.h:321
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::size
size_t size() const
Definition: NumericalIndefiniteIntegral.h:317
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:388
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_size
size_t m_size
Definition: NumericalIndefiniteIntegral.h:394
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:375
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::rule
GaudiMath::Integration::KronrodRule rule() const
integration rule
Definition: NumericalIndefiniteIntegral.h:330
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:389
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::epsabs
double epsabs() const
absolute precision
Definition: NumericalIndefiniteIntegral.h:307
GaudiMath::Integration::Default
Definition: Integration.h:41
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_limit
GaudiMath::Integration::Limit m_limit
Definition: NumericalIndefiniteIntegral.h:380
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalIndefiniteIntegral.h:382
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::dimensionality
unsigned int dimensionality() const override
dimensionality of the problem
Definition: NumericalIndefiniteIntegral.h:285
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::type
GaudiMath::Integration::Type type() const
integration type
Definition: NumericalIndefiniteIntegral.h:324
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalIndefiniteIntegral.h:374
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::a
double a() const
integration limit
Definition: NumericalIndefiniteIntegral.h:303
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalIndefiniteIntegral.h:381
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:397
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalIndefiniteIntegral.h:383
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:391
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_points
Points m_points
Definition: NumericalIndefiniteIntegral.h:385

Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::NumericalIndefiniteIntegral | ( | const AbsFunction & | function,
|  | const size_t | index,
|  | const double | a,
|  | const Points & | points,
|  | const GaudiMath::Integration::Limit | limit = `GaudiMath::Integration::VariableHighLimit`,
|  | const double | epsabs = `1e-9`,
|  | const double | epsrel = `1.e-6`,
|  | const size_t | size = `1000`
| ) |  |

standard constructor

The function, created with this constructor evaluates following indefinite integral:

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

for value of `limit` = `VariableHighLimit` and the integral

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

for value of `limit` = `VariableLowLimit`

The integrand is assumed to have a known discontinuities

- The GSL routine `gsl_integration_qagp` is used for integration

Parameters

  function | the base function
  index | the variable index
  a | integration limit
  limit | flag to distinguisch low variable limit from high variable limit
  points | list of known function singularities
  epsabs | absolute precision for integration
  epsrel | relative precision for integration
  function | the base function
  index | the variable index
  a | integration limit
  limit | flag to distinguisch low variable limit from high variable limit
  points | list of known function singularities
  epsabs | absolute precision for integration
  epsrel | relative precision for integration

Definition at line 122 of file NumericalIndefiniteIntegral.cpp.

130 : AbsFunction ()
131 , m_function ( function.clone() )
132 , m_DIM ( function.dimensionality() )
133 , m_index ( index )
134 , m_a ( a )
135 , m_limit ( limit )
136 , m_type ( GaudiMath::Integration:: Other )
137 , m_category ( GaudiMath::Integration:: Singular )
138 , m_rule ( GaudiMath::Integration:: Fixed )
139 , m_points ( points )
140 , m_epsabs ( epsabs )
141 , m_epsrel ( epsrel )
142 //
143 , m_result ( GSL_NEGINF )
144 , m_error ( GSL_POSINF )
145 //
146 , m_size ( size )
147 , m_argument ( function.dimensionality() )
148 {
149 if ( m_index >= m_DIM )
150 { Exception("::constructor: invalid variable index") ; }
151 m_pdata.reset( new double[ 2 + m_points.size() ] );
152 m_points.push_back( a ) ;
153 std::sort( m_points.begin() , m_points.end() ) ;
154 m_points.erase ( std::unique( m_points.begin () ,
155 m_points.end () ) , m_points.end() );
156 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:392
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::epsrel
double epsrel() const
relatiove precision
Definition: NumericalIndefiniteIntegral.h:309
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:228
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_pdata
std::unique_ptr< double[]> m_pdata
Definition: NumericalIndefiniteIntegral.h:386
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:376
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:378
std::vector::end
T end(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit
GaudiMath::Integration::Limit limit() const
integration limit
Definition: NumericalIndefiniteIntegral.h:321
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::size
size_t size() const
Definition: NumericalIndefiniteIntegral.h:317
GaudiMath::Integration::Singular
Definition: Integration.h:31
std::unique
T unique(T...args)
std::vector::push_back
T push_back(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:388
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_size
size_t m_size
Definition: NumericalIndefiniteIntegral.h:394
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:375
std::vector::erase
T erase(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:389
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::epsabs
double epsabs() const
absolute precision
Definition: NumericalIndefiniteIntegral.h:307
std::unique_ptr::reset
T reset(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_limit
GaudiMath::Integration::Limit m_limit
Definition: NumericalIndefiniteIntegral.h:380
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalIndefiniteIntegral.h:382
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::dimensionality
unsigned int dimensionality() const override
dimensionality of the problem
Definition: NumericalIndefiniteIntegral.h:285
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalIndefiniteIntegral.h:374
std::vector::size
T size(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::a
double a() const
integration limit
Definition: NumericalIndefiniteIntegral.h:303
std::vector::begin
T begin(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalIndefiniteIntegral.h:381
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:397
std::sort
T sort(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalIndefiniteIntegral.h:383
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:391
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::points
const Points & points() const
known singularities
Definition: NumericalIndefiniteIntegral.h:305
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_points
Points m_points
Definition: NumericalIndefiniteIntegral.h:385

Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::NumericalIndefiniteIntegral | ( | const AbsFunction & | function,
|  | const size_t | index,
|  | const GaudiMath::Integration::Limit | limit = `GaudiMath::Integration::VariableHighLimit`,
|  | const double | epsabs = `1e-9`,
|  | const double | epsrel = `1.e-6`,
|  | const size_t | size = `1000`
| ) |  |

standard constructor The function, created with this constructor evaluates following indefinite integral:

standard constructor the integral limt is assumed to be infinity

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

for value of `limit` = `VariableHighLimit` and the integral

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

for value of `limit` = `VariableLowLimit`

- The GSL routines `gsl_integration_qagil` and `gsl_integration_qagiu` are used for adapive integration

Parameters

  function | the base function
  index | the variable index
  limit | flag to distinguisch low variable limit from high variable limit
  singularities | list of known function singularities
  function | the base function
  index | the variable index
  limit | flag to distinguisch low variable limit from high variable limit

Definition at line 168 of file NumericalIndefiniteIntegral.cpp.

174 : AbsFunction ()
175 , m_function ( function.clone() )
176 , m_DIM ( function.dimensionality() )
177 , m_index ( index )
178 , m_a ( GSL_NEGINF ) // should not be used!
179 , m_limit ( limit )
180 , m_type ( GaudiMath::Integration:: Other )
181 , m_category ( GaudiMath::Integration:: Infinite )
182 , m_rule ( GaudiMath::Integration:: Fixed )
183 , m_points ( )
184 , m_epsabs ( epsabs )
185 , m_epsrel ( epsrel )
186 , m_result ( GSL_NEGINF )
187 , m_error ( GSL_POSINF )
188 , m_size ( size )
189 , m_argument ( function.dimensionality() )
190 {
191 if ( m_index >= m_DIM )
192 { Exception("::constructor: invalid variable index") ; }
193 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:392
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::epsrel
double epsrel() const
relatiove precision
Definition: NumericalIndefiniteIntegral.h:309
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:228
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:376
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:378
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit
GaudiMath::Integration::Limit limit() const
integration limit
Definition: NumericalIndefiniteIntegral.h:321
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::size
size_t size() const
Definition: NumericalIndefiniteIntegral.h:317
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:388
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_size
size_t m_size
Definition: NumericalIndefiniteIntegral.h:394
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:375
GaudiMath::Integration::Infinite
Definition: Integration.h:32
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:389
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::epsabs
double epsabs() const
absolute precision
Definition: NumericalIndefiniteIntegral.h:307
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_limit
GaudiMath::Integration::Limit m_limit
Definition: NumericalIndefiniteIntegral.h:380
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalIndefiniteIntegral.h:382
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::dimensionality
unsigned int dimensionality() const override
dimensionality of the problem
Definition: NumericalIndefiniteIntegral.h:285
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalIndefiniteIntegral.h:374
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalIndefiniteIntegral.h:381
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:397
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalIndefiniteIntegral.h:383
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:391
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_points
Points m_points
Definition: NumericalIndefiniteIntegral.h:385

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

copy constructor

Definition at line 201 of file NumericalIndefiniteIntegral.cpp.

202 : AbsFunction ()
203 , m_function ( right.m_function->clone() )
204 , m_DIM ( right.m_DIM )
205 , m_index ( right.m_index )
206 , m_a ( right.m_a )
207 , m_limit ( right.m_limit )
208 , m_type ( right.m_type )
209 , m_category ( right.m_category )
210 , m_rule ( right.m_rule )
211 , m_points ( right.m_points )
212 , m_epsabs ( right.m_epsabs )
213 , m_epsrel ( right.m_epsrel )
214 , m_result ( GSL_NEGINF )
215 , m_error ( GSL_POSINF )
216 , m_size ( right.m_size )
217 , m_argument ( right.m_argument )
218 {
219 m_pdata.reset( new double[ 2 + m_points.size() ] ) ;
220 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:392
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_pdata
std::unique_ptr< double[]> m_pdata
Definition: NumericalIndefiniteIntegral.h:386
std::right
T right(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:376
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:378
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:388
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_size
size_t m_size
Definition: NumericalIndefiniteIntegral.h:394
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:375
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:389
std::unique_ptr::reset
T reset(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_limit
GaudiMath::Integration::Limit m_limit
Definition: NumericalIndefiniteIntegral.h:380
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalIndefiniteIntegral.h:382
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalIndefiniteIntegral.h:374
std::vector::size
T size(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalIndefiniteIntegral.h:381
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:397
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalIndefiniteIntegral.h:383
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:391
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_points
Points m_points
Definition: NumericalIndefiniteIntegral.h:385

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

destructor

Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::NumericalIndefiniteIntegral | ( |  | ) |
| private

## Member Function Documentation

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

integration limit

Definition at line 303 of file NumericalIndefiniteIntegral.h.

303 { return m_a ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:378

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

allocate the integration workspace

Definition at line 328 of file NumericalIndefiniteIntegral.cpp.

329 {
330 if ( !m_ws ) {
331 m_ws.reset( new _Workspace() );
332 m_ws->ws = gsl_integration_workspace_alloc( size () );
333 if ( !m_ws->ws ) { Exception ( "allocate()::invalid workspace" ) ; };
334 }
335 return m_ws.get() ;
336 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_ws
std::unique_ptr< _Workspace, gsl_ws_deleter > m_ws
Definition: NumericalIndefiniteIntegral.h:395
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:228
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::size
size_t size() const
Definition: NumericalIndefiniteIntegral.h:317

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

integration category

Definition at line 327 of file NumericalIndefiniteIntegral.h.

327 { return m_category ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalIndefiniteIntegral.h:382

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

dimensionality of the problem

Definition at line 285 of file NumericalIndefiniteIntegral.h.

285 { return m_DIM ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:375

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

absolute precision

Definition at line 307 of file NumericalIndefiniteIntegral.h.

307 { return m_epsabs ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:388

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

relatiove precision

Definition at line 309 of file NumericalIndefiniteIntegral.h.

309 { return m_epsrel ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:389

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

evaluate of previous error

Definition at line 314 of file NumericalIndefiniteIntegral.h.

314 { return m_error ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:392

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

Definition at line 228 of file NumericalIndefiniteIntegral.cpp.

230 {
231 throw GaudiException( "NumericalIndefiniteIntegral::" + message ,
232 "*GaudiMath*" , sc ) ;
233 return sc ;
234 }
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23

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

accessor to the function itself

Definition at line 301 of file NumericalIndefiniteIntegral.h.

301 { return *m_function ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalIndefiniteIntegral.h:374

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

Does this function have an analytic derivative?

Definition at line 293 of file NumericalIndefiniteIntegral.h.

293 { return true ;}

GaudiMath::Integration::Limit Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit | ( |  | ) | const
| inline

integration limit

Definition at line 321 of file NumericalIndefiniteIntegral.h.

321 { return m_limit ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_limit
GaudiMath::Integration::Limit m_limit
Definition: NumericalIndefiniteIntegral.h:380

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

Function value.

evaluate the function

Definition at line 241 of file NumericalIndefiniteIntegral.cpp.

242 {
243 // reset the result and the error
244 m_result = GSL_NEGINF ;
245 m_error = GSL_POSINF ;
246
247 // check the argument
248 if( 1 != m_DIM ) { Exception ( "operator(): invalid argument size " ) ; };
249
250 m_argument[0] = argument ;
251 return (*this) ( m_argument );
252 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:392
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:228
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:375
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:397
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:391

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

Function value.

evaluate the function

Definition at line 281 of file NumericalIndefiniteIntegral.cpp.

282 {
283 // reset the result and the error
284 m_result = GSL_NEGINF ;
285 m_error = GSL_POSINF ;
286
287 // check the argument
288 if( argument.dimension() != m_DIM )
289 { Exception ( "operator(): invalid argument size " ) ; };
290
291 // copy the argument
292 {for( size_t i = 0 ; i < m_DIM ; ++i ){ m_argument[i] = argument[i];}}
293
294 // create the helper object
295 GSL_Helper helper( *m_function , m_argument , m_index );
296
297 // use GSL to evaluate the numerical derivative
298 gsl_function F ;
299 F.function = &GSL_Adaptor ;
300 F.params = &helper ;
301 _Function F1 ;
302 F1.fn = &F ;
303
304 if ( GaudiMath::Integration::Infinite == category () )
305 { return QAGI ( &F1 ) ; } // RETURN
306 else if ( GaudiMath::Integration::Singular == category () )
307 { return QAGP ( &F1 ) ; } // RETURN
308 else if ( GaudiMath::Integration::Finite == category () )
309 if ( GaudiMath::Integration::NonAdaptive == type () )
310 { return QNG ( &F1 ) ; } // RETURN
311 else if ( GaudiMath::Integration::Adaptive == type () )
312 { return QAG ( &F1 ) ; } // RETURN
313 else if ( GaudiMath::Integration::AdaptiveSingular == type () )
314 { return QAGS ( &F1 ) ; } // RETURN
315 else
316 { Exception ( "::operator(): invalid type " ); }
317 else
318 { Exception ( "::operator(): invalid category " ); }
319
320 return 0 ;
321 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:392
GaudiMath::Integration::Finite
Definition: Integration.h:30
GaudiMath::Integration::NonAdaptive
Definition: Integration.h:25
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:228
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::QAGI
double QAGI(_Function *fun) const
Definition: NumericalIndefiniteIntegral.cpp:342
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:376
GaudiMath::Integration::Adaptive
Definition: Integration.h:26
GaudiMath::Integration::Singular
Definition: Integration.h:31
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::category
GaudiMath::Integration::Category category() const
integration category
Definition: NumericalIndefiniteIntegral.h:327
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::QAGS
double QAGS(_Function *fun) const
Definition: NumericalIndefiniteIntegral.cpp:513
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:375
GaudiMath::Integration::Infinite
Definition: Integration.h:32
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::QNG
double QNG(_Function *fun) const
Definition: NumericalIndefiniteIntegral.cpp:433
Genfun::GaudiMathImplementation::GSL_Adaptor
double GSL_Adaptor(double x, void *params)
Definition: Helpers.cpp:37
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::QAG
double QAG(_Function *fun) const
Definition: NumericalIndefiniteIntegral.cpp:471
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::type
GaudiMath::Integration::Type type() const
integration type
Definition: NumericalIndefiniteIntegral.h:324
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalIndefiniteIntegral.h:374
GaudiMath::Integration::AdaptiveSingular
Definition: Integration.h:27
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:397
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:391
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::QAGP
double QAGP(_Function *fun) const
Definition: NumericalIndefiniteIntegral.cpp:379

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

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

Derivatives.

Definition at line 259 of file NumericalIndefiniteIntegral.cpp.

260 {
261 if ( idx >= m_DIM )
262 { Exception ( "::partial(i): invalid variable index " ) ; };
263 if ( idx != m_index )
264 {
265 const AbsFunction& aux = NumericalDerivative( *this , idx ) ;
266 return Genfun::FunctionNoop( &aux ) ;
267 }
268 else if ( GaudiMath::Integration::VariableLowLimit == limit () )
269 {
270 const AbsFunction& aux = -1 * function() ;
271 return Genfun::FunctionNoop( &aux ) ;
272 }
273 const AbsFunction& aux = function() ;
274 return Genfun::FunctionNoop( &aux ) ;
275 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:228
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:376
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit
GaudiMath::Integration::Limit limit() const
integration limit
Definition: NumericalIndefiniteIntegral.h:321
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:375
GaudiMath::Integration::VariableLowLimit
Definition: Integration.h:22

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

known singularities

Definition at line 305 of file NumericalIndefiniteIntegral.h.

305 { return m_points ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_points
Points m_points
Definition: NumericalIndefiniteIntegral.h:385

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

Definition at line 471 of file NumericalIndefiniteIntegral.cpp.

472 {
473 if( !F ) { Exception("QAG::invalid function") ; }
474
475 const double x = m_argument[m_index] ;
476 if ( m_a == x )
477 {
478 m_result = 0 ;
479 m_error = 0 ; // EXACT !
480 return m_result ;
481 }
482
483 // allocate workspace
484 allocate () ;
485
486 // integration limits
487 const double a = std::min ( m_a , x ) ;
488 const double b = std::max ( m_a , x ) ;
489
490 int ierror =
491 gsl_integration_qag ( F->fn ,
492 a , b ,
493 m_epsabs , m_epsrel ,
494 size () , (int) rule() , ws ()->ws ,
495 &m_result , &m_error );
496
497 if( ierror ) { gsl_error( "NumericalIndefiniteIntegral::QAG " ,
498 __FILE__ , __LINE__ , ierror ) ; }
499
500 // sign
501 if ( GaudiMath::Integration::VariableHighLimit == limit()
502 && x < m_a ) { m_result *= -1 ; }
503 else if ( GaudiMath::Integration::VariableLowLimit == limit()
504 && x > m_a ) { m_result *= -1 ; }
505
506 return m_result ;
507 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:392
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:228
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:376
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:378
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit
GaudiMath::Integration::Limit limit() const
integration limit
Definition: NumericalIndefiniteIntegral.h:321
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::size
size_t size() const
Definition: NumericalIndefiniteIntegral.h:317
std::min
T min(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:388
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::rule
GaudiMath::Integration::KronrodRule rule() const
integration rule
Definition: NumericalIndefiniteIntegral.h:330
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::allocate
_Workspace * allocate() const
allocate the integration workspace
Definition: NumericalIndefiniteIntegral.cpp:328
GaudiMath::Integration::VariableHighLimit
Definition: Integration.h:23
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:389
std::max
T max(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::a
double a() const
integration limit
Definition: NumericalIndefiniteIntegral.h:303
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:397
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:391
GaudiMath::Integration::VariableLowLimit
Definition: Integration.h:22
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::ws
_Workspace * ws() const
Definition: NumericalIndefiniteIntegral.h:348

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

Definition at line 342 of file NumericalIndefiniteIntegral.cpp.

343 {
344 // check the argument
345 if( !F ) { Exception("::QAGI: invalid function"); }
346
347 const double x = m_argument[m_index] ;
348
349 // allocate workspace
350 allocate() ;
351
352 int ierror = 0 ;
353 switch ( limit() )
354 {
355 case GaudiMath::Integration::VariableLowLimit :
356 ierror = gsl_integration_qagiu ( F->fn , x ,
357 m_epsabs , m_epsrel ,
358 size () , ws()->ws ,
359 &m_result , &m_error ) ; break ;
360 case GaudiMath::Integration::VariableHighLimit :
361 ierror = gsl_integration_qagil ( F->fn , x ,
362 m_epsabs , m_epsrel ,
363 size () , ws()->ws ,
364 &m_result , &m_error ) ; break ;
365 default :
366 Exception ( "::QAGI: invalid mode" ) ;
367 };
368
369 if( ierror ) { gsl_error( "NumericalIndefiniteIntegral::QAGI" ,
370 __FILE__ , __LINE__ , ierror ) ;}
371
372 return m_result ;
373 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:392
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:228
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:376
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit
GaudiMath::Integration::Limit limit() const
integration limit
Definition: NumericalIndefiniteIntegral.h:321
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::size
size_t size() const
Definition: NumericalIndefiniteIntegral.h:317
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:388
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::allocate
_Workspace * allocate() const
allocate the integration workspace
Definition: NumericalIndefiniteIntegral.cpp:328
GaudiMath::Integration::VariableHighLimit
Definition: Integration.h:23
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:389
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:397
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:391
GaudiMath::Integration::VariableLowLimit
Definition: Integration.h:22
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::ws
_Workspace * ws() const
Definition: NumericalIndefiniteIntegral.h:348

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

Definition at line 379 of file NumericalIndefiniteIntegral.cpp.

380 {
381 if( !F ) { Exception("QAGP::invalid function") ; }
382
383 const double x = m_argument[m_index] ;
384 if ( m_a == x )
385 {
386 m_result = 0 ;
387 m_error = 0 ; // EXACT !
388 return m_result ;
389 }
390
391 // no known singular points ?
392 if( points().empty() ) { return QAGS( F ) ; }
393
394 // integration limits
395 const double a = std::min ( m_a , x ) ;
396 const double b = std::max ( m_a , x ) ;
397
398 // "active" singular points
399 auto lower = std::lower_bound( points().begin(), points().end(), a ) ;
400 auto upper = std::upper_bound( points().begin(), points().end(), b ) ;
401
402 Points pnts ( upper - lower ) ;
403 std::copy( lower , upper , pnts.begin() );
404 if ( *lower != a ) { pnts.insert( pnts.begin () , a ) ; }
405 if ( *upper != b ) { pnts.insert( pnts.end () , b ) ; }
406 std::copy( pnts.begin() , pnts.end() , m_pdata.get() );
407 const size_t npts = pnts.size() ;
408
409 // use GSL
410 int ierror =
411 gsl_integration_qagp ( F->fn ,
412 m_pdata.get() , npts ,
413 m_epsabs , m_epsrel ,
414 size () , ws()->ws ,
415 &m_result , &m_error ) ;
416
417 if( ierror ) { gsl_error( "NumericalIndefiniteIntegral::QAGI " ,
418 __FILE__ , __LINE__ , ierror ) ; }
419
420 // sign
421 if ( GaudiMath::Integration::VariableHighLimit == limit()
422 && x < m_a ) { m_result *= -1 ; }
423 else if ( GaudiMath::Integration::VariableLowLimit == limit()
424 && x > m_a ) { m_result *= -1 ; }
425
426 return m_result ;
427 }
std::copy
T copy(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:392
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:228
std::upper_bound
T upper_bound(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_pdata
std::unique_ptr< double[]> m_pdata
Definition: NumericalIndefiniteIntegral.h:386
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:376
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:378
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit
GaudiMath::Integration::Limit limit() const
integration limit
Definition: NumericalIndefiniteIntegral.h:321
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::size
size_t size() const
Definition: NumericalIndefiniteIntegral.h:317
std::lower_bound
T lower_bound(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::_Workspace::ws
gsl_integration_workspace * ws
Definition: NumericalIndefiniteIntegral.h:86
begin
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:48
std::min
T min(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:388
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::QAGS
double QAGS(_Function *fun) const
Definition: NumericalIndefiniteIntegral.cpp:513
GaudiMath::Integration::VariableHighLimit
Definition: Integration.h:23
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:389
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:50
std::max
T max(T...args)
std::unique_ptr::get
T get(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::a
double a() const
integration limit
Definition: NumericalIndefiniteIntegral.h:303
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:397
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Points
std::vector< double > Points
typedef for vector of singular points
Definition: NumericalIndefiniteIntegral.h:87
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:391
GaudiMath::Integration::VariableLowLimit
Definition: Integration.h:22
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::points
const Points & points() const
known singularities
Definition: NumericalIndefiniteIntegral.h:305
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::ws
_Workspace * ws() const
Definition: NumericalIndefiniteIntegral.h:348

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

Definition at line 513 of file NumericalIndefiniteIntegral.cpp.

514 {
515 if( !F ) { Exception("QAG::invalid function") ; }
516
517 const double x = m_argument[m_index] ;
518 if ( m_a == x )
519 {
520 m_result = 0 ;
521 m_error = 0 ; // EXACT !
522 return m_result ;
523 }
524
525 // allocate workspace
526 allocate () ;
527
528 // integration limits
529 const double a = std::min ( m_a , x ) ;
530 const double b = std::max ( m_a , x ) ;
531
532 int ierror =
533 gsl_integration_qags ( F->fn ,
534 a , b ,
535 m_epsabs , m_epsrel ,
536 size () , ws()->ws ,
537 &m_result , &m_error );
538
539 if( ierror ) { gsl_error( "NumericalIndefiniteIntegral::QAGS " ,
540 __FILE__ , __LINE__ , ierror ) ; }
541
542 // sign
543 if ( GaudiMath::Integration::VariableHighLimit == limit()
544 && x < m_a ) { m_result *= -1 ; }
545 else if ( GaudiMath::Integration::VariableLowLimit == limit()
546 && x > m_a ) { m_result *= -1 ; }
547
548 return m_result ;
549 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:392
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:228
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:376
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:378
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit
GaudiMath::Integration::Limit limit() const
integration limit
Definition: NumericalIndefiniteIntegral.h:321
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::size
size_t size() const
Definition: NumericalIndefiniteIntegral.h:317
std::min
T min(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:388
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::allocate
_Workspace * allocate() const
allocate the integration workspace
Definition: NumericalIndefiniteIntegral.cpp:328
GaudiMath::Integration::VariableHighLimit
Definition: Integration.h:23
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:389
std::max
T max(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::a
double a() const
integration limit
Definition: NumericalIndefiniteIntegral.h:303
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:397
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:391
GaudiMath::Integration::VariableLowLimit
Definition: Integration.h:22
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::ws
_Workspace * ws() const
Definition: NumericalIndefiniteIntegral.h:348

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

Definition at line 433 of file NumericalIndefiniteIntegral.cpp.

434 {
435 if( !F ) { Exception("QNG::invalid function") ; }
436
437 const double x = m_argument[m_index] ;
438 if ( m_a == x )
439 {
440 m_result = 0 ;
441 m_error = 0 ; // EXACT !
442 return m_result ;
443 }
444
445 // integration limits
446 const double a = std::min ( m_a , x ) ;
447 const double b = std::max ( m_a , x ) ;
448
449 size_t neval = 0 ;
450 int ierror =
451 gsl_integration_qng ( F->fn ,
452 a , b ,
453 m_epsabs , m_epsrel ,
454 &m_result , &m_error , &neval ) ;
455
456 if( ierror ) { gsl_error( "NumericalIndefiniteIntegral::QNG " ,
457 __FILE__ , __LINE__ , ierror ) ; }
458
459 // sign
460 if ( GaudiMath::Integration::VariableHighLimit == limit()
461 && x < m_a ) { m_result *= -1 ; }
462 else if ( GaudiMath::Integration::VariableLowLimit == limit()
463 && x > m_a ) { m_result *= -1 ; }
464
465 return m_result ;
466 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:392
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:228
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:376
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:378
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit
GaudiMath::Integration::Limit limit() const
integration limit
Definition: NumericalIndefiniteIntegral.h:321
std::min
T min(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:388
GaudiMath::Integration::VariableHighLimit
Definition: Integration.h:23
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:389
std::max
T max(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::a
double a() const
integration limit
Definition: NumericalIndefiniteIntegral.h:303
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:397
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:391
GaudiMath::Integration::VariableLowLimit
Definition: Integration.h:22

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

previous result

Definition at line 312 of file NumericalIndefiniteIntegral.h.

312 { return m_result ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:391

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

integration rule

Definition at line 330 of file NumericalIndefiniteIntegral.h.

330 { return m_rule ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalIndefiniteIntegral.h:383

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

Definition at line 317 of file NumericalIndefiniteIntegral.h.

317 { return m_size ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_size
size_t m_size
Definition: NumericalIndefiniteIntegral.h:394

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

integration type

Definition at line 324 of file NumericalIndefiniteIntegral.h.

324 { return m_type ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalIndefiniteIntegral.h:381

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

Definition at line 348 of file NumericalIndefiniteIntegral.h.

349 { return m_ws.get(); }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_ws
std::unique_ptr< _Workspace, gsl_ws_deleter > m_ws
Definition: NumericalIndefiniteIntegral.h:395

## Member Data Documentation

double Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
| private

Definition at line 378 of file NumericalIndefiniteIntegral.h.

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

Definition at line 397 of file NumericalIndefiniteIntegral.h.

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

Definition at line 382 of file NumericalIndefiniteIntegral.h.

size_t Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
| private

Definition at line 375 of file NumericalIndefiniteIntegral.h.

double Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
| private

Definition at line 388 of file NumericalIndefiniteIntegral.h.

double Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
| private

Definition at line 389 of file NumericalIndefiniteIntegral.h.

double Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
| mutable private

Definition at line 392 of file NumericalIndefiniteIntegral.h.

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

Definition at line 374 of file NumericalIndefiniteIntegral.h.

size_t Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
| private

Definition at line 376 of file NumericalIndefiniteIntegral.h.

GaudiMath::Integration::Limit Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_limit
| private

Definition at line 380 of file NumericalIndefiniteIntegral.h.

std::unique_ptr<double[]> Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_pdata
| private

Definition at line 386 of file NumericalIndefiniteIntegral.h.

Points Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_points
| private

Definition at line 385 of file NumericalIndefiniteIntegral.h.

double Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
| mutable private

Definition at line 391 of file NumericalIndefiniteIntegral.h.

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

Definition at line 383 of file NumericalIndefiniteIntegral.h.

size_t Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_size
| private

Definition at line 394 of file NumericalIndefiniteIntegral.h.

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

Definition at line 381 of file NumericalIndefiniteIntegral.h.

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

Definition at line 395 of file NumericalIndefiniteIntegral.h.

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

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