Assignments
Assignments
|
#include <polynomial.h>
Public Member Functions | |
Polynomial (void) | |
Polynomial (double c) | |
template<typename ... Doubles> | |
Polynomial (Doubles ... coefficients) | |
template<unsigned int _Degree> | |
Polynomial (const Polynomial< 1, _Degree > &p) | |
template<unsigned int _Degree> | |
Polynomial & | operator= (const Polynomial< 1, _Degree > &p) |
const double & | coefficient (unsigned int d) const |
double & | coefficient (unsigned int d) |
double | operator() (double x) const |
Polynomial< 1, Degree-1 > | d (unsigned int d=0) const |
Polynomial | operator() (const Ray< 1 > &ray) const |
unsigned int | roots (double *r) const |
Polynomial | operator* (double s) const |
Polynomial | operator+ (const Polynomial &p) const |
template<unsigned int _Degree> | |
Polynomial< 1, Degree > & | operator= (const Polynomial< 1, _Degree > &p) |
template<unsigned int Degree> | |
Polynomial< 1, Degree > | operator+ (const Polynomial< 1, Degree > &p) const |
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 | _evaluate (const Ray< 1 > &ray, unsigned int maxDegree) const |
bool | _isZero (unsigned int maxDegree) const |
bool | _isConstant (unsigned int maxDegree) const |
Private Attributes | |
double | _coefficients [Degree+1] |
A specialized instance of the Polynomial class in one variable
Util::Polynomial< 1, Degree >::Polynomial | ( | void | ) |
The default constructor initializes the coefficients to zero.
Util::Polynomial< 1, Degree >::Polynomial | ( | double | c | ) |
This constructor creates a constant polynomial
Util::Polynomial< 1, Degree >::Polynomial | ( | Doubles ... | coefficients | ) |
This constructor initializes the coefficients (starting with lower degrees). If higher degree coefficients are not provided, they are assumed to be zero.
Util::Polynomial< 1, Degree >::Polynomial | ( | const Polynomial< 1, _Degree > & | p | ) |
The constructor copies over as much of the polynomial as will fit.
|
private |
This method returns the specified coefficient of the polynomial.
|
private |
This method returns the specified coefficient of the polynomial.
|
private |
This method evaluates the polynomial at the specified set of coordinates.
|
private |
This method evaluates a Dim-dimensional polynomial along a Dim-dimensional Ray, and returns the associated 1-dimensional polynomial.
|
private |
This method returns true if the polynomial is a constant.
|
private |
This method returns true if the polynomial is zero.
double & Util::Polynomial< 1, Degree >::coefficient | ( | unsigned int | d | ) |
This method returns the d-th coefficient.
const double & Util::Polynomial< 1, Degree >::coefficient | ( | unsigned int | d | ) | const |
This method returns the d-th coefficient.
Polynomial< 1, Degree-1 > Util::Polynomial< 1, Degree >::d | ( | unsigned int | d = 0 | ) | const |
This method returns the derivative of the polynomial.
Polynomial< 1, Degree > Util::Polynomial< 1, Degree >::operator() | ( | const Ray< 1 > & | ray | ) | const |
This method returns the 1D polynomial obtained by evaluating the polynomial along the 1D ray.
double Util::Polynomial< 1, Degree >::operator() | ( | double | x | ) | const |
This method evaluates the polynomial at a given value.
Polynomial< 1, Degree > Util::Polynomial< 1, Degree >::operator* | ( | double | s | ) | const |
This method returns the scalar multiple of the polynomial
Polynomial Util::Polynomial< 1, Degree >::operator+ | ( | const Polynomial< 1, Degree > & | p | ) | const |
This method returns the sum of two polynomials
Polynomial< 1, Degree > Util::Polynomial< 1, Degree >::operator+ | ( | const Polynomial< 1, Degree > & | p | ) | const |
Polynomial & Util::Polynomial< 1, Degree >::operator= | ( | const Polynomial< 1, _Degree > & | p | ) |
The equality operator copies over as much of the polynomial as will fit.
Polynomial< 1, Degree > & Util::Polynomial< 1, Degree >::operator= | ( | const Polynomial< 1, _Degree > & | p | ) |
unsigned int Util::Polynomial< 1, Degree >::roots | ( | double * | r | ) | const |
Sets the roots of the polynomial and returns the number of roots set. The method is only specialized for degrees 1, 2, 3, and 4.
|
private |
The coefficients of the polynomial.