dlr::numeric::Polynomial< Type > Class Template Reference

This class represents polynomials of the form. More...

#include <polynomial.h>

List of all members.

Public Member Functions

 Polynomial ()
 The default constructor makes a constant polynomial: p(x) = 1.
 Polynomial (Type coefficient0)
 This constructor makes a constant polynomial:.
 Polynomial (Type coefficient1, Type coefficient0)
 This constructor makes a first order polynomial:.
 Polynomial (Type coefficient2, Type coefficient1, Type coefficient0)
 This constructor makes a second order polynomial:.
 Polynomial (const Array1D< Type > coefficients)
 This constructor makes a polynomial of arbitrary order.
 Polynomial (const Polynomial< Type > &other)
 The copy constructor does a deep copy.
Array1D< Type > getCoefficientArray () const
 This member function returns the coefficients of the polynomial.
size_t getOrder () const
 This member function returns the order of the polynomial: 0 for constant; 1 for linear; 2 for quadratic; and so on.
Polynomial< Type > & operator= (const Polynomial< Type > other)
 The assigment operator does a deep copy.
Type operator() (Type xValue) const
 This operator evaluates the polynomial.
Polynomialoperator*= (const Polynomial &other)
 This operator multiplies the polynomial by another polynomial.
Polynomialoperator+= (const Polynomial &other)
 This operator adds another polynomial to *this.
Polynomialoperator-= (const Polynomial &other)
 This operator subtracts another polynomial from *this.


Detailed Description

template<class Type>
class dlr::numeric::Polynomial< Type >

This class represents polynomials of the form.

p(x) = k0 + (k1 * x) + (k2 * x^2) + (k3 * x^3) ...

It provides operators for evaluating the polynomial, as well as for combining the polynomial with other polynomials.

Definition at line 34 of file polynomial.h.


Constructor & Destructor Documentation

template<class Type >
dlr::numeric::Polynomial< Type >::Polynomial (  )  [inline]

The default constructor makes a constant polynomial: p(x) = 1.

Definition at line 290 of file polynomial.h.

template<class Type >
dlr::numeric::Polynomial< Type >::Polynomial ( Type  coefficient0  )  [inline, explicit]

This constructor makes a constant polynomial:.

p(x) = coefficient0.

Parameters:
coefficient0 This argument specifies the (constant) value of the polynomial.

Definition at line 300 of file polynomial.h.

template<class Type >
dlr::numeric::Polynomial< Type >::Polynomial ( Type  coefficient1,
Type  coefficient0 
) [inline]

This constructor makes a first order polynomial:.

p(x) = coefficient0 + (coefficient1 * x)

Parameters:
coefficient1 This argument specifies one of the coefficients of the polynomial.
coefficient0 This argument specifies one of the coefficients of the polynomial.

Definition at line 310 of file polynomial.h.

template<class Type >
dlr::numeric::Polynomial< Type >::Polynomial ( Type  coefficient2,
Type  coefficient1,
Type  coefficient0 
) [inline]

This constructor makes a second order polynomial:.

p(x) = coefficient0 + (coefficient1 * x) + (coefficient2 * x^2)

Parameters:
coefficient2 This argument specifies one of the coefficients of the polynomial.
coefficient1 This argument specifies one of the coefficients of the polynomial.
coefficient0 This argument specifies one of the coefficients of the polynomial.

Definition at line 321 of file polynomial.h.

template<class Type >
dlr::numeric::Polynomial< Type >::Polynomial ( const Array1D< Type >  coefficients  )  [inline, explicit]

This constructor makes a polynomial of arbitrary order.

p(x) = coefficients[0] + (coefficients[1] * x) + (coefficients[2] * x2) + ... + (coefficients[N - 1] * x^(N-1)

where N = coefficients.size()

Parameters:
coefficients This argument is an array of coefficients for the polynomial, as described above.

Definition at line 333 of file polynomial.h.

template<class Type >
dlr::numeric::Polynomial< Type >::Polynomial ( const Polynomial< Type > &  other  )  [inline]

The copy constructor does a deep copy.

Parameters:
other This argument is the Polynomial instance to copy.

Definition at line 343 of file polynomial.h.


Member Function Documentation

template<class Type >
Array1D< Type > dlr::numeric::Polynomial< Type >::getCoefficientArray (  )  const [inline]

This member function returns the coefficients of the polynomial.

The array values are arranged in the same way as described in the documentation for constructor Polynomial(const Array1D<Type>&).

Returns:
The return value is an array of coefficients.

Definition at line 355 of file polynomial.h.

Referenced by dlr::numeric::BSpline< Type >::getCoefficientMatrices().

template<class Type>
size_t dlr::numeric::Polynomial< Type >::getOrder (  )  const [inline]

This member function returns the order of the polynomial: 0 for constant; 1 for linear; 2 for quadratic; and so on.

Returns:
The return value is the order of the polynomial.

Definition at line 129 of file polynomial.h.

Referenced by dlr::numeric::BSpline< Type >::getCoefficientMatrices(), and dlr::numeric::Polynomial< Type >::operator*=().

template<class Type >
Type dlr::numeric::Polynomial< Type >::operator() ( Type  xValue  )  const [inline]

This operator evaluates the polynomial.

Parameters:
xValue This argument specifies the value of x at which to evaluate the polynomial.
Returns:
The return value is the result of the evaluation.

Definition at line 378 of file polynomial.h.

template<class Type >
Polynomial< Type > & dlr::numeric::Polynomial< Type >::operator*= ( const Polynomial< Type > &  other  )  [inline]

This operator multiplies the polynomial by another polynomial.

After the multipliation, the result of calling this->operator()(xValue) will be equal to the previous (before the call to this->operator*=()) result of this->operator()(xValue) multiplied by the result of other.operator()(xValue).

Parameters:
other This argument is the the polynomial by which to multiply *this.
Returns:
The return value is a reference to *this.

Definition at line 397 of file polynomial.h.

References dlr::numeric::Polynomial< Type >::getOrder(), and dlr::numeric::Polynomial< Type >::m_coefficientArray.

template<class Type >
Polynomial< Type > & dlr::numeric::Polynomial< Type >::operator+= ( const Polynomial< Type > &  other  )  [inline]

This operator adds another polynomial to *this.

After the addition, the result of calling this->operator()(xValue) will be equal to the previous (before the call to this->operator+=()) result of this->operator()(xValue) plus the result of other.operator()(xValue).

Parameters:
other This argument is the the polynomial to be added to *this.
Returns:
The return value is a reference to *this.

Definition at line 426 of file polynomial.h.

References dlr::numeric::Polynomial< Type >::m_coefficientArray.

template<class Type >
Polynomial< Type > & dlr::numeric::Polynomial< Type >::operator-= ( const Polynomial< Type > &  other  )  [inline]

This operator subtracts another polynomial from *this.

After the subtraction, the result of calling this->operator()(xValue) will be equal to the previous (before the call to this->operator+=()) result of this->operator()(xValue) minus the result of other.operator()(xValue).

Parameters:
other This argument is the the polynomial to be subtracted from *this.
Returns:
The return value is a reference to *this.

Definition at line 458 of file polynomial.h.

References dlr::numeric::Polynomial< Type >::m_coefficientArray.

template<class Type >
Polynomial< Type > & dlr::numeric::Polynomial< Type >::operator= ( const Polynomial< Type >  other  )  [inline]

The assigment operator does a deep copy.

Parameters:
other This argument is the Polynomial instance to copy.
Returns:
The return value is a reference to *this.

Definition at line 365 of file polynomial.h.

References dlr::numeric::Polynomial< Type >::m_coefficientArray.


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

Generated on Wed Nov 25 00:42:49 2009 for dlrUtilities Utility Library by  doxygen 1.5.8