Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members

# Lattice< Node > Class Template Reference

`#include <Lattice.h>`

## Detailed Description

### template<typename Node> class Lattice< Node >

A lattice is a compact representation of a large number of paths of a stochastic process with the property that the path set is invariant under path splitting at each time step. This makes the computation of a conditional expectation at time t at each node at time t a very simple procedure: applying the Double Expectation Theorem and assuming that the values of the random variable h are known by time t=s we can compute by backward recursion starting from time t=s as follows: At each node N living at time t the conditional expectation is simply the probability weighted average where the sum extends over all edges e originating from the node N and p(e) and N(e) denote the transition probability along the edge e and the node at time t+1 which the edge e connects to. At time t the values of have already been computed at all nodes living at time t+1 and in particular at all the nodes N(e).

Here h could be a conditional expectation of some random variable k at a later time u. Thus the case of iterated conditional expectations is handled with equal ease and this is the main advantage of lattices over Monte Carlo path simulation.

The Lattice consists of nodes of type Node. This type can be recovered from the lattice type as `LatticeType::NodeType`. The edges originating from a node are assumed to be numbered i=0,1,.... Transition probabilities are assumed to be independent of state and time and are computed by the lattice.

The code can easily be rewritten to cover the general case of both time and state dependent transition probabilities. Simply define `Lattice::transitionProbability` to be a function of the edge i, time t and the node n. For reasons of speed this approach is not taken here.

Parameters:
 Node the type of nodes in this lattice.

Definition at line 89 of file Lattice.h.

## Public Member Functions

int getTimeSteps () const
virtual Real getTimeStep ()=0
vector< Node * > * getNodeList (int t)
Node * getRoot ()
virtual Real transitionProbability (int i)=0
Lattice (int s)
virtual ~Lattice ()
void selfTest ()

## Protected Types

typedef Node NodeType

## Protected Attributes

int T
Array1D< vector< Node * > * > nodeList

## Member Typedef Documentation

 template typedef Node Lattice< Node >::NodeType` [protected]`
 The type of nodes used in the lattice. Definition at line 94 of file Lattice.h.

## Constructor & Destructor Documentation

 template Lattice< Node >::Lattice ( int s ) ` [inline]`

Parameters:
 s number of time steps in the lattice.

Definition at line 134 of file Lattice.h.

 template virtual Lattice< Node >::~Lattice ( ) ` [inline, virtual]`
 Definition at line 147 of file Lattice.h.

## Member Function Documentation

 template int Lattice< Node >::getTimeSteps ( ) const` [inline]`
 Definition at line 108 of file Lattice.h.

 template virtual Real Lattice< Node >::getTimeStep ( ) ` [pure virtual]`
 The size of the time step. Implemented in BasketLattice, and LmmLattice.

 template vector* Lattice< Node >::getNodeList ( int t ) ` [inline]`
 The list of nodes at time t. Definition at line 115 of file Lattice.h.

 template Node* Lattice< Node >::getRoot ( ) ` [inline]`
 The root node of the lattice. Definition at line 119 of file Lattice.h.

 template virtual Real Lattice< Node >::transitionProbability ( int i ) ` [pure virtual]`
 The transition probability along edge[i], state and time independent. Since this function is critical we will usually try to get around the (slow) virtual function call by passing the concrete LatticeType as a template parameter rather than going through the interface. Implemented in BasketLattice, and LmmLattice. Referenced by Lattice< StandardBrownianNode >::selfTest().

 template void Lattice< Node >::selfTest ( ) ` [inline]`
 Goes through all the nodes in the lattice and checks if the transition probabilities are in [0,1] and sum to 1. Note however that this class does not allocate any nodes or edges. This is left to the derived classes. Definition at line 166 of file Lattice.h.

## Member Data Documentation

 template int Lattice< Node >::T` [protected]`
 Number of time steps in the lattice. Definition at line 97 of file Lattice.h.

 template Array1D< vector* > Lattice< Node >::nodeList` [protected]`
 Definition at line 100 of file Lattice.h.

The documentation for this class was generated from the following file:
Generated on Mon Sep 22 02:16:33 2003 for Libor-Library by 1.3-rc3