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

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

#include <ql/experimental/math/multidimintegrator.hpp>

+ Inheritance diagram for MultidimIntegral:
+ Collaboration diagram for MultidimIntegral:

Public Member Functions

 MultidimIntegral (const std::vector< ext::shared_ptr< Integrator > > &integrators)
 
Real operator() (const ext::function< Real(const std::vector< Real > &)> &f, const std::vector< Real > &a, const std::vector< Real > &b) const
 

Private Member Functions

template<Size depth>
void spawnFcts () const
 
template<int T_N>
Real vectorBinder (const ext::function< Real(const std::vector< Real > &)> &f, Real z, const std::vector< Real > &a, const std::vector< Real > &b) const
 
template<int nT>
Real integrate (const ext::function< Real(const std::vector< Real > &)> &f, const std::vector< Real > &a, const std::vector< Real > &b) const
 
template<>
Real vectorBinder (const ext::function< Real(const std::vector< Real > &)> &f, Real z, const std::vector< Real > &a, const std::vector< Real > &b) const
 
template<>
void spawnFcts () const
 

Private Attributes

const std::vector< ext::shared_ptr< Integrator > > integrators_
 
std::vector< ext::function< Real(const ext::function< Real(const std::vector< Real > &)> &, const std::vector< Real > &, const std::vector< Real > &) > > integrationLevelEntries_
 
std::vector< RealvarBuffer_
 

Static Private Attributes

static const Size maxDimensions_ = 15
 

Detailed Description

Integrates a vector or scalar function of vector domain.

Uses a collection of arbitrary 1D integrators along each of the dimensions. A template recursion along dimensions avoids calling depth test or virtual functions.

This class generalizes to an arbitrary number of dimensions the functionality in class TwoDimensionalIntegral
Examples
MultidimIntegral.cpp.

Definition at line 39 of file multidimintegrator.hpp.

Constructor & Destructor Documentation

◆ MultidimIntegral()

MultidimIntegral ( const std::vector< ext::shared_ptr< Integrator > > &  integrators)
explicit

Definition at line 24 of file multidimintegrator.cpp.

Member Function Documentation

◆ operator()()

Real operator() ( const ext::function< Real(const std::vector< Real > &)> &  f,
const std::vector< Real > &  a,
const std::vector< Real > &  b 
) const

f is the integrand function; a and b are the lower and upper integration limit domain for each dimension.

Definition at line 48 of file multidimintegrator.hpp.

+ Here is the caller graph for this function:

◆ spawnFcts() [1/2]

void spawnFcts
private

Definition at line 157 of file multidimintegrator.hpp.

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

◆ vectorBinder() [1/2]

Real vectorBinder ( const ext::function< Real(const std::vector< Real > &)> &  f,
Real  z,
const std::vector< Real > &  a,
const std::vector< Real > &  b 
) const
private

Definition at line 146 of file multidimintegrator.hpp.

+ Here is the call graph for this function:

◆ integrate()

Real integrate ( const ext::function< Real(const std::vector< Real > &)> &  f,
const std::vector< Real > &  a,
const std::vector< Real > &  b 
) const
private

Definition at line 134 of file multidimintegrator.hpp.

+ Here is the caller graph for this function:

◆ vectorBinder() [2/2]

Real vectorBinder ( const ext::function< Real(const std::vector< Real > &)> &  f,
Real  z,
const std::vector< Real > &  a,
const std::vector< Real > &  b 
) const
private

Definition at line 116 of file multidimintegrator.hpp.

◆ spawnFcts() [2/2]

void spawnFcts ( ) const
private

Definition at line 127 of file multidimintegrator.hpp.

Member Data Documentation

◆ maxDimensions_

const Size maxDimensions_ = 15
staticprivate

Definition at line 60 of file multidimintegrator.hpp.

◆ integrators_

const std::vector<ext::shared_ptr<Integrator> > integrators_
private

Definition at line 85 of file multidimintegrator.hpp.

◆ integrationLevelEntries_

std::vector<ext::function<Real ( const ext::function<Real (const std::vector<Real>&)>&, const std::vector<Real>&, const std::vector<Real>&) > > integrationLevelEntries_
mutableprivate

Definition at line 105 of file multidimintegrator.hpp.

◆ varBuffer_

std::vector<Real> varBuffer_
mutableprivate

Definition at line 110 of file multidimintegrator.hpp.