ecl::PascalsTriangle< 3 > Class Template Reference

Holds the coefficients of pascal's triangle up to n = 3. More...

`#include <pascals_triangle.hpp>`

## Public Types | |

typedef Array< int, 10 > ::const_iterator | const_iterator |

Utilise the array's iterator for parsing the triangle. | |

## Public Member Functions | |

const_iterator | begin (unsigned int index=0) const |

Iterator generator for diagonals of pascals triangle [begin]. | |

const_iterator | end (unsigned int index=0) const |

Iterator generator for diagonals of pascals triangle [begin]. | |

PascalsTriangle () | |

Default constructor. | |

virtual | ~PascalsTriangle () |

## Private Attributes | |

Array< int, 10 > | coefficients |

## Friends | |

template<typename OutputStream > | |

OutputStream & | operator<< (OutputStream &ostream, const PascalsTriangle< 3 > &triangle) |

Insertion operator for streaming output from pascal's triangle of degree 3. |

class ecl::PascalsTriangle< 3 >

Holds the coefficients of pascal's triangle up to n = 3.

Stores the coefficients of all diagonals up until row 3 - i.e. all coefficients up to and including those for (x+y)^0 to (x+y)^3. This is used fairly often, so defined here to avoid the slow calculation of the general case.

**See also:**- PascalsTriangle, Math::Polynomials.

Definition at line 95 of file pascals_triangle.hpp.

typedef Array<int,10>::const_iterator ecl::PascalsTriangle< 3 >::const_iterator |

Utilise the array's iterator for parsing the triangle.

Definition at line 107 of file pascals_triangle.hpp.

ecl::PascalsTriangle< 3 >::PascalsTriangle | ( | ) |

Default constructor.

This constructor speeds things up by initialising the triangle internally with the coefficients directly.

Definition at line 24 of file pascals_triangle.cpp.

virtual ecl::PascalsTriangle< 3 >::~PascalsTriangle | ( | ) | ` [inline, virtual]` |

Definition at line 107 of file pascals_triangle.hpp.

PascalsTriangle< 3 >::const_iterator ecl::PascalsTriangle< 3 >::begin | ( | unsigned int | index = `0` | ) | const |

Iterator generator for diagonals of pascals triangle [begin].

Return a const iterator pointing to the first element of the specified diagonal.

**Parameters:**-
index : the diagonal to be iterated.

**Returns:**- const_iterator : constant iterator pointing pointing to the first element of the specified diagonal/row.

Definition at line 31 of file pascals_triangle.cpp.

PascalsTriangle< 3 >::const_iterator ecl::PascalsTriangle< 3 >::end | ( | unsigned int | index = `0` | ) | const |

Iterator generator for diagonals of pascals triangle [begin].

Return a const iterator just past the last element of the specified diagonal.

**Parameters:**-
index : the diagonal to be iterated.

**Returns:**- const_iterator : constant iterator pointing just beyond the last of the specified diagonal/row.

Definition at line 38 of file pascals_triangle.cpp.

template<typename OutputStream >

OutputStream& operator<< | ( | OutputStream & | ostream, |

const PascalsTriangle< 3 > & | triangle |
||

) | ` [friend]` |

Insertion operator for streaming output from pascal's triangle of degree 3.

Insertion operator for streaming output from pascal's triangle.

**Parameters:**-
ostream : the stream to send the output to. triangle : the pascal triangle object.

**Returns:**- OutputStream : the output stream.

Definition at line 297 of file pascals_triangle.hpp.

Array<int,10> ecl::PascalsTriangle< 3 >::coefficients` [private]` |

Definition at line 137 of file pascals_triangle.hpp.

The documentation for this class was generated from the following files: