11 #include "gsl/gsl_errno.h" 12 #include "gsl/gsl_integration.h" 38 #pragma warning(disable:1572) 44 #pragma warning(disable:4996) 49 namespace GaudiMathImplementation
53 { gsl_function*
fn ; };
74 (
const AbsFunction&
function ,
102 {
Exception(
"::constructor: invalid variable index") ; }
117 (
const AbsFunction&
function ,
122 const double epsabs ,
123 const double epsrel ,
131 ,
m_type ( GaudiMath::Integration:: Other )
133 ,
m_rule ( GaudiMath::Integration:: Fixed )
142 {
Exception(
"::constructor: invalid variable index") ; }
159 (
const AbsFunction&
function ,
162 const double epsabs ,
163 const double epsrel ,
171 ,
m_type ( GaudiMath::Integration:: Other )
173 ,
m_rule ( GaudiMath::Integration:: Fixed )
180 {
Exception(
"::constructor: invalid variable index") ; }
217 "*GaudiMath*" , sc ) ;
225 double NumericalIndefiniteIntegral::operator()
226 (
const double argument )
const 233 if( 1 !=
m_DIM ) {
Exception (
"operator(): invalid argument size " ) ; };
246 if ( idx >=
m_DIM ) {
247 Exception (
"::partial(i): invalid variable index " ) ;
251 return Genfun::FunctionNoop( &aux ) ;
253 const AbsFunction& aux = -1 *
function() ;
254 return Genfun::FunctionNoop( &aux ) ;
256 const AbsFunction& aux =
function() ;
257 return Genfun::FunctionNoop( &aux ) ;
270 if( argument.dimension() !=
m_DIM ) {
271 Exception (
"operator(): invalid argument size " ) ;
295 default:
Exception (
"::operator(): invalid type " );
298 default :
Exception (
"::operator(): invalid category " );
312 m_ws->ws = gsl_integration_workspace_alloc( size () );
313 if ( !
m_ws->ws ) {
Exception (
"allocate()::invalid workspace" ) ; };
325 if( !F ) {
Exception(
"::QAGI: invalid function"); }
335 ierror = gsl_integration_qagiu ( F->
fn , x ,
340 ierror = gsl_integration_qagil ( F->
fn , x ,
348 if( ierror ) { gsl_error(
"NumericalIndefiniteIntegral::QAGI" ,
349 __FILE__ , __LINE__ , ierror ) ;}
360 if( !F ) {
Exception(
"QAGP::invalid function") ; }
381 if ( *lower != limits.first ) { pnts.
insert( pnts.
begin () , limits.first ) ; }
382 if ( *upper != limits.second ) { pnts.
insert( pnts.
end () , limits.second ) ; }
385 int ierror = gsl_integration_qagp( F->
fn ,
391 if( ierror ) { gsl_error(
"NumericalIndefiniteIntegral::QAGI " ,
392 __FILE__ , __LINE__ , ierror ) ; }
409 if( !F ) {
Exception(
"QNG::invalid function") ; }
424 gsl_integration_qng ( F->
fn ,
429 if( ierror ) { gsl_error(
"NumericalIndefiniteIntegral::QNG " ,
430 __FILE__ , __LINE__ , ierror ) ; }
446 if( !F ) {
Exception(
"QAG::invalid function") ; }
463 gsl_integration_qag ( F->
fn ,
464 limits.first, limits.second,
466 size () , (
int)
rule() ,
ws ()->
ws ,
469 if( ierror ) { gsl_error(
"NumericalIndefiniteIntegral::QAG " ,
470 __FILE__ , __LINE__ , ierror ) ; }
487 if( !F ) {
Exception(
"QAG::invalid function") ; }
503 gsl_integration_qags ( F->
fn ,
504 limits.first, limits.second,
509 if( ierror ) { gsl_error(
"NumericalIndefiniteIntegral::QAGS " ,
510 __FILE__ , __LINE__ , ierror ) ; }
std::unique_ptr< _Workspace, gsl_ws_deleter > m_ws
Genfun::Derivative partial(unsigned int index) const override
Derivatives.
Define general base for Gaudi exception.
double epsrel() const
relatiove precision
StatusCode Exception(const std::string &message, const StatusCode &sc=StatusCode::FAILURE) const
double QAGI(_Function *fun) const
GaudiMath::Integration::Limit limit() const
integration limit
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
gsl_integration_workspace * ws
GaudiMath::Integration::Category category() const
integration category
auto begin(reverse_wrapper< T > &w)
double QAGS(_Function *fun) const
GaudiMath::Integration::KronrodRule rule() const
integration rule
This class is used for returning status codes from appropriate routines.
_Workspace * allocate() const
allocate the integration workspace
double operator()(double argument) const override
Function value.
Type
type of integration (for finite limits)
double QNG(_Function *fun) const
auto end(reverse_wrapper< T > &w)
double epsabs() const
absolute precision
double GSL_Adaptor(double x, void *params)
double QAG(_Function *fun) const
Numerical derivative (using GSL adaptive numerical differentiation)
GaudiMath::Integration::Limit m_limit
GaudiMath::Integration::Category m_category
unsigned int dimensionality() const override
dimensionality of the problem
GaudiMath::Integration::Type type() const
integration type
std::unique_ptr< const AbsFunction > m_function
double a() const
integration limit
T back_inserter(T...args)
GaudiMath::Integration::Type m_type
Limit
how to distinguish variable low and variable high limits
KronrodRule
integration rule
GaudiMath::Integration::KronrodRule m_rule
double QAGP(_Function *fun) const
the simple structure to be used for adaption interface Genfun::AbsFunction to gsl_function structure ...
NumericalIndefiniteIntegral()
The simple class for numerical integrations.
const Points & points() const
known singularities