QuantLib: a free/open-source library for quantitative finance
Reference manual - version 1.40
Loading...
Searching...
No Matches
TreeLattice< Impl > Class Template Reference

Tree-based lattice-method base class. More...

#include <ql/methods/lattices/lattice.hpp>

Inheritance diagram for TreeLattice< Impl >:

Public Member Functions

 TreeLattice (const TimeGrid &timeGrid, Size n)
Public Member Functions inherited from Lattice
 Lattice (TimeGrid timeGrid)
const TimeGridtimeGrid () const
virtual Array grid (Time) const =0

Lattice interface

std::vector< ArraystatePrices_
void initialize (DiscretizedAsset &, Time t) const override
 initialize an asset at the given time.
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.
const ArraystatePrices (Size i) const
void stepback (Size i, const Array &values, Array &newValues) const
void computeStatePrices (Size until) const

Additional Inherited Members

Protected Member Functions inherited from CuriouslyRecurringTemplate< Impl >
Impl & impl ()
const Impl & impl () const
TimeGrid t_

Detailed Description

template<class Impl>
class QuantLib::TreeLattice< Impl >

Tree-based lattice-method base class.

This class defines a lattice method that is able to rollback (with discount) a discretized asset object. It will be based on one or more trees.

Derived classes must implement the following interface:

public:
DiscountFactor discount(Size i, Size index) const;
Size descendant(Size i, Size index, Size branch) const;
Real probability(Size i, Size index, Size branch) const;

and may implement the following:

public:
void stepback(Size i,
const Array& values,
Array& newValues) const;

Member Function Documentation

◆ initialize()

template<class Impl>
void initialize ( DiscretizedAsset & ,
Time time ) const
overridevirtual

initialize an asset at the given time.

Implements Lattice.

◆ rollback()

template<class Impl>
void rollback ( DiscretizedAsset & ,
Time to ) const
overridevirtual

Roll back an asset until the given time, performing any needed adjustment.

Implements Lattice.

Reimplemented in TsiveriotisFernandesLattice< T >.

◆ partialRollback()

template<class Impl>
void partialRollback ( DiscretizedAsset & ,
Time to ) const
overridevirtual

Roll back an asset until the given time, but do not perform the final adjustment.

Warning
In version 0.3.7 and earlier, this method was called rollAlmostBack method and performed pre-adjustment. This is no longer true; when migrating your code, you'll have to replace calls such as:
method->rollAlmostBack(asset,t);

with the two statements:

method->partialRollback(asset,t);
asset->preAdjustValues();

Implements Lattice.

Reimplemented in TsiveriotisFernandesLattice< T >.

◆ presentValue()

template<class Impl>
Real presentValue ( DiscretizedAsset & asset) const
overridevirtual

Computes the present value of an asset using Arrow-Debrew prices.

Implements Lattice.