Classes | Macros | Functions
vnl_polynomial.h File Reference

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 <vector>
#include <iosfwd>
#include <cassert>
#include "vnl/vnl_export.h"

Go to the source code of this file.

Classes

class  vnl_polynomial< T >
 Evaluation of polynomials. More...
 

Macros

#define VNL_POLYNOMIAL_INSTANTIATE(T)   extern "please #include vnl/vnl_polynomial.hxx instead"
 

Functions

template<class T >
std::ostream & operator<< (std::ostream &os, vnl_polynomial< T > const &p)
 

Detailed Description

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 $X^i$. 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.

Author
Peter Vanroose, ABIS Leuven.
Date
August 2011
  Modifications
   20 Aug 2011 - Peter Vanroose - internal repr change: coeff vector reversed

Definition in file vnl_polynomial.h.

Macro Definition Documentation

◆ VNL_POLYNOMIAL_INSTANTIATE

#define VNL_POLYNOMIAL_INSTANTIATE (   T)    extern "please #include vnl/vnl_polynomial.hxx instead"

Definition at line 170 of file vnl_polynomial.h.

Function Documentation

◆ operator<<()

template<class T >
std::ostream& operator<< ( std::ostream &  os,
vnl_polynomial< T > const &  p 
)

Definition at line 168 of file vnl_polynomial.h.