Public Types | Public Member Functions | Private Attributes | Friends | List of all members
ecl::PascalsTriangle< 5 > Class Reference

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

#include <pascals_triangle.hpp>

Public Types

typedef Array< int, 21 >::const_iterator const_iterator
 Utilise the array's iterator for parsing the triangle. More...
 

Public Member Functions

const_iterator begin (unsigned int index=0) const
 Iterator generator for diagonals of pascals triangle [begin]. More...
 
const_iterator end (unsigned int index=0) const
 Iterator generator for diagonals of pascals triangle [begin]. More...
 
 PascalsTriangle ()
 Default constructor. More...
 
virtual ~PascalsTriangle ()
 

Private Attributes

Array< int, 21 > coefficients
 

Friends

template<typename OutputStream >
OutputStream & operator<< (OutputStream &ostream, const PascalsTriangle< 5 > &triangle)
 Insertion operator for streaming output from pascal's triangle of degree 5. More...
 

Detailed Description

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

Stores the coefficients of all diagonals up until row 5 - i.e. all coefficients up to and including those for (x+y)^0 to (x+y)^5. 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 160 of file pascals_triangle.hpp.

Member Typedef Documentation

◆ const_iterator

Utilise the array's iterator for parsing the triangle.

Definition at line 174 of file pascals_triangle.hpp.

Constructor & Destructor Documentation

◆ PascalsTriangle()

Default constructor.

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

Definition at line 55 of file pascals_triangle.cpp.

◆ ~PascalsTriangle()

virtual ecl::PascalsTriangle< 5 >::~PascalsTriangle ( )
inlinevirtual

Definition at line 174 of file pascals_triangle.hpp.

Member Function Documentation

◆ begin()

PascalsTriangle< 5 >::const_iterator ecl::PascalsTriangle< 5 >::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 64 of file pascals_triangle.cpp.

◆ end()

PascalsTriangle< 5 >::const_iterator ecl::PascalsTriangle< 5 >::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 71 of file pascals_triangle.cpp.

Friends And Related Function Documentation

◆ operator<<

template<typename OutputStream >
OutputStream& operator<< ( OutputStream &  ostream,
const PascalsTriangle< 5 > &  triangle 
)
friend

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

Insertion operator for streaming output from pascal's triangle.

Parameters
ostream: the output stream being used.
triangle: the pascal triangle object.
Returns
OutputStream : the output stream.

Definition at line 329 of file pascals_triangle.hpp.

Member Data Documentation

◆ coefficients

Array<int,21> ecl::PascalsTriangle< 5 >::coefficients
private

Definition at line 204 of file pascals_triangle.hpp.


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


ecl_geometry
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:40