# template class xf::fintech::TrinomialTree¶

#include "trinomial_tree.hpp"

## Overview¶

TrinomialTree is a lattice based trinomial tree structure.

Parameters:

DT | date type supported include float and double. |

Process | stochastic process. |

LEN | maximum length of timestep |

template < typename DT, typename Process, int LEN > class TrinomialTree

## Methods¶

### initialization¶

void initialization ( DT processParam [4], unsigned endCnt, DT x0_ )

initialize parameters.

Parameters:

processParam | parameters of stochastic process. |

endCnt | end counter of timepoints |

x0_ | initial underlying |

### dxUpdateNoCalcu¶

void dxUpdateNoCalcu ( int i, DT t, DT dt )

update parameters from array to calculate probability for timepoint=i

Parameters:

i | timepoint counter |

t | time for timepoint=i |

dt | the difference time between timepoint=i+1 and timepoint=i |

### dxUpdate¶

void dxUpdate ( int i, DT t, DT dt )

calculate to get parameters to calculate probability for timepoint=i

Parameters:

i | timepoint counter |

t | time for timepoint=i |

dt | the difference time between timepoint=i+1 and timepoint=i |

### calculateProbability¶

int calculateProbability ( int j, DT t, DT dt, DT* probs )

calculate probability and descendant index for timepoint=i and node=j

Parameters:

j | node index |

t | time for timepoint=i |

dt | the difference time between timepoint=i+1 and timepoint=i |

probs | return the calculated probability |

Returns:

return the calculated descendant index

### size¶

int size (int i)

Branch size per timepoints.

Parameters:

i | timepoint counter |

Returns:

the branch size at timepoint is i

### underlying¶

DT underlying (int index)

underlying

Parameters:

index | node index for branch |

Returns:

underlying