QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
TreeLattice2D< Impl, T > Class Template Reference

Two-dimensional tree-based lattice. More...

#include <lattice2d.hpp>

+ Inheritance diagram for TreeLattice2D< Impl, T >:
+ Collaboration diagram for TreeLattice2D< Impl, T >:

Public Member Functions

 TreeLattice2D (const ext::shared_ptr< T > &tree1, ext::shared_ptr< T > tree2, Real correlation)
 
Size size (Size i) const
 
Size descendant (Size i, Size index, Size branch) const
 
Real probability (Size i, Size index, Size branch) const
 
- Public Member Functions inherited from TreeLattice< Impl >
 TreeLattice (const TimeGrid &timeGrid, Size n)
 
void initialize (DiscretizedAsset &, Time t) const override
 initialize an asset at the given time. More...
 
void rollback (DiscretizedAsset &, Time to) const override
 
void partialRollback (DiscretizedAsset &, Time to) const override
 
Real presentValue (DiscretizedAsset &) const override
 Computes the present value of an asset using Arrow-Debrew prices. More...
 
const ArraystatePrices (Size i) const
 
void stepback (Size i, const Array &values, Array &newValues) const
 
- Public Member Functions inherited from Lattice
 Lattice (TimeGrid timeGrid)
 
virtual ~Lattice ()=default
 
const TimeGridtimeGrid () const
 

Protected Member Functions

Array grid (Time) const override
 
- Protected Member Functions inherited from TreeLattice< Impl >
void computeStatePrices (Size until) const
 
- Protected Member Functions inherited from CuriouslyRecurringTemplate< Impl >
 CuriouslyRecurringTemplate ()=default
 
 ~CuriouslyRecurringTemplate ()=default
 
Impl & impl ()
 
const Impl & impl () const
 

Protected Attributes

ext::shared_ptr< Ttree1_
 
ext::shared_ptr< Ttree2_
 
- Protected Attributes inherited from TreeLattice< Impl >
std::vector< ArraystatePrices_
 
- Protected Attributes inherited from Lattice
TimeGrid t_
 

Private Attributes

Matrix m_
 
Real rho_
 

Detailed Description

template<class Impl, class T = TrinomialTree>
class QuantLib::TreeLattice2D< Impl, T >

Two-dimensional tree-based lattice.

This lattice is based on two trinomial trees and primarily used for the G2 short-rate model.

Definition at line 42 of file lattice2d.hpp.

Constructor & Destructor Documentation

◆ TreeLattice2D()

TreeLattice2D ( const ext::shared_ptr< T > &  tree1,
ext::shared_ptr< T tree2,
Real  correlation 
)

Definition at line 71 of file lattice2d.hpp.

Member Function Documentation

◆ size()

Size size ( Size  i) const

Definition at line 63 of file lattice2d.hpp.

◆ descendant()

Size descendant ( Size  i,
Size  index,
Size  branch 
) const

Definition at line 103 of file lattice2d.hpp.

◆ probability()

Real probability ( Size  i,
Size  index,
Size  branch 
) const

Definition at line 118 of file lattice2d.hpp.

◆ grid()

Array grid ( Time  ) const
overrideprotectedvirtual

Implements Lattice.

Definition at line 52 of file lattice2d.hpp.

Member Data Documentation

◆ tree1_

ext::shared_ptr<T> tree1_
protected

Definition at line 50 of file lattice2d.hpp.

◆ tree2_

ext::shared_ptr<T> tree2_
protected

Definition at line 50 of file lattice2d.hpp.

◆ m_

Matrix m_
private

Definition at line 55 of file lattice2d.hpp.

◆ rho_

Real rho_
private

Definition at line 56 of file lattice2d.hpp.