Evaluation of univariate polynomials Templated class (on the data type of the coefficients), further very similar to the vnl_real_polynomial class, except that it uses std::vector instead of vnl_vector as data container, that the zero polynomial is represented by an empty vector, and that the coefficients go in the other direction. More...
#include <vcl_vector.h>
#include <vcl_iosfwd.h>
#include <vcl_cassert.h>
Go to the source code of this file.
Classes | |
class | vnl_polynomial< T > |
Evaluation of polynomials. More... | |
Defines | |
#define | VNL_POLYNOMIAL_INSTANTIATE(T) extern "please #include vnl/vnl_polynomial.txx instead" |
Functions | |
template<class T > | |
vcl_ostream & | operator<< (vcl_ostream &os, vnl_polynomial< T > const &p) |
Evaluation of univariate polynomials Templated class (on the data type of the coefficients), further very similar to the vnl_real_polynomial class, except that it uses std::vector instead of vnl_vector as data container, that the zero polynomial is represented by an empty vector, and that the coefficients go in the other direction.
Important note on the implementation choice (reversed coefficient vector as opposed to the class vnl_real_npolynomial): The choice made here is definitely the more natural one, since it makes polynomials of different degrees much more naturally comparable, and hence simplifies the implementation of e.g. operator+(). Indeed: even if the degrees are different, the coefficients [i] of two polynomials are the ones to be considered together since they both refer to . Also, normalizing the internal representation (in case the highest order coefficient is zero) now just needs to pop_back() instead of shifting the coefficients vector. In summary, the choice made here is both more natural and more performant.
Modifications 20 Aug 2011 - Peter Vanroose - internal repr change: coeff vector reversed
Definition in file vnl_polynomial.h.
#define VNL_POLYNOMIAL_INSTANTIATE | ( | T | ) | extern "please #include vnl/vnl_polynomial.txx instead" |
Definition at line 169 of file vnl_polynomial.h.
vcl_ostream& operator<< | ( | vcl_ostream & | os, |
vnl_polynomial< T > const & | p | ||
) |
Definition at line 167 of file vnl_polynomial.h.