QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Member Functions | Static Private Attributes | List of all members
GaussianQuadMultidimIntegrator Class Reference

Integrates a vector or scalar function of vector domain. More...

#include <multidimquadrature.hpp>

+ Inheritance diagram for GaussianQuadMultidimIntegrator:
+ Collaboration diagram for GaussianQuadMultidimIntegrator:

Classes

class  VectorIntegrator
 

Public Member Functions

 GaussianQuadMultidimIntegrator (Size dimension, Size quadOrder, Real mu=0.)
 
Size order () const
 Integration quadrature order. More...
 
template<class RetType_T >
RetType_T operator() (const ext::function< RetType_T(const std::vector< Real > &arg)> &f) const
 Integrates function f over \( R^{dim} \). More...
 
template<class RetType_T >
RetType_T integrate (const ext::function< RetType_T(const std::vector< Real > &v1)> &f) const
 
template<>
Real operator() (const ext::function< Real(const std::vector< Real > &v1)> &f) const
 
template<>
Real integrate (const ext::function< Real(const std::vector< Real > &v1)> &f) const
 

Private Member Functions

template<>
Real scalarIntegrator (const ext::function< Real(const std::vector< Real > &arg1)> &f, const Real mFctr) const
 Terminal integrand; scalar function version. More...
 
template<>
std::vector< RealvectorIntegratorVR (const ext::function< std::vector< Real >(const std::vector< Real > &arg1)> &f, const Real mFctr) const
 Terminal integrand; vector function version. More...
 
template<>
void spawnFcts () const
 Terminal level: More...
 

Static Private Attributes

static const Size maxDimensions_ = 15
 

Integration entry points generation

GaussHermiteIntegration integral_
 The actual integrators. More...
 
VectorIntegrator integralV_
 
std::vector< ext::function< Real(ext::function< Real(const std::vector< Real > &varg2)> f1, const Real r3)> > integrationEntries_
 Buffer to allow acces to integrations. We do not know at which. More...
 
std::vector< ext::function< std::vector< Real >(const ext::function< std::vector< Real >(const std::vector< Real > &vvarg2)> &vf1, const Real vr3)> integrationEntriesVR_
 
Size dimension_
 
std::vector< RealvarBuffer_
 
template<Size levelSpawn>
void spawnFcts () const
 Recursive template methods to statically generate (at this. More...
 
template<int intgDepth>
Real scalarIntegrator (const ext::function< Real(const std::vector< Real > &arg1)> &f, const Real mFctr) const
 
template<int intgDepth>
std::vector< RealvectorIntegratorVR (const ext::function< std::vector< Real >(const std::vector< Real > &arg1)> &f, const Real mFctr) const
 

Detailed Description

Integrates a vector or scalar function of vector domain.

A template recursion along dimensions avoids calling depth test or virtual functions.

Examples
MultidimIntegral.cpp.

Definition at line 48 of file multidimquadrature.hpp.

Constructor & Destructor Documentation

◆ GaussianQuadMultidimIntegrator()

GaussianQuadMultidimIntegrator ( Size  dimension,
Size  quadOrder,
Real  mu = 0. 
)
Parameters
dimensionThe number of dimensions of the argument of the function we want to integrate.
quadOrderQuadrature order.
muParameter in the Gauss Hermite weight (i.e. points load).

Definition at line 26 of file multidimquadrature.cpp.

Member Function Documentation

◆ order()

Size order ( ) const

Integration quadrature order.

Definition at line 87 of file multidimquadrature.hpp.

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

◆ operator()() [1/2]

RetType_T operator() ( const ext::function< RetType_T(const std::vector< Real > &arg)> &  f) const

Integrates function f over \( R^{dim} \).

Definition at line 99 of file multidimquadrature.hpp.

◆ integrate() [1/2]

RetType_T integrate ( const ext::function< RetType_T(const std::vector< Real > &v1)> &  f) const

◆ spawnFcts() [1/2]

void spawnFcts ( ) const
private

Recursive template methods to statically generate (at this.

Definition at line 129 of file multidimquadrature.hpp.

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

◆ scalarIntegrator() [1/2]

Real scalarIntegrator ( const ext::function< Real(const std::vector< Real > &arg1)> &  f,
const Real  mFctr 
) const
private

Definition at line 145 of file multidimquadrature.hpp.

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

◆ vectorIntegratorVR() [1/2]

std::vector< Real > vectorIntegratorVR ( const ext::function< std::vector< Real >(const std::vector< Real > &arg1)> &  f,
const Real  mFctr 
) const
private

Definition at line 154 of file multidimquadrature.hpp.

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

◆ operator()() [2/2]

Real operator() ( const ext::function< Real(const std::vector< Real > &v1)> &  f) const

Definition at line 189 of file multidimquadrature.hpp.

◆ integrate() [2/2]

Real integrate ( const ext::function< Real(const std::vector< Real > &v1)> &  f) const

Definition at line 198 of file multidimquadrature.hpp.

◆ scalarIntegrator() [2/2]

Real scalarIntegrator ( const ext::function< Real(const std::vector< Real > &arg1)> &  f,
const Real  mFctr 
) const
private

Terminal integrand; scalar function version.

Definition at line 218 of file multidimquadrature.hpp.

◆ vectorIntegratorVR() [2/2]

std::vector< Real > vectorIntegratorVR ( const ext::function< std::vector< Real >(const std::vector< Real > &arg1)> &  f,
const Real  mFctr 
) const
private

Terminal integrand; vector function version.

Definition at line 218 of file multidimquadrature.hpp.

◆ spawnFcts() [2/2]

void spawnFcts ( ) const
private

Terminal level:

Definition at line 239 of file multidimquadrature.hpp.

Member Data Documentation

◆ maxDimensions_

const Size maxDimensions_ = 15
staticprivate

Definition at line 122 of file multidimquadrature.hpp.

◆ integral_

GaussHermiteIntegration integral_
private

The actual integrators.

Definition at line 165 of file multidimquadrature.hpp.

◆ integralV_

VectorIntegrator integralV_
private

Definition at line 166 of file multidimquadrature.hpp.

◆ integrationEntries_

std::vector< ext::function<Real (ext::function<Real ( const std::vector<Real>& varg2)> f1, const Real r3)> > integrationEntries_
mutableprivate

Buffer to allow acces to integrations. We do not know at which.

Definition at line 174 of file multidimquadrature.hpp.

◆ integrationEntriesVR_

std::vector< ext::function<std::vector<Real>(const ext::function<std::vector<Real>( const std::vector<Real>& vvarg2)>& vf1, const Real vr3)> integrationEntriesVR_
mutableprivate

Definition at line 178 of file multidimquadrature.hpp.

◆ dimension_

Size dimension_
private

Definition at line 180 of file multidimquadrature.hpp.

◆ varBuffer_

std::vector<Real> varBuffer_
mutableprivate

Definition at line 182 of file multidimquadrature.hpp.