Assignments Assignments

Public Member Functions | Private Member Functions | Private Attributes | List of all members
Util::Polynomial< Dim, Degree > Class Template Reference

`#include <polynomial.h>`

Inheritance diagram for Util::Polynomial< Dim, Degree >:

## Public Member Functions
| Polynomial (void)
| Polynomial (double c)
template<unsigned int _Degree>
| Polynomial (const Polynomial< Dim, _Degree > &p)
template<unsigned int _Degree>
Polynomial & | operator= (const Polynomial< Dim, _Degree > &p)
template<typename ... UnsignedInts>
const double & | coefficient (UnsignedInts ... indices) const
template<typename ... UnsignedInts>
double & | coefficient (UnsignedInts ... indices)
template<typename ... Doubles>
double | operator() (Doubles ... coordinates) const
double | operator() (Point< Dim > p) const
Polynomial< Dim, Degree-1 > | d (int dim) const
Polynomial< 1, Degree > | operator() (const Ray< Dim > &ray) const
Polynomial | operator* (double s) const
Polynomial | operator+ (const Polynomial &p) const
template<typename ... Doubles>
| Polynomial (Doubles ... coefficients)
template<unsigned int _Degree>
| Polynomial (const Polynomial< 1, _Degree > &p)
template<unsigned int _Degree>
Polynomial< 1, Degree > & | operator= (const Polynomial< 1, _Degree > &p)
template<unsigned int Degree>
const double & | coefficient (unsigned int d) const
template<unsigned int Degree>
double & | coefficient (unsigned int d)
template<unsigned int Degree>
double | operator() (double x) const
template<unsigned int Degree>
Polynomial< 1, Degree > | operator() (const Ray< 1 > &ray) const
template<unsigned int Degree>
Polynomial< 1, Degree > | operator+ (const Polynomial< 1, Degree > &p) const
unsigned int | roots (double *r) const
unsigned int | roots (double *r) const
unsigned int | roots (double *r) const
unsigned int | roots (double *r) const
unsigned int | roots (double *r) const
template<unsigned int _Degree>
Polynomial< Dim, Degree > & | operator= (const Polynomial< Dim, _Degree > &p)

## Private Member Functions
const double & | _coefficient (const unsigned int indices[], unsigned int maxDegree) const
double & | _coefficient (const unsigned int indices[], unsigned int maxDegree)
double | _evaluate (const double coordinates[], unsigned int maxDegree) const
Polynomial< 1, Degree > | _evaluate (const Ray< Dim > &ray, unsigned int maxDegree) const
bool | _isZero (unsigned int maxDegree) const
bool | _isConstant (unsigned int maxDegree) const

## Private Attributes
Polynomial< Dim-1, Degree > | _polynomials [Degree+1]

## Detailed Description

template<unsigned int Dim, unsigned int Degree>
class Util::Polynomial< Dim, Degree >

The generic, recursively defined, Polynomial class of total degree Degree.

## Constructor & Destructor Documentation

## ◆ Polynomial() [1/5]

template<unsigned int Dim, unsigned int Degree>

Util::Polynomial< Dim, Degree >::Polynomial | ( | void |  | ) |

The default constructor initializes the coefficients to zero.

## ◆ Polynomial() [2/5]

template<unsigned int Dim, unsigned int Degree>

Util::Polynomial< Dim, Degree >::Polynomial | ( | double | c | ) |

This constructor creates a constant polynomial

## ◆ Polynomial() [3/5]

template<unsigned int Dim, unsigned int Degree>
template<unsigned int _Degree>

Util::Polynomial< Dim, Degree >::Polynomial | ( | const Polynomial< Dim, _Degree > & | p | ) |

The constructor copies over as much of the polynomial as will fit.

## ◆ Polynomial() [4/5]

template<unsigned int Dim, unsigned int Degree>
template<typename ... Doubles>

Util::Polynomial< Dim, Degree >::Polynomial | ( | Doubles ... | coefficients | ) |

## ◆ Polynomial() [5/5]

template<unsigned int Dim, unsigned int Degree>
template<unsigned int _Degree>

Util::Polynomial< Dim, Degree >::Polynomial | ( | const Polynomial< 1, _Degree > & | p | ) |

## Member Function Documentation

## ◆ _coefficient() [1/2]

template<unsigned int Dim, unsigned int Degree>

double & Util::Polynomial< Dim, Degree >::_coefficient | ( | const unsigned int | indices[],
|  | unsigned int | maxDegree )
| private

This method returns the specified coefficient of the polynomial.

## ◆ _coefficient() [2/2]

template<unsigned int Dim, unsigned int Degree>

const double & Util::Polynomial< Dim, Degree >::_coefficient | ( | const unsigned int | indices[],
|  | unsigned int | maxDegree ) const
| private

This method returns the specified coefficient of the polynomial.

## ◆ _evaluate() [1/2]

template<unsigned int Dim, unsigned int Degree>

double Util::Polynomial< Dim, Degree >::_evaluate | ( | const double | coordinates[],
|  | unsigned int | maxDegree ) const
| private

This method evaluates the polynomial at the specified set of coordinates.

## ◆ _evaluate() [2/2]

template<unsigned int Dim, unsigned int Degree>

Polynomial< 1, Degree > Util::Polynomial< Dim, Degree >::_evaluate | ( | const Ray< Dim > & | ray,
|  | unsigned int | maxDegree ) const
| private

This method evaluates a Dim-dimensional polynomial along a Dim-dimensional Ray, and returns the associated 1-dimensional polynomial.

## ◆ _isConstant()

template<unsigned int Dim, unsigned int Degree>

bool Util::Polynomial< Dim, Degree >::_isConstant | ( | unsigned int | maxDegree | ) | const
| private

This method returns true if the polynomial is a constant.

## ◆ _isZero()

template<unsigned int Dim, unsigned int Degree>

bool Util::Polynomial< Dim, Degree >::_isZero | ( | unsigned int | maxDegree | ) | const
| private

This method returns true if the polynomial is zero.

## ◆ coefficient() [1/4]

template<unsigned int Dim, unsigned int Degree>
template<unsigned int Degree>

double & Util::Polynomial< Dim, Degree >::coefficient | ( | unsigned int | d | ) |

## ◆ coefficient() [2/4]

template<unsigned int Dim, unsigned int Degree>
template<unsigned int Degree>

const double & Util::Polynomial< Dim, Degree >::coefficient | ( | unsigned int | d | ) | const

## ◆ coefficient() [3/4]

template<unsigned int Dim, unsigned int Degree>
template<typename ... UnsignedInts>

double & Util::Polynomial< Dim, Degree >::coefficient | ( | UnsignedInts ... | indices | ) |

This method returns the associated coefficient of the polynomial

## ◆ coefficient() [4/4]

template<unsigned int Dim, unsigned int Degree>
template<typename ... UnsignedInts>

const double & Util::Polynomial< Dim, Degree >::coefficient | ( | UnsignedInts ... | indices | ) | const

This method returns the associated coefficient of the polynomial

## ◆ d()

template<unsigned int Dim, unsigned int Degree>

Polynomial< Dim, Degree-1 > Util::Polynomial< Dim, Degree >::d | ( | int | dim | ) | const

This method returns the partial derivative with respect to the prescribed dimension.

## ◆ operator()() [1/5]

template<unsigned int Dim, unsigned int Degree>
template<unsigned int Degree>

Polynomial< 1, Degree > Util::Polynomial< Dim, Degree >::operator() | ( | const Ray< 1 > & | ray | ) | const

## ◆ operator()() [2/5]

template<unsigned int Dim, unsigned int Degree>

Polynomial< 1, Degree > Util::Polynomial< Dim, Degree >::operator() | ( | const Ray< Dim > & | ray | ) | const

This method returns the 1D polynomial obtained by evaluating the polynomial along the ray.

## ◆ operator()() [3/5]

template<unsigned int Dim, unsigned int Degree>
template<unsigned int Degree>

double Util::Polynomial< Dim, Degree >::operator() | ( | double | x | ) | const

## ◆ operator()() [4/5]

template<unsigned int Dim, unsigned int Degree>
template<typename ... Doubles>

double Util::Polynomial< Dim, Degree >::operator() | ( | Doubles ... | coordinates | ) | const

This method evaluates the polynomial at the prescribed point.

## ◆ operator()() [5/5]

template<unsigned int Dim, unsigned int Degree>

double Util::Polynomial< Dim, Degree >::operator() | ( | Point< Dim > | p | ) | const

This method evaluates the polynomial at the prescribed point.

## ◆ operator*()

template<unsigned int Dim, unsigned int Degree>

Polynomial< Dim, Degree > Util::Polynomial< Dim, Degree >::operator* | ( | double | s | ) | const

This method returns the scalar multiple of the polynomial

## ◆ operator+() [1/2]

template<unsigned int Dim, unsigned int Degree>

Polynomial< Dim, Degree > Util::Polynomial< Dim, Degree >::operator+ | ( | const Polynomial< Dim, Degree > & | p | ) | const

This method returns the sum of two polynomials

## ◆ operator+() [2/2]

template<unsigned int Dim, unsigned int Degree>
template<unsigned int Degree>

Polynomial< 1, Degree > Util::Polynomial< Dim, Degree >::operator+ | ( | const Polynomial< 1, Degree > & | p | ) | const

## ◆ operator=() [1/3]

template<unsigned int Dim, unsigned int Degree>
template<unsigned int _Degree>

Polynomial< 1, Degree > & Util::Polynomial< Dim, Degree >::operator= | ( | const Polynomial< 1, _Degree > & | p | ) |

## ◆ operator=() [2/3]

template<unsigned int Dim, unsigned int Degree>
template<unsigned int _Degree>

Polynomial & Util::Polynomial< Dim, Degree >::operator= | ( | const Polynomial< Dim, _Degree > & | p | ) |

The equality operator copies over as much of the polynomial as will fit.

## ◆ operator=() [3/3]

template<unsigned int Dim, unsigned int Degree>
template<unsigned int _Degree>

Polynomial< Dim, Degree > & Util::Polynomial< Dim, Degree >::operator= | ( | const Polynomial< Dim, _Degree > & | p | ) |

## ◆ roots() [1/5]

unsigned int Util::Polynomial< 1, 1 >::roots | ( | double * | r | ) | const
| inline

## ◆ roots() [2/5]

unsigned int Util::Polynomial< 1, 2 >::roots | ( | double * | r | ) | const
| inline

## ◆ roots() [3/5]

unsigned int Util::Polynomial< 1, 3 >::roots | ( | double * | r | ) | const
| inline

## ◆ roots() [4/5]

unsigned int Util::Polynomial< 1, 4 >::roots | ( | double * | r | ) | const
| inline

## ◆ roots() [5/5]

unsigned int Util::Polynomial< 1, 5 >::roots | ( | double * | r | ) | const
| inline

## Member Data Documentation

## ◆ _polynomials

template<unsigned int Dim, unsigned int Degree>

Polynomial< Dim-1 , Degree > Util::Polynomial< Dim, Degree >::_polynomials[Degree+1]
| private

The polynomials in Dim-1 dimensions. The total polynomial is assumed to be _polynomials[0] + _polynomials[1] * (x_Dim) + _polynomials[2] * (x_Dim)^2 + ...

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

- Assignments/Util/polynomial.h
- Assignments/Util/polynomial.inl