SPolynomial.h

Classes

SPolynomial -- A one dimensional scaled polynomial class (full description)

template<class T> class SPolynomial: public SPolynomialParam<T>

Interface

Public Members
SPolynomial() : SPolynomialParam<T>()
explicit SPolynomial(uInt order) : order<T>(order)
SPolynomial(const SPolynomial<T> &other) : other<T>(other)
SPolynomial<T> &operator=(const SPolynomial<T> &other)
virtual ~SPolynomial()
virtual T eval(typename Function<T>::FunctionArg x) const
virtual Function<T> *clone() const

Description

Prerequisite

Synopsis

A SPolynomial contains a set of coefficients; its fundamental operations is evaluating itself at some "x". The number of coefficients is the order of the polynomial plus one, plus an additional 3 as height, center, width.

Example

  SPolynomial<Float> pf(3); // Third order polynomial - coeffs 0 by default
  pf.setCoefficient(1, 1.0);
  pf[5] = 2.0;
  pf.setCoefficient(3, 3.0);  // 3x^3 + 2x^2 + x
  pf(2); // == 34

Template Type Argument Requirements (T)

Thrown Exceptions

To Do

Member Description

SPolynomial() : SPolynomialParam<T>()

Constructs a zero'th order polynomial, with a coeficcient of 0.0.

explicit SPolynomial(uInt order) : order<T>(order)

Makes a polynomial of the given order, with all coeficcients set to zero, and height, center, width to 1,0,1.

SPolynomial(const SPolynomial<T> &other) : other<T>(other)
SPolynomial<T> &operator=(const SPolynomial<T> &other)

Copy constructor/assignment (deep copy)

virtual ~SPolynomial()

Destructor

virtual T eval(typename Function<T>::FunctionArg x) const

Evaluate the polynomial at x.

virtual Function<T> *clone() const

Return a copy of this object from the heap. The caller is responsible for deleting the pointer.