Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
IrLgm1fStateProcess Class Reference

Ir Lgm 1f State Process. More...

#include <qle/processes/irlgm1fstateprocess.hpp>

+ Inheritance diagram for IrLgm1fStateProcess:
+ Collaboration diagram for IrLgm1fStateProcess:

Public Member Functions

 IrLgm1fStateProcess (const QuantLib::ext::shared_ptr< IrLgm1fParametrization > &parametrization)
 

StochasticProcess interface

const QuantLib::ext::shared_ptr< IrLgm1fParametrizationp_
 
bool cacheNotReady_d_ = true
 
bool cacheNotReady_v_ = true
 
Size timeStepsToCache_d_ = 0
 
Size timeStepsToCache_v_ = 0
 
Size timeStepCache_d_ = 0
 
Size timeStepCache_v_ = 0
 
std::vector< Real > cache_d_
 
std::vector< Real > cache_v_
 
Real x0 () const override
 
Real drift (Time t, Real x) const override
 
Real diffusion (Time t, Real x) const override
 
Real expectation (Time t0, Real x0, Time dt) const override
 
Real stdDeviation (Time t0, Real x0, Time dt) const override
 
Real variance (Time t0, Real x0, Time dt) const override
 
void resetCache (const Size timeSteps) const
 

Detailed Description

Ir Lgm 1f State Process.

Definition at line 36 of file irlgm1fstateprocess.hpp.

Constructor & Destructor Documentation

◆ IrLgm1fStateProcess()

IrLgm1fStateProcess ( const QuantLib::ext::shared_ptr< IrLgm1fParametrization > &  parametrization)

Definition at line 23 of file irlgm1fstateprocess.cpp.

24 : p_(parametrization) {}
const QuantLib::ext::shared_ptr< IrLgm1fParametrization > p_

Member Function Documentation

◆ x0()

Real x0 ( ) const
override

Definition at line 65 of file irlgm1fstateprocess.hpp.

65{ return 0.0; }
+ Here is the caller graph for this function:

◆ drift()

Real drift ( Time  t,
Real  x 
) const
override

Definition at line 67 of file irlgm1fstateprocess.hpp.

67{ return 0.0; }

◆ diffusion()

Real diffusion ( Time  t,
Real  x 
) const
override

Definition at line 69 of file irlgm1fstateprocess.hpp.

69 {
70 if (cacheNotReady_d_) {
71 Real tmp = p_->alpha(t);
72 if (timeStepsToCache_d_ > 0) {
73 cache_d_.push_back(tmp);
74 if (cache_d_.size() == timeStepsToCache_d_)
75 cacheNotReady_d_ = false;
76 }
77 return tmp;
78 } else {
79 Real tmp = cache_d_[timeStepCache_d_++];
82 return tmp;
83 }
84}

◆ expectation()

Real expectation ( Time  t0,
Real  x0,
Time  dt 
) const
override

Definition at line 86 of file irlgm1fstateprocess.hpp.

86{ return x0; }
+ Here is the call graph for this function:

◆ stdDeviation()

Real stdDeviation ( Time  t0,
Real  x0,
Time  dt 
) const
override

Definition at line 105 of file irlgm1fstateprocess.hpp.

105 {
106 return std::sqrt(variance(t0, x0, dt));
107}
Real variance(Time t0, Real x0, Time dt) const override
+ Here is the call graph for this function:

◆ variance()

Real variance ( Time  t0,
Real  x0,
Time  dt 
) const
override

Definition at line 88 of file irlgm1fstateprocess.hpp.

88 {
89 if (cacheNotReady_v_) {
90 Real tmp = p_->zeta(t0 + dt) - p_->zeta(t0);
91 if (timeStepsToCache_v_ > 0) {
92 cache_v_.push_back(tmp);
93 if (cache_v_.size() == timeStepsToCache_v_)
94 cacheNotReady_v_ = false;
95 }
96 return tmp;
97 } else {
98 Real tmp = cache_v_[timeStepCache_v_++];
101 return tmp;
102 }
103}
+ Here is the caller graph for this function:

◆ resetCache()

void resetCache ( const Size  timeSteps) const

Definition at line 109 of file irlgm1fstateprocess.hpp.

109 {
112 cache_d_.clear();
113 cache_v_.clear();
114 p_->update();
115}

Member Data Documentation

◆ p_

const QuantLib::ext::shared_ptr<IrLgm1fParametrization> p_
private

Definition at line 52 of file irlgm1fstateprocess.hpp.

◆ cacheNotReady_d_

bool cacheNotReady_d_ = true
mutableprivate

Definition at line 53 of file irlgm1fstateprocess.hpp.

◆ cacheNotReady_v_

bool cacheNotReady_v_ = true
mutableprivate

Definition at line 54 of file irlgm1fstateprocess.hpp.

◆ timeStepsToCache_d_

Size timeStepsToCache_d_ = 0
mutableprivate

Definition at line 55 of file irlgm1fstateprocess.hpp.

◆ timeStepsToCache_v_

Size timeStepsToCache_v_ = 0
mutableprivate

Definition at line 56 of file irlgm1fstateprocess.hpp.

◆ timeStepCache_d_

Size timeStepCache_d_ = 0
mutableprivate

Definition at line 57 of file irlgm1fstateprocess.hpp.

◆ timeStepCache_v_

Size timeStepCache_v_ = 0
mutableprivate

Definition at line 58 of file irlgm1fstateprocess.hpp.

◆ cache_d_

std::vector<Real> cache_d_
mutableprivate

Definition at line 59 of file irlgm1fstateprocess.hpp.

◆ cache_v_

std::vector<Real> cache_v_
mutableprivate

Definition at line 60 of file irlgm1fstateprocess.hpp.