Polynomial

Polynomial offers a single class that is easily integrated with other pieces of the cvmlcpp:

template <T, std::size_t degree>
Polynomial;
Polynomial can be used with basic types as a template parameter, but also with vector-like types that support multiplication and addition such as those in Vector, the classes derived from those in Euclid, or C++'s own valarray.

Polynomial is also a functor, and it can be used for example with the Newton-Raphson procedure. This method will benefit of Polynomial's ability of creating its derivate.

Note: an n-th degree polynomial has actually n+1 parameters. Hence a Polynomial can be addressed with indices 0 to n, instead of the usual 0 to n-1.

Interface

  value_type  
Alias for template parameter T
  result_type  
Alias for template parameter T
  iterator  
Read/write iterator over the list of coefficients.
   const_iterator 
Read-only iterator over the list of coefficients.
   Derivative 
A polynomial of the type of the derivative of this polynomial. This is a Polynomial of degree n-1, except when n already is zero.
   Polynomial()  
Default constructor, does not initialize coefficients.
  template <typename Iterator>
  Polynomial(Iterator begin, Iterator end)  
Constructor, coefficients are initialized with values in the range begin to end. The coefficent at begin corresponds to the coefficient of the zero-degree term.
  T operator()(T x) const  
Evaluate the polynomial at x.
  T &operator[](const std::size_t i)  
Returns a reference to the coefficient of the term x^i.
  const T &operator[](const std::size_t i)  
Returns the coefficient of the term x^i.
  iterator begin()  
Returns an iterator to the range of coefficients.
  iterator end()  
Returns an iterator ending the range of coefficients.
  const_iterator const begin()  
Returns a const_iterator to the range of coefficients.
   const_iterator const end() 
Returns a const_iterator ending the range of coefficients.
  Derivative derivative() const  
Returns a new Polynomial that is the derivative of this polynomial.