template <class T> class Poly

Polynomial template class.

Public Methods

Poly(void)
Default constructor.
explicit Poly(index_t ord, const T* vec=0)
Data constructor.
Poly(const Poly& p)
Copy constructor.
~Poly(void)
Destructor.
bool Null(void) const
Test the polynomial for nullity.
index_t Order(void) const
Get the order of the polynomial.
Poly Deriv(void) const
Calculate a derivative Polynomial.
T Deriv(T x) const
Calculate the numeric first derivative.
int Roots(index_t nMax, T* roots) const
Calculate the zeros of the polynomial.
Poly& operator=(const Poly& p)
Assignment operator
T operator)(T x) const
Evaluate the Polynomial.
T& operator[](index_t i)
Get the ith coefficient.
const T& operator[](index_t i) const
Get the ith coefficient.
Poly& operator+=(const Poly& p)
Polynomial + Polynomial.
Poly& operator-=(const Poly& p)
Polynomial - Polynomial.
Poly& operator*=(const Poly& p)
Polynomial * Polynomial
Poly& operator/=(const Poly& p)
Polynomial / Polynomial.
Poly& operator%=(const Poly& p)
Polynomial % Polynomial (remainder).
Poly& operator+=(T x)
Polynomial + Scaler.
Poly& operator-=(T x)
Polynomial - Scaler.
Poly& operator*=(T x)
Polynomial * Scaler.
Poly& operator/=(T x)
Polynomial / Polynomial.

Documentation

The polynomial class supports real and Complex polynomials.
Poly(void)
Construct a polynomial object without data.

explicit Poly(index_t ord, const T* vec=0)
Construct a polynomial of order 'ord' and initialize it from the vector of coefficients 'vec'. Note that the order of the constructed polynomial may differ from 'ord' if one or more high order coefficients are zero.
Parameters:
ord - Order of the polynomial to be constructed.
vec - Vector of length ord+1 of coefficients.

Poly(const Poly& p)
Construct a polynomial object and initialize it from another polynomial.
Parameters:
p - polynomial to be copied.

~Poly(void)
Destroy the object and free the space it uses.

bool Null(void) const
Returns true if the polynomial is uninitialized or zero.
Returns:
true if the polynomial is unallocated or if the only coefficient is zero.

index_t Order(void) const
The order of the polynomial is returned.

Poly Deriv(void) const
The first derivative of the polynomial is calculated and returned as a polynomial.

T Deriv(T x) const
The numeric value of the first derivative of the polynomial evaluated at 'x' is returned.

int Roots(index_t nMax, T* roots) const
The zeros of the polynomial are calculated and placed in 'roots'. An error is returned and no roots are calculated if the order of the polynomial is greater than nMax. The returned integer is non- zero if an error occurred.

Poly& operator=(const Poly& p)
Assignment operator. The rhs polynomial is copied to the lhs polynomial.

T operator)(T x) const
Evaluate the polynomial a the specified point.
Returns:
polynomial value.
Parameters:
x - point at which the polynoimial is to be evaluated.

T& operator[](index_t i)
Reference a polynomial coefficient.
Returns:
a reference to the specified coefficient.
Parameters:
i - The number of the coefficient to be accessed.

const T& operator[](index_t i) const
Reference a polynomial coefficient.
Returns:
a constant reference to the specified coefficient.
Parameters:
i - The number of the coefficient to be accessed.

Poly& operator+=(const Poly& p)
The rhs polynomial is added to the lhs polynomial. The resulting Polynomial replaces the lhs.

Poly& operator-=(const Poly& p)
The rhs polynomial is subtracted from the lhs polynomial. The resulting Polynomial replaces the lhs.

Poly& operator*=(const Poly& p)
Polynomial * Polynomial. The lhs polynomial is multiplied by the rhs polynomial. The resulting Polynomial replaces the lhs.

Poly& operator/=(const Poly& p)
The lhs polynomial is multiplied by the rhs polynomial. The resulting Polynomial replaces the lhs.

Poly& operator%=(const Poly& p)
The lhs polynomial is divided by the rhs polynomial and the remainder replaces the lhs value.

Poly& operator+=(T x)
The rhs scaler is added to the zeroeth polynomial coefficient. The resulting Polynomial replaces the lhs.

Poly& operator-=(T x)
The rhs scaler is subtracted from the zeroeth polynomial coefficient. The resulting Polynomial replaces the lhs.

Poly& operator*=(T x)
The lhs polynomial is multiplied by the rhs scaler. The resulting Polynomial replaces the lhs.

Poly& operator/=(T x)
The lhs polynomial is divided by the rhs scaler. The resulting Polynomial replaces the lhs.


This class has no child classes.

alphabetic index hierarchy of classes


generated by doc++