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 | Private Member Functions | Private Attributes | List of all members
LocalVolRNDCalculator Class Reference

#include <ql/methods/finitedifferences/utilities/localvolrndcalculator.hpp>

+ Inheritance diagram for LocalVolRNDCalculator:
+ Collaboration diagram for LocalVolRNDCalculator:

Public Member Functions

 LocalVolRNDCalculator (ext::shared_ptr< Quote > spot, ext::shared_ptr< YieldTermStructure > rTS, ext::shared_ptr< YieldTermStructure > qTS, const ext::shared_ptr< LocalVolTermStructure > &localVol, Size xGrid=101, Size tGrid=51, Real x0Density=0.1, Real localVolProbEps=1e-6, Size maxIter=10000, Time gaussianStepSize=-Null< Time >())
 
 LocalVolRNDCalculator (ext::shared_ptr< Quote > spot, ext::shared_ptr< YieldTermStructure > rTS, ext::shared_ptr< YieldTermStructure > qTS, ext::shared_ptr< LocalVolTermStructure > localVol, const ext::shared_ptr< TimeGrid > &timeGrid, Size xGrid=101, Real x0Density=0.1, Real eps=1e-6, Size maxIter=10000, Time gaussianStepSize=-Null< Time >())
 
Real pdf (Real x, Time t) const override
 
Real cdf (Real x, Time t) const override
 
Real invcdf (Real p, Time t) const override
 
ext::shared_ptr< TimeGridtimeGrid () const
 
ext::shared_ptr< Fdm1dMeshermesher (Time t) const
 
std::vector< SizerescaleTimeSteps () const
 
- Public Member Functions inherited from RiskNeutralDensityCalculator
virtual Real pdf (Real x, Time t) const =0
 
virtual Real cdf (Real x, Time t) const =0
 
virtual Real invcdf (Real p, Time t) const =0
 
virtual ~RiskNeutralDensityCalculator ()=default
 
- Public Member Functions inherited from LazyObject
 LazyObject ()
 
 ~LazyObject () override=default
 
void update () override
 
bool isCalculated () const
 
void forwardFirstNotificationOnly ()
 
void alwaysForwardNotifications ()
 
void recalculate ()
 
void freeze ()
 
void unfreeze ()
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 

Protected Member Functions

void performCalculations () const override
 
- Protected Member Functions inherited from LazyObject
virtual void calculate () const
 

Private Member Functions

Real probabilityInterpolation (Size idx, Real x) const
 
Array rescalePDF (const Array &x, const Array &p) const
 

Private Attributes

const Size xGrid_
 
const Size tGrid_
 
const Real x0Density_
 
const Real localVolProbEps_
 
const Size maxIter_
 
const Time gaussianStepSize_
 
const ext::shared_ptr< Quotespot_
 
const ext::shared_ptr< LocalVolTermStructurelocalVol_
 
const ext::shared_ptr< YieldTermStructurerTS_
 
const ext::shared_ptr< YieldTermStructureqTS_
 
const ext::shared_ptr< TimeGridtimeGrid_
 
std::vector< ext::shared_ptr< Fdm1dMesher > > xm_
 
const ext::shared_ptr< Matrixpm_
 
std::vector< SizerescaleTimeSteps_
 
std::vector< ext::shared_ptr< Interpolation > > pFct_
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Attributes inherited from LazyObject
bool calculated_ = false
 
bool frozen_ = false
 
bool alwaysForward_
 

Detailed Description

Definition at line 43 of file localvolrndcalculator.hpp.

Constructor & Destructor Documentation

◆ LocalVolRNDCalculator() [1/2]

LocalVolRNDCalculator ( ext::shared_ptr< Quote spot,
ext::shared_ptr< YieldTermStructure rTS,
ext::shared_ptr< YieldTermStructure qTS,
const ext::shared_ptr< LocalVolTermStructure > &  localVol,
Size  xGrid = 101,
Size  tGrid = 51,
Real  x0Density = 0.1,
Real  localVolProbEps = 1e-6,
Size  maxIter = 10000,
Time  gaussianStepSize = -Null<Time>() 
)

Definition at line 43 of file localvolrndcalculator.cpp.

+ Here is the call graph for this function:

◆ LocalVolRNDCalculator() [2/2]

LocalVolRNDCalculator ( ext::shared_ptr< Quote spot,
ext::shared_ptr< YieldTermStructure rTS,
ext::shared_ptr< YieldTermStructure qTS,
ext::shared_ptr< LocalVolTermStructure localVol,
const ext::shared_ptr< TimeGrid > &  timeGrid,
Size  xGrid = 101,
Real  x0Density = 0.1,
Real  eps = 1e-6,
Size  maxIter = 10000,
Time  gaussianStepSize = -Null<Time>() 
)

Definition at line 65 of file localvolrndcalculator.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ pdf()

Real pdf ( Real  x,
Time  t 
) const
overridevirtual

Implements RiskNeutralDensityCalculator.

Definition at line 85 of file localvolrndcalculator.cpp.

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

◆ cdf()

Real cdf ( Real  x,
Time  t 
) const
overridevirtual

Implements RiskNeutralDensityCalculator.

Definition at line 127 of file localvolrndcalculator.cpp.

+ Here is the call graph for this function:

◆ invcdf()

Real invcdf ( Real  p,
Time  t 
) const
overridevirtual

Implements RiskNeutralDensityCalculator.

Definition at line 168 of file localvolrndcalculator.cpp.

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

◆ timeGrid()

ext::shared_ptr< TimeGrid > timeGrid ( ) const

Definition at line 212 of file localvolrndcalculator.cpp.

◆ mesher()

ext::shared_ptr< Fdm1dMesher > mesher ( Time  t) const

Definition at line 197 of file localvolrndcalculator.cpp.

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

◆ rescaleTimeSteps()

std::vector< Size > rescaleTimeSteps ( ) const

Definition at line 334 of file localvolrndcalculator.cpp.

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

◆ performCalculations()

void performCalculations ( ) const
overrideprotectedvirtual

This method must implement any calculations which must be (re)done in order to calculate the desired results.

Implements LazyObject.

Definition at line 216 of file localvolrndcalculator.cpp.

+ Here is the call graph for this function:

◆ probabilityInterpolation()

Real probabilityInterpolation ( Size  idx,
Real  x 
) const
private

Definition at line 340 of file localvolrndcalculator.cpp.

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

◆ rescalePDF()

Array rescalePDF ( const Array x,
const Array p 
) const
private

Definition at line 351 of file localvolrndcalculator.cpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ xGrid_

const Size xGrid_
private

Definition at line 84 of file localvolrndcalculator.hpp.

◆ tGrid_

const Size tGrid_
private

Definition at line 84 of file localvolrndcalculator.hpp.

◆ x0Density_

const Real x0Density_
private

Definition at line 85 of file localvolrndcalculator.hpp.

◆ localVolProbEps_

const Real localVolProbEps_
private

Definition at line 86 of file localvolrndcalculator.hpp.

◆ maxIter_

const Size maxIter_
private

Definition at line 87 of file localvolrndcalculator.hpp.

◆ gaussianStepSize_

const Time gaussianStepSize_
private

Definition at line 88 of file localvolrndcalculator.hpp.

◆ spot_

const ext::shared_ptr<Quote> spot_
private

Definition at line 89 of file localvolrndcalculator.hpp.

◆ localVol_

const ext::shared_ptr<LocalVolTermStructure> localVol_
private

Definition at line 90 of file localvolrndcalculator.hpp.

◆ rTS_

const ext::shared_ptr<YieldTermStructure> rTS_
private

Definition at line 91 of file localvolrndcalculator.hpp.

◆ qTS_

const ext::shared_ptr<YieldTermStructure> qTS_
private

Definition at line 92 of file localvolrndcalculator.hpp.

◆ timeGrid_

const ext::shared_ptr<TimeGrid> timeGrid_
private

Definition at line 93 of file localvolrndcalculator.hpp.

◆ xm_

std::vector<ext::shared_ptr<Fdm1dMesher> > xm_
mutableprivate

Definition at line 94 of file localvolrndcalculator.hpp.

◆ pm_

const ext::shared_ptr<Matrix> pm_
private

Definition at line 95 of file localvolrndcalculator.hpp.

◆ rescaleTimeSteps_

std::vector<Size> rescaleTimeSteps_
mutableprivate

Definition at line 96 of file localvolrndcalculator.hpp.

◆ pFct_

std::vector<ext::shared_ptr<Interpolation> > pFct_
mutableprivate

Definition at line 97 of file localvolrndcalculator.hpp.