#include <polynomial.h>
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. | |
Polynomial & | operator*= (const Polynomial &other) |
This operator multiplies the polynomial by another polynomial. | |
Polynomial & | operator+= (const Polynomial &other) |
This operator adds another polynomial to *this. | |
Polynomial & | operator-= (const Polynomial &other) |
This operator subtracts another polynomial from *this. |
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.
dlr::numeric::Polynomial< Type >::Polynomial | ( | ) | [inline] |
The default constructor makes a constant polynomial: p(x) = 1.
Definition at line 290 of file polynomial.h.
dlr::numeric::Polynomial< Type >::Polynomial | ( | Type | coefficient0 | ) | [inline, explicit] |
This constructor makes a constant polynomial:.
p(x) = coefficient0.
coefficient0 | This argument specifies the (constant) value of the polynomial. |
Definition at line 300 of file polynomial.h.
dlr::numeric::Polynomial< Type >::Polynomial | ( | Type | coefficient1, | |
Type | coefficient0 | |||
) | [inline] |
This constructor makes a first order polynomial:.
p(x) = coefficient0 + (coefficient1 * x)
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.
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)
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.
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()
coefficients | This argument is an array of coefficients for the polynomial, as described above. |
Definition at line 333 of file polynomial.h.
dlr::numeric::Polynomial< Type >::Polynomial | ( | const Polynomial< Type > & | other | ) | [inline] |
The copy constructor does a deep copy.
other | This argument is the Polynomial instance to copy. |
Definition at line 343 of file polynomial.h.
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>&).
Definition at line 355 of file polynomial.h.
Referenced by dlr::numeric::BSpline< Type >::getCoefficientMatrices().
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.
Definition at line 129 of file polynomial.h.
Referenced by dlr::numeric::BSpline< Type >::getCoefficientMatrices(), and dlr::numeric::Polynomial< Type >::operator*=().
Type dlr::numeric::Polynomial< Type >::operator() | ( | Type | xValue | ) | const [inline] |
This operator evaluates the polynomial.
xValue | This argument specifies the value of x at which to evaluate the polynomial. |
Definition at line 378 of file polynomial.h.
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).
other | This argument is the the polynomial by which to multiply *this. |
Definition at line 397 of file polynomial.h.
References dlr::numeric::Polynomial< Type >::getOrder(), and dlr::numeric::Polynomial< Type >::m_coefficientArray.
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).
other | This argument is the the polynomial to be added to *this. |
Definition at line 426 of file polynomial.h.
References dlr::numeric::Polynomial< Type >::m_coefficientArray.
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).
other | This argument is the the polynomial to be subtracted from *this. |
Definition at line 458 of file polynomial.h.
References dlr::numeric::Polynomial< Type >::m_coefficientArray.
Polynomial< Type > & dlr::numeric::Polynomial< Type >::operator= | ( | const Polynomial< Type > | other | ) | [inline] |
The assigment operator does a deep copy.
other | This argument is the Polynomial instance to copy. |
Definition at line 365 of file polynomial.h.
References dlr::numeric::Polynomial< Type >::m_coefficientArray.