| The Gaudi Framework v27r1

- 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...
virtual | ~NumericalIndefiniteIntegral ()=default
| destructor More...
virtual unsigned int | dimensionality () const
| dimensionality of the problem More...
virtual double | operator() (double argument) const
| Function value. More...
virtual double | operator() (const Argument &argument) const
| Function value. More...
virtual bool | hasAnalyticDerivative () const
| Does this function have an analytic derivative? More...
virtual Genfun::Derivative | partial (unsigned int index) const
| 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 75 of file NumericalIndefiniteIntegral.h.

## Member Typedef Documentation

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

typedef for vector of singular points

Definition at line 79 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.

from CLHEP/GenericFunctions

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

Standard constructor

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

Definition at line 78 of file NumericalIndefiniteIntegral.cpp.

87 : AbsFunction ()
88 , m_function ( function.clone() )
89 , m_DIM ( function.dimensionality() )
90 , m_index ( index )
91 , m_a ( a )
92 , m_limit ( limit )
93 , m_type ( type )
94 , m_category ( GaudiMath::Integration::Finite )
95 , m_rule ( rule )
96 //
97 , m_points ( )
98 //
99 , m_epsabs ( epsabs )
100 , m_epsrel ( epsrel )
101 //
102 , m_result ( GSL_NEGINF )
103 , m_error ( GSL_POSINF )
104 //
105 , m_size ( size )
106 , m_argument ( function.dimensionality() )
107 {
108 if ( GaudiMath::Integration::Fixed == m_rule )
109 { m_rule = GaudiMath::Integration::Default ; }
110 if ( m_index >= m_DIM )
111 { Exception("::constructor: invalid variable index") ; }
112 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:384
GaudiMath::Integration::Finite
Definition: Integration.h:30
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::epsrel
double epsrel() const
relatiove precision
Definition: NumericalIndefiniteIntegral.h:301
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:232
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:368
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit
GaudiMath::Integration::Limit limit() const
integration limit
Definition: NumericalIndefiniteIntegral.h:313
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::size
size_t size() const
Definition: NumericalIndefiniteIntegral.h:309
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::dimensionality
virtual unsigned int dimensionality() const
dimensionality of the problem
Definition: NumericalIndefiniteIntegral.h:277
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:380
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_size
size_t m_size
Definition: NumericalIndefiniteIntegral.h:386
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:367
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::rule
GaudiMath::Integration::KronrodRule rule() const
integration rule
Definition: NumericalIndefiniteIntegral.h:322
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:381
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::epsabs
double epsabs() const
absolute precision
Definition: NumericalIndefiniteIntegral.h:299
GaudiMath::Integration::Default
Definition: Integration.h:41
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_limit
GaudiMath::Integration::Limit m_limit
Definition: NumericalIndefiniteIntegral.h:372
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalIndefiniteIntegral.h:374
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::type
GaudiMath::Integration::Type type() const
integration type
Definition: NumericalIndefiniteIntegral.h:316
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalIndefiniteIntegral.h:366
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::a
double a() const
integration limit
Definition: NumericalIndefiniteIntegral.h:295
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalIndefiniteIntegral.h:373
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:389
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalIndefiniteIntegral.h:375
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:383
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_points
Points m_points
Definition: NumericalIndefiniteIntegral.h:377

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 126 of file NumericalIndefiniteIntegral.cpp.

134 : AbsFunction ()
135 , m_function ( function.clone() )
136 , m_DIM ( function.dimensionality() )
137 , m_index ( index )
138 , m_a ( a )
139 , m_limit ( limit )
140 , m_type ( GaudiMath::Integration:: Other )
141 , m_category ( GaudiMath::Integration:: Singular )
142 , m_rule ( GaudiMath::Integration:: Fixed )
143 , m_points ( points )
144 , m_epsabs ( epsabs )
145 , m_epsrel ( epsrel )
146 //
147 , m_result ( GSL_NEGINF )
148 , m_error ( GSL_POSINF )
149 //
150 , m_size ( size )
151 , m_argument ( function.dimensionality() )
152 {
153 if ( m_index >= m_DIM )
154 { Exception("::constructor: invalid variable index") ; }
155 m_pdata.reset( new double[ 2 + m_points.size() ] );
156 m_points.push_back( a ) ;
157 std::sort( m_points.begin() , m_points.end() ) ;
158 m_points.erase ( std::unique( m_points.begin () ,
159 m_points.end () ) , m_points.end() );
160 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:384
GaudiMath::Integration::Other
Definition: Integration.h:28
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::epsrel
double epsrel() const
relatiove precision
Definition: NumericalIndefiniteIntegral.h:301
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:232
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_pdata
std::unique_ptr< double[]> m_pdata
Definition: NumericalIndefiniteIntegral.h:378
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:368
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:370
std::vector::end
T end(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit
GaudiMath::Integration::Limit limit() const
integration limit
Definition: NumericalIndefiniteIntegral.h:313
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::size
size_t size() const
Definition: NumericalIndefiniteIntegral.h:309
GaudiMath::Integration::Singular
Definition: Integration.h:31
std::unique
T unique(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::dimensionality
virtual unsigned int dimensionality() const
dimensionality of the problem
Definition: NumericalIndefiniteIntegral.h:277
std::vector::push_back
T push_back(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:380
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_size
size_t m_size
Definition: NumericalIndefiniteIntegral.h:386
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:367
std::vector::erase
T erase(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:381
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::epsabs
double epsabs() const
absolute precision
Definition: NumericalIndefiniteIntegral.h:299
std::unique_ptr::reset
T reset(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_limit
GaudiMath::Integration::Limit m_limit
Definition: NumericalIndefiniteIntegral.h:372
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalIndefiniteIntegral.h:374
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalIndefiniteIntegral.h:366
std::vector::size
T size(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::a
double a() const
integration limit
Definition: NumericalIndefiniteIntegral.h:295
std::vector::begin
T begin(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalIndefiniteIntegral.h:373
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:389
std::sort
T sort(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalIndefiniteIntegral.h:375
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:383
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::points
const Points & points() const
known singularities
Definition: NumericalIndefiniteIntegral.h:297
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_points
Points m_points
Definition: NumericalIndefiniteIntegral.h:377

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 172 of file NumericalIndefiniteIntegral.cpp.

178 : AbsFunction ()
179 , m_function ( function.clone() )
180 , m_DIM ( function.dimensionality() )
181 , m_index ( index )
182 , m_a ( GSL_NEGINF ) // should not be used!
183 , m_limit ( limit )
184 , m_type ( GaudiMath::Integration:: Other )
185 , m_category ( GaudiMath::Integration:: Infinite )
186 , m_rule ( GaudiMath::Integration:: Fixed )
187 , m_points ( )
188 , m_epsabs ( epsabs )
189 , m_epsrel ( epsrel )
190 , m_result ( GSL_NEGINF )
191 , m_error ( GSL_POSINF )
192 , m_size ( size )
193 , m_argument ( function.dimensionality() )
194 {
195 if ( m_index >= m_DIM )
196 { Exception("::constructor: invalid variable index") ; }
197 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:384
GaudiMath::Integration::Other
Definition: Integration.h:28
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::epsrel
double epsrel() const
relatiove precision
Definition: NumericalIndefiniteIntegral.h:301
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:232
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:368
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit
GaudiMath::Integration::Limit limit() const
integration limit
Definition: NumericalIndefiniteIntegral.h:313
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::size
size_t size() const
Definition: NumericalIndefiniteIntegral.h:309
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::dimensionality
virtual unsigned int dimensionality() const
dimensionality of the problem
Definition: NumericalIndefiniteIntegral.h:277
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:380
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_size
size_t m_size
Definition: NumericalIndefiniteIntegral.h:386
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:367
GaudiMath::Integration::Infinite
Definition: Integration.h:32
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:381
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::epsabs
double epsabs() const
absolute precision
Definition: NumericalIndefiniteIntegral.h:299
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_limit
GaudiMath::Integration::Limit m_limit
Definition: NumericalIndefiniteIntegral.h:372
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalIndefiniteIntegral.h:374
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalIndefiniteIntegral.h:366
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalIndefiniteIntegral.h:373
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:389
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalIndefiniteIntegral.h:375
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:383
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_points
Points m_points
Definition: NumericalIndefiniteIntegral.h:377

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

copy constructor

Definition at line 205 of file NumericalIndefiniteIntegral.cpp.

206 : AbsFunction ()
207 , m_function ( right.m_function->clone() )
208 , m_DIM ( right.m_DIM )
209 , m_index ( right.m_index )
210 , m_a ( right.m_a )
211 , m_limit ( right.m_limit )
212 , m_type ( right.m_type )
213 , m_category ( right.m_category )
214 , m_rule ( right.m_rule )
215 , m_points ( right.m_points )
216 , m_epsabs ( right.m_epsabs )
217 , m_epsrel ( right.m_epsrel )
218 , m_result ( GSL_NEGINF )
219 , m_error ( GSL_POSINF )
220 , m_size ( right.m_size )
221 , m_argument ( right.m_argument )
222 {
223 m_pdata.reset( new double[ 2 + m_points.size() ] ) ;
224 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:384
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_pdata
std::unique_ptr< double[]> m_pdata
Definition: NumericalIndefiniteIntegral.h:378
std::right
T right(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:368
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:380
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_size
size_t m_size
Definition: NumericalIndefiniteIntegral.h:386
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:367
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:381
std::unique_ptr::reset
T reset(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_limit
GaudiMath::Integration::Limit m_limit
Definition: NumericalIndefiniteIntegral.h:372
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalIndefiniteIntegral.h:374
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalIndefiniteIntegral.h:366
std::vector::size
T size(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalIndefiniteIntegral.h:373
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:389
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalIndefiniteIntegral.h:375
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:383
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_points
Points m_points
Definition: NumericalIndefiniteIntegral.h:377

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

destructor

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

## Member Function Documentation

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

integration limit

Definition at line 295 of file NumericalIndefiniteIntegral.h.

295 { return m_a ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:370

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

allocate the integration workspace

Definition at line 332 of file NumericalIndefiniteIntegral.cpp.

333 {
334 if ( !m_ws ) {
335 m_ws.reset( new _Workspace() );
336 m_ws->ws = gsl_integration_workspace_alloc( size () );
337 if ( !m_ws->ws ) { Exception ( "allocate()::invalid workspace" ) ; };
338 }
339 return m_ws.get() ;
340 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_ws
std::unique_ptr< _Workspace, gsl_ws_deleter > m_ws
Definition: NumericalIndefiniteIntegral.h:387
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:232
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::size
size_t size() const
Definition: NumericalIndefiniteIntegral.h:309

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

integration category

Definition at line 319 of file NumericalIndefiniteIntegral.h.

319 { return m_category ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_category
GaudiMath::Integration::Category m_category
Definition: NumericalIndefiniteIntegral.h:374

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

dimensionality of the problem

Definition at line 277 of file NumericalIndefiniteIntegral.h.

277 { return m_DIM ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:367

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

absolute precision

Definition at line 299 of file NumericalIndefiniteIntegral.h.

299 { return m_epsabs ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:380

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

relatiove precision

Definition at line 301 of file NumericalIndefiniteIntegral.h.

301 { return m_epsrel ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:381

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

evaluate of previous error

Definition at line 306 of file NumericalIndefiniteIntegral.h.

306 { return m_error ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:384

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

Definition at line 232 of file NumericalIndefiniteIntegral.cpp.

234 {
235 throw GaudiException( "NumericalIndefiniteIntegral::" + message ,
236 "*GaudiMath*" , sc ) ;
237 return sc ;
238 }
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
merge_files.sc
int sc
Definition: merge_files.py:167

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

accessor to the function itself

Definition at line 293 of file NumericalIndefiniteIntegral.h.

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

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

Does this function have an analytic derivative?

Definition at line 285 of file NumericalIndefiniteIntegral.h.

285 { return true ;}

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

integration limit

Definition at line 313 of file NumericalIndefiniteIntegral.h.

313 { return m_limit ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_limit
GaudiMath::Integration::Limit m_limit
Definition: NumericalIndefiniteIntegral.h:372

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

Function value.

evaluate the function

Definition at line 245 of file NumericalIndefiniteIntegral.cpp.

246 {
247 // reset the result and the error
248 m_result = GSL_NEGINF ;
249 m_error = GSL_POSINF ;
250
251 // check the argument
252 if( 1 != m_DIM ) { Exception ( "operator(): invalid argument size " ) ; };
253
254 m_argument[0] = argument ;
255 return (*this) ( m_argument );
256 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:384
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:232
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:367
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:389
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:383

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

Function value.

evaluate the function

Definition at line 285 of file NumericalIndefiniteIntegral.cpp.

286 {
287 // reset the result and the error
288 m_result = GSL_NEGINF ;
289 m_error = GSL_POSINF ;
290
291 // check the argument
292 if( argument.dimension() != m_DIM )
293 { Exception ( "operator(): invalid argument size " ) ; };
294
295 // copy the argument
296 {for( size_t i = 0 ; i < m_DIM ; ++i ){ m_argument[i] = argument[i];}}
297
298 // create the helper object
299 GSL_Helper helper( *m_function , m_argument , m_index );
300
301 // use GSL to evaluate the numerical derivative
302 gsl_function F ;
303 F.function = &GSL_Adaptor ;
304 F.params = &helper ;
305 _Function F1 ;
306 F1.fn = &F ;
307
308 if ( GaudiMath::Integration::Infinite == category () )
309 { return QAGI ( &F1 ) ; } // RETURN
310 else if ( GaudiMath::Integration::Singular == category () )
311 { return QAGP ( &F1 ) ; } // RETURN
312 else if ( GaudiMath::Integration::Finite == category () )
313 if ( GaudiMath::Integration::NonAdaptive == type () )
314 { return QNG ( &F1 ) ; } // RETURN
315 else if ( GaudiMath::Integration::Adaptive == type () )
316 { return QAG ( &F1 ) ; } // RETURN
317 else if ( GaudiMath::Integration::AdaptiveSingular == type () )
318 { return QAGS ( &F1 ) ; } // RETURN
319 else
320 { Exception ( "::operator(): invalid type " ); }
321 else
322 { Exception ( "::operator(): invalid category " ); }
323
324 return 0 ;
325 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:384
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:232
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::QAGI
double QAGI(_Function *fun) const
Definition: NumericalIndefiniteIntegral.cpp:346
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:368
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:319
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::QAGS
double QAGS(_Function *fun) const
Definition: NumericalIndefiniteIntegral.cpp:517
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_DIM
size_t m_DIM
Definition: NumericalIndefiniteIntegral.h:367
GaudiMath::Integration::Infinite
Definition: Integration.h:32
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::QNG
double QNG(_Function *fun) const
Definition: NumericalIndefiniteIntegral.cpp:437
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:475
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::type
GaudiMath::Integration::Type type() const
integration type
Definition: NumericalIndefiniteIntegral.h:316
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_function
std::unique_ptr< const AbsFunction > m_function
Definition: NumericalIndefiniteIntegral.h:366
GaudiMath::Integration::AdaptiveSingular
Definition: Integration.h:27
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:389
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:383
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::QAGP
double QAGP(_Function *fun) const
Definition: NumericalIndefiniteIntegral.cpp:383
ana.i
list i
Definition: ana.py:128

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

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

Derivatives.

Definition at line 263 of file NumericalIndefiniteIntegral.cpp.

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

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

known singularities

Definition at line 297 of file NumericalIndefiniteIntegral.h.

297 { return m_points ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_points
Points m_points
Definition: NumericalIndefiniteIntegral.h:377

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

Definition at line 475 of file NumericalIndefiniteIntegral.cpp.

476 {
477 if( !F ) { Exception("QAG::invalid function") ; }
478
479 const double x = m_argument[m_index] ;
480 if ( m_a == x )
481 {
482 m_result = 0 ;
483 m_error = 0 ; // EXACT !
484 return m_result ;
485 }
486
487 // allocate workspace
488 allocate () ;
489
490 // integration limits
491 const double a = std::min ( m_a , x ) ;
492 const double b = std::max ( m_a , x ) ;
493
494 int ierror =
495 gsl_integration_qag ( F->fn ,
496 a , b ,
497 m_epsabs , m_epsrel ,
498 size () , (int) rule() , ws ()->ws ,
499 &m_result , &m_error );
500
501 if( ierror ) { gsl_error( "NumericalIndefiniteIntegral::QAG " ,
502 __FILE__ , __LINE__ , ierror ) ; }
503
504 // sign
505 if ( GaudiMath::Integration::VariableHighLimit == limit()
506 && x < m_a ) { m_result *= -1 ; }
507 else if ( GaudiMath::Integration::VariableLowLimit == limit()
508 && x > m_a ) { m_result *= -1 ; }
509
510 return m_result ;
511 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:384
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:232
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:368
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit
GaudiMath::Integration::Limit limit() const
integration limit
Definition: NumericalIndefiniteIntegral.h:313
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::size
size_t size() const
Definition: NumericalIndefiniteIntegral.h:309
std::min
T min(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:380
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::rule
GaudiMath::Integration::KronrodRule rule() const
integration rule
Definition: NumericalIndefiniteIntegral.h:322
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::allocate
_Workspace * allocate() const
allocate the integration workspace
Definition: NumericalIndefiniteIntegral.cpp:332
GaudiMath::Integration::VariableHighLimit
Definition: Integration.h:23
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:381
std::max
T max(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::a
double a() const
integration limit
Definition: NumericalIndefiniteIntegral.h:295
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:389
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:383
GaudiMath::Integration::VariableLowLimit
Definition: Integration.h:22
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::ws
_Workspace * ws() const
Definition: NumericalIndefiniteIntegral.h:340

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

Definition at line 346 of file NumericalIndefiniteIntegral.cpp.

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

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

Definition at line 383 of file NumericalIndefiniteIntegral.cpp.

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

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

Definition at line 517 of file NumericalIndefiniteIntegral.cpp.

518 {
519 if( !F ) { Exception("QAG::invalid function") ; }
520
521 const double x = m_argument[m_index] ;
522 if ( m_a == x )
523 {
524 m_result = 0 ;
525 m_error = 0 ; // EXACT !
526 return m_result ;
527 }
528
529 // allocate workspace
530 allocate () ;
531
532 // integration limits
533 const double a = std::min ( m_a , x ) ;
534 const double b = std::max ( m_a , x ) ;
535
536 int ierror =
537 gsl_integration_qags ( F->fn ,
538 a , b ,
539 m_epsabs , m_epsrel ,
540 size () , ws()->ws ,
541 &m_result , &m_error );
542
543 if( ierror ) { gsl_error( "NumericalIndefiniteIntegral::QAGS " ,
544 __FILE__ , __LINE__ , ierror ) ; }
545
546 // sign
547 if ( GaudiMath::Integration::VariableHighLimit == limit()
548 && x < m_a ) { m_result *= -1 ; }
549 else if ( GaudiMath::Integration::VariableLowLimit == limit()
550 && x > m_a ) { m_result *= -1 ; }
551
552 return m_result ;
553 }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_error
double m_error
Definition: NumericalIndefiniteIntegral.h:384
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::Exception
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
Definition: NumericalIndefiniteIntegral.cpp:232
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_index
size_t m_index
Definition: NumericalIndefiniteIntegral.h:368
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_a
double m_a
Definition: NumericalIndefiniteIntegral.h:370
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::limit
GaudiMath::Integration::Limit limit() const
integration limit
Definition: NumericalIndefiniteIntegral.h:313
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::size
size_t size() const
Definition: NumericalIndefiniteIntegral.h:309
std::min
T min(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsabs
double m_epsabs
Definition: NumericalIndefiniteIntegral.h:380
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::allocate
_Workspace * allocate() const
allocate the integration workspace
Definition: NumericalIndefiniteIntegral.cpp:332
GaudiMath::Integration::VariableHighLimit
Definition: Integration.h:23
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_epsrel
double m_epsrel
Definition: NumericalIndefiniteIntegral.h:381
std::max
T max(T...args)
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::a
double a() const
integration limit
Definition: NumericalIndefiniteIntegral.h:295
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_argument
Argument m_argument
Definition: NumericalIndefiniteIntegral.h:389
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:383
GaudiMath::Integration::VariableLowLimit
Definition: Integration.h:22
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::ws
_Workspace * ws() const
Definition: NumericalIndefiniteIntegral.h:340

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

Definition at line 437 of file NumericalIndefiniteIntegral.cpp.

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

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

previous result

Definition at line 304 of file NumericalIndefiniteIntegral.h.

304 { return m_result ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_result
double m_result
Definition: NumericalIndefiniteIntegral.h:383

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

integration rule

Definition at line 322 of file NumericalIndefiniteIntegral.h.

322 { return m_rule ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_rule
GaudiMath::Integration::KronrodRule m_rule
Definition: NumericalIndefiniteIntegral.h:375

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

Definition at line 309 of file NumericalIndefiniteIntegral.h.

309 { return m_size ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_size
size_t m_size
Definition: NumericalIndefiniteIntegral.h:386

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

integration type

Definition at line 316 of file NumericalIndefiniteIntegral.h.

316 { return m_type ; }
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::m_type
GaudiMath::Integration::Type m_type
Definition: NumericalIndefiniteIntegral.h:373

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

Definition at line 340 of file NumericalIndefiniteIntegral.h.

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

## Member Data Documentation

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

Definition at line 370 of file NumericalIndefiniteIntegral.h.

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

Definition at line 389 of file NumericalIndefiniteIntegral.h.

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

Definition at line 374 of file NumericalIndefiniteIntegral.h.

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

Definition at line 367 of file NumericalIndefiniteIntegral.h.

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

Definition at line 380 of file NumericalIndefiniteIntegral.h.

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

Definition at line 381 of file NumericalIndefiniteIntegral.h.

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

Definition at line 384 of file NumericalIndefiniteIntegral.h.

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

Definition at line 366 of file NumericalIndefiniteIntegral.h.

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

Definition at line 368 of file NumericalIndefiniteIntegral.h.

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

Definition at line 372 of file NumericalIndefiniteIntegral.h.

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

Definition at line 378 of file NumericalIndefiniteIntegral.h.

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

Definition at line 377 of file NumericalIndefiniteIntegral.h.

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

Definition at line 383 of file NumericalIndefiniteIntegral.h.

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

Definition at line 375 of file NumericalIndefiniteIntegral.h.

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

Definition at line 386 of file NumericalIndefiniteIntegral.h.

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

Definition at line 373 of file NumericalIndefiniteIntegral.h.

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

Definition at line 387 of file NumericalIndefiniteIntegral.h.

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

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