casa
$Rev:20696$
|
A one dimensional polynomial class. More...
#include <Polynomial.h>
Public Member Functions | |
Polynomial () | |
Constructs a zero'th order polynomial, with a coeficcient of 0.0. | |
Polynomial (uInt order) | |
Makes a polynomial of the given order, with all coeficcients set to zero. | |
Polynomial (const Polynomial< T > &other) | |
Copy constructor/assignment (deep copy) | |
template<class W > | |
Polynomial (const Polynomial< W > &other) | |
Polynomial< T > & | operator= (const Polynomial< T > &other) |
virtual | ~Polynomial () |
Destructor. | |
virtual T | eval (typename Function1D< T >::FunctionArg x) const |
Evaluate the polynomial at x . | |
Polynomial< T > | derivative () const |
Return the polynomial which is the derivative of this one. | |
virtual Function< T > * | clone () const |
Return a copy of this object from the heap. | |
virtual Function< typename FunctionTraits< T >::DiffType > * | cloneAD () const |
virtual Function< typename FunctionTraits< T >::BaseType > * | cloneNonAD () const |
A one dimensional polynomial class.
A Polynomial<T> 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, so is the number of available parameters.
Tip: The present implementation merely stores the coefficients in a Block; In the unlikely case that we need to deal with polynomials with many zero coefficients, a more efficient representation would be possible;
Polynomial<Float> pf(3); // Third order polynomial - coeffs 0 by default pf.setCoefficient(1, 1.0); pf[2] = 2.0; pf.setCoefficient(3, 3.0); // 3x^3 + 2x^2 + x pf(2); // == 34
Definition at line 90 of file Polynomial.h.
casa::Polynomial< T >::Polynomial | ( | ) | [inline] |
Constructs a zero'th order polynomial, with a coeficcient of 0.0.
Definition at line 96 of file Polynomial.h.
casa::Polynomial< T >::Polynomial | ( | uInt | order | ) | [inline, explicit] |
Makes a polynomial of the given order, with all coeficcients set to zero.
Definition at line 99 of file Polynomial.h.
casa::Polynomial< T >::Polynomial | ( | const Polynomial< T > & | other | ) | [inline] |
Copy constructor/assignment (deep copy)
Definition at line 102 of file Polynomial.h.
casa::Polynomial< T >::Polynomial | ( | const Polynomial< W > & | other | ) | [inline] |
Definition at line 104 of file Polynomial.h.
virtual casa::Polynomial< T >::~Polynomial | ( | ) | [inline, virtual] |
Destructor.
Definition at line 110 of file Polynomial.h.
virtual Function<T>* casa::Polynomial< T >::clone | ( | ) | const [inline, virtual] |
Return a copy of this object from the heap.
The caller is responsible for deleting the pointer.
Implements casa::Function< T, T >.
Definition at line 124 of file Polynomial.h.
virtual Function<typename FunctionTraits<T>::DiffType>* casa::Polynomial< T >::cloneAD | ( | ) | const [inline, virtual] |
Reimplemented from casa::Function< T, T >.
Definition at line 125 of file Polynomial.h.
virtual Function<typename FunctionTraits<T>::BaseType>* casa::Polynomial< T >::cloneNonAD | ( | ) | const [inline, virtual] |
Reimplemented from casa::Function< T, T >.
Definition at line 127 of file Polynomial.h.
Polynomial<T> casa::Polynomial< T >::derivative | ( | ) | const |
Return the polynomial which is the derivative of this one.
e.g., 2+4x+5x^2 --> 0+4+10x
.
virtual T casa::Polynomial< T >::eval | ( | typename Function1D< T >::FunctionArg | x | ) | const [virtual] |
Evaluate the polynomial at x
.
Polynomial<T>& casa::Polynomial< T >::operator= | ( | const Polynomial< T > & | other | ) | [inline] |
Definition at line 105 of file Polynomial.h.
Referenced by casa::Polynomial< AutoDiff< Float > >::operator=().