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

Ir HW State Process. More...

#include <qle/processes/irhwstateprocess.hpp>

+ Inheritance diagram for IrHwStateProcess:
+ Collaboration diagram for IrHwStateProcess:

Public Member Functions

 IrHwStateProcess (const QuantLib::ext::shared_ptr< IrHwParametrization > &parametrization, const IrModel::Measure measure, const HwModel::Discretization discretization=HwModel::Discretization::Euler, const bool evaluateBankAccount=true)
 
Size size () const override
 
Size factors () const override
 
Array initialValues () const override
 
Array drift (Time t, const Array &s) const override
 
Matrix diffusion (Time t, const Array &s) const override
 

Private Attributes

QuantLib::ext::shared_ptr< IrHwParametrizationparametrization_
 
IrModel::Measure measure_
 
HwModel::Discretization discretization_
 
bool evaluateBankAccount_
 

Detailed Description

Ir HW State Process.

Definition at line 38 of file irhwstateprocess.hpp.

Constructor & Destructor Documentation

◆ IrHwStateProcess()

IrHwStateProcess ( const QuantLib::ext::shared_ptr< IrHwParametrization > &  parametrization,
const IrModel::Measure  measure,
const HwModel::Discretization  discretization = HwModel::Discretization::Euler,
const bool  evaluateBankAccount = true 
)

Definition at line 40 of file irhwstateprocess.hpp.

43 : StochasticProcess(discretization == HwModel::Discretization::Euler ? QuantLib::ext::make_shared<EulerDiscretization>()
44 : nullptr),
45 parametrization_(parametrization), measure_(measure), discretization_(discretization),
46 evaluateBankAccount_(evaluateBankAccount) {
47 QL_REQUIRE(measure_ == IrModel::Measure::BA, "IrHwStateProcess only supports measure BA");
49 "IrHwStateProcess only supports dicsretization Euler");
50 }
HwModel::Discretization discretization_
QuantLib::ext::shared_ptr< IrHwParametrization > parametrization_

Member Function Documentation

◆ size()

Size size ( ) const
override

Definition at line 51 of file irhwstateprocess.hpp.

51 {
52 return parametrization_->n() +
54 }
+ Here is the caller graph for this function:

◆ factors()

Size factors ( ) const
override

Definition at line 55 of file irhwstateprocess.hpp.

+ Here is the caller graph for this function:

◆ initialValues()

Array initialValues ( ) const
override

Definition at line 23 of file irhwstateprocess.cpp.

23{ return Array(size(), 0.0); }
Size size() const override
+ Here is the call graph for this function:

◆ drift()

Array drift ( Time  t,
const Array &  s 
) const
override

Definition at line 25 of file irhwstateprocess.cpp.

25 {
26 Array ones(parametrization_->n(), 1.0);
27 Array x(s.begin(), std::next(s.begin(), parametrization_->n()));
28 Array drift_x = parametrization_->y(t) * ones - parametrization_->kappa(t) * x;
30 return drift_x;
31 Array drift_int_x = x;
32 Array result(2 * parametrization_->n());
33 std::copy(drift_x.begin(), drift_x.end(), result.begin());
34 std::copy(drift_int_x.begin(), drift_int_x.end(), std::next(result.begin(), parametrization_->n()));
35 return result;
36}

◆ diffusion()

Matrix diffusion ( Time  t,
const Array &  s 
) const
override

Definition at line 38 of file irhwstateprocess.cpp.

38 {
39 Matrix res(size(), factors(), 0.0);
40 for (Size i = 0; i < parametrization_->n(); ++i) {
41 for (Size j = 0; j < res.columns(); ++j) {
42 res(i, j) = parametrization_->sigma_x(t)(j, i);
43 }
44 }
45 // the rest of the diffusion rows (if present for the aux state) is zero
46 return res;
47}
Size factors() const override
+ Here is the call graph for this function:

Member Data Documentation

◆ parametrization_

QuantLib::ext::shared_ptr<IrHwParametrization> parametrization_
private

Definition at line 66 of file irhwstateprocess.hpp.

◆ measure_

IrModel::Measure measure_
private

Definition at line 67 of file irhwstateprocess.hpp.

◆ discretization_

HwModel::Discretization discretization_
private

Definition at line 68 of file irhwstateprocess.hpp.

◆ evaluateBankAccount_

bool evaluateBankAccount_
private

Definition at line 69 of file irhwstateprocess.hpp.