Polynomial< T > Class Template Reference
[Miscellaneous Tools]


Detailed Description

template<class T>
class lemon::Polynomial< T >

This class implements a polynomial where the coefficients are of type T.

The coefficients are stored in an std::vector. #include <lemon/polynomial.h>

List of all members.

Public Member Functions

 Polynomial (int d=0)
 Construct a polynomial of degree d.
template<class U >
 Polynomial (const U &u)
 
template<class U >
 Polynomial (const Polynomial< U > &u)
 
int deg () const
 Query the degree of the polynomial.
void deg (int d)
 Set the degree of the polynomial.
std::vector< T >::reference operator[] (int d)
 Returns (as a reference) the coefficient of degree d.
std::vector< T >::const_reference operator[] (int d) const
 Returns (as a const reference) the coefficient of degree d.
template<class R , class U >
subst (const U &u) const
 Substitute the value u into the polinomial.
template<class U >
operator() (const U &u) const
 Substitute the value u into the polinomial.
PolynomialderivateMyself ()
 Derivate the polynomial (in place).
Polynomial derivate () const
 Return the derivate of the polynomial.
PolynomialintegrateMyself ()
 Integrate the polynomial (in place).
Polynomial integrate () const
 Return the integrate of the polynomial.
template<class U >
Polynomialoperator+= (const Polynomial< U > &p)
 
template<class U >
Polynomialoperator-= (const Polynomial< U > &p)
 
template<class U >
Polynomialoperator+= (const U &u)
 
template<class U >
Polynomialoperator-= (const U &u)
 
template<class U >
Polynomialoperator*= (const U &u)
 
template<class U >
Polynomialoperator/= (const U &u)
 

Related Functions

(Note that these are not member functions.)

template<class U , class V >
bool operator== (const Polynomial< U > &u, const Polynomial< V > &v)
 Equality comparison.
template<class U , class V >
bool operator!= (const Polynomial< U > &u, const Polynomial< V > &v)
 Non-equality comparison.
template<class U , class V >
Polynomial< U > operator+ (const Polynomial< U > &u, const Polynomial< V > &v)
 
template<class U , class V >
Polynomial< U > operator- (const Polynomial< U > &u, const Polynomial< V > &v)
 
template<class U , class V >
Polynomial< U > operator* (const Polynomial< U > &u, const Polynomial< V > &v)
 
template<class U , class V >
Polynomial< U > operator+ (const Polynomial< U > &u, const V &v)
 
template<class U , class V >
Polynomial< U > operator+ (const V &v, const Polynomial< U > &u)
 
template<class U , class V >
Polynomial< U > operator- (const Polynomial< U > &u, const V &v)
 
template<class U >
Polynomial< U > operator- (const Polynomial< U > &u)
 
template<class U , class V >
Polynomial< U > operator- (const V &v, const Polynomial< U > &u)
 
template<class U , class V >
Polynomial< U > operator* (const Polynomial< U > &u, const V &v)
 
template<class U , class V >
Polynomial< U > operator* (const V &v, const Polynomial< U > &u)
 
template<class U , class V >
Polynomial< U > operator/ (const Polynomial< U > &u, const V &v)
 


Member Function Documentation

int deg (  )  const [inline]

Query the degree of the polynomial.

Warning:
This number differs from real degree of the polinomial if the coefficient of highest degree is 0.

void deg ( int  d  )  [inline]

Set the degree of the polynomial. In fact it resizes the coefficient vector.

R subst ( const U &  u  )  const [inline]

Substitute the value u into the polinomial. The calculation will be done using type R. The following examples shows the usage of the template parameter R.

         Polynomial<dim2::Point<double> > line(1);
         line[0]=dim2::Point<double>(12,25);
         line[1]=dim2::Point<double>(2,7);
         ...
         dim2::Point<double> d = line.subst<dim2::Point<double> >(23.2);

         Polynomial<double> p;
         Polynomial<double> q;
         ...
         Polynomial<double> s = p.subst<Polynomial<double> >(q);

T operator() ( const U &  u  )  const [inline]

Substitute the value u into the polinomial. The calculation will be done using type T (i.e. using the type of the coefficients.)


Generated on Thu Jun 4 04:06:36 2009 for LEMON by  doxygen 1.5.9