QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
GaussLobattoIntegral Class Reference

Integral of a one-dimensional function. More...

#include <ql/math/integrals/gausslobattointegral.hpp>

+ Inheritance diagram for GaussLobattoIntegral:
+ Collaboration diagram for GaussLobattoIntegral:

Public Member Functions

 GaussLobattoIntegral (Size maxIterations, Real absAccuracy, Real relAccuracy=Null< Real >(), bool useConvergenceEstimate=true)
 
- Public Member Functions inherited from Integrator
 Integrator (Real absoluteAccuracy, Size maxEvaluations)
 
virtual ~Integrator ()=default
 
Real operator() (const ext::function< Real(Real)> &f, Real a, Real b) const
 
void setAbsoluteAccuracy (Real)
 
void setMaxEvaluations (Size)
 
Real absoluteAccuracy () const
 
Size maxEvaluations () const
 
Real absoluteError () const
 
Size numberOfEvaluations () const
 
virtual bool integrationSuccess () const
 

Protected Member Functions

Real integrate (const ext::function< Real(Real)> &f, Real a, Real b) const override
 
Real adaptivGaussLobattoStep (const ext::function< Real(Real)> &f, Real a, Real b, Real fa, Real fb, Real is) const
 
Real calculateAbsTolerance (const ext::function< Real(Real)> &f, Real a, Real b) const
 
- Protected Member Functions inherited from Integrator
void setAbsoluteError (Real error) const
 
void setNumberOfEvaluations (Size evaluations) const
 
void increaseNumberOfEvaluations (Size increase) const
 

Protected Attributes

Real relAccuracy_
 
const bool useConvergenceEstimate_
 

Static Protected Attributes

static const Real alpha_ = std::sqrt(2.0/3.0)
 
static const Real beta_ = 1.0/std::sqrt(5.0)
 
static const Real x1_ = 0.94288241569547971906
 
static const Real x2_ = 0.64185334234578130578
 
static const Real x3_ = 0.23638319966214988028
 

Detailed Description

Integral of a one-dimensional function.

Given a target accuracy \( \epsilon \), the integral of a function \( f \) between \( a \) and \( b \) is calculated by means of the Gauss-Lobatto formula

References: This algorithm is a C++ implementation of the algorithm outlined in

W. Gander and W. Gautschi, Adaptive Quadrature - Revisited. BIT, 40(1):84-101, March 2000. CS technical report: ftp.inf.ethz.ch/pub/publications/tech-reports/3xx/306.ps.gz

The original MATLAB version can be downloaded here http://www.inf.ethz.ch/personal/gander/adaptlob.m

Definition at line 51 of file gausslobattointegral.hpp.

Constructor & Destructor Documentation

◆ GaussLobattoIntegral()

GaussLobattoIntegral ( Size  maxIterations,
Real  absAccuracy,
Real  relAccuracy = Null<Real>(),
bool  useConvergenceEstimate = true 
)

Definition at line 36 of file gausslobattointegral.cpp.

Member Function Documentation

◆ integrate()

Real integrate ( const ext::function< Real(Real)> &  f,
Real  a,
Real  b 
) const
overrideprotectedvirtual

Implements Integrator.

Definition at line 45 of file gausslobattointegral.cpp.

+ Here is the call graph for this function:

◆ adaptivGaussLobattoStep()

Real adaptivGaussLobattoStep ( const ext::function< Real(Real)> &  f,
Real  a,
Real  b,
Real  fa,
Real  fb,
Real  is 
) const
protected

Definition at line 114 of file gausslobattointegral.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateAbsTolerance()

Real calculateAbsTolerance ( const ext::function< Real(Real)> &  f,
Real  a,
Real  b 
) const
protected

Definition at line 56 of file gausslobattointegral.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ relAccuracy_

Real relAccuracy_
protected

Definition at line 67 of file gausslobattointegral.hpp.

◆ useConvergenceEstimate_

const bool useConvergenceEstimate_
protected

Definition at line 68 of file gausslobattointegral.hpp.

◆ alpha_

const Real alpha_ = std::sqrt(2.0/3.0)
staticprotected

Definition at line 69 of file gausslobattointegral.hpp.

◆ beta_

const Real beta_ = 1.0/std::sqrt(5.0)
staticprotected

Definition at line 69 of file gausslobattointegral.hpp.

◆ x1_

const Real x1_ = 0.94288241569547971906
staticprotected

Definition at line 69 of file gausslobattointegral.hpp.

◆ x2_

const Real x2_ = 0.64185334234578130578
staticprotected

Definition at line 69 of file gausslobattointegral.hpp.

◆ x3_

const Real x3_ = 0.23638319966214988028
staticprotected

Definition at line 69 of file gausslobattointegral.hpp.