atlas  0.6
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
atlas::polynomials::Polynomial< C > Class Template Reference

Polynomials with coefficients in |C|. More...

#include <Atlas.h>

Inheritance diagram for atlas::polynomials::Polynomial< C >:
Inheritance graph
[legend]

Public Member Functions

 Polynomial ()
 
 Polynomial (C c)
 
 Polynomial (Degree d, C c)
 Constructs cX^d. More...
 
 Polynomial (Degree d, const Polynomial &Q)
 
template<typename U >
 Polynomial (const Polynomial< U > &src)
 
void swap (Polynomial &other)
 
const C & operator[] (Degree i) const
 
const C coef (Degree i) const
 
bool operator== (const Polynomial &q) const
 
bool operator!= (const Polynomial &q) const
 
bool operator< (const Polynomial &q) const
 Operator < is the default from the standard library < on vector. More...
 
std::vector< C >::const_iterator begin () const
 
std::vector< C >::const_iterator end () const
 
Degree degree () const
 
Degree size () const
 
bool isZero () const
 
bool multi_term () const
 
up_remainder (C c, Degree d) const
 
C & operator[] (Degree j)
 
Polynomialoperator+= (const Polynomial &q)
 
Polynomialoperator-= (const Polynomial &q)
 
Polynomialsubtract_from (const Polynomial &p)
 
Polynomialoperator*= (C)
 
Polynomialoperator/= (C)
 
Polynomial operator* (C c) const
 
Polynomial operator* (const Polynomial &q) const
 
Polynomialoperator*= (const Polynomial &q)
 
Polynomial operator+ (const Polynomial &q) const
 
Polynomial operator- (const Polynomial &q) const
 
Polynomial operator- () const
 
factor_by (C c, Degree d)
 
std::ostream & print (std::ostream &strm, const char *x) const
 

Protected Member Functions

void resize (Degree d)
 
void adjustSize ()
 Adjusts the size of d_data so that it corresponds to the degree + 1. More...
 

Private Attributes

std::vector< C > d_data
 

Detailed Description

template<typename C>
class atlas::polynomials::Polynomial< C >

Polynomials with coefficients in |C|.

The coefficient type |C| could be a signed or unsigned integral type, or any type providing ring operations (operator+, operator*= etc.), for instance modular integers. Moreover comparisons (<, ==, !=) should be defined for STL use, although < need not have any particular mathematical sense

Constructor & Destructor Documentation

template<typename C>
atlas::polynomials::Polynomial< C >::Polynomial ( )
inline
template<typename C >
atlas::polynomials::Polynomial< C >::Polynomial ( c)
explicit
template<typename C >
atlas::polynomials::Polynomial< C >::Polynomial ( Degree  d,
c 
)

Constructs cX^d.

We construct cX^d, and not the zero polynomial, so that our basic assumption about the degree (leading coefficient is nonzero) is satisfied.

template<typename C >
atlas::polynomials::Polynomial< C >::Polynomial ( Degree  d,
const Polynomial< C > &  Q 
)
template<typename C>
template<typename U >
atlas::polynomials::Polynomial< C >::Polynomial ( const Polynomial< U > &  src)
inline

Member Function Documentation

template<typename C >
void atlas::polynomials::Polynomial< C >::adjustSize ( )
protected

Adjusts the size of d_data so that it corresponds to the degree + 1.

Just casts away any leading zero coefficients, possibly all of them

template<typename C>
std::vector<C>::const_iterator atlas::polynomials::Polynomial< C >::begin ( ) const
inline
template<typename C>
const C atlas::polynomials::Polynomial< C >::coef ( Degree  i) const
inline
template<typename C>
Degree atlas::polynomials::Polynomial< C >::degree ( ) const
inline
template<typename C>
std::vector<C>::const_iterator atlas::polynomials::Polynomial< C >::end ( ) const
inline
template<typename C >
C atlas::polynomials::Polynomial< C >::factor_by ( c,
Degree  d 
)
template<typename C>
bool atlas::polynomials::Polynomial< C >::isZero ( ) const
inline
template<typename C >
bool atlas::polynomials::Polynomial< C >::multi_term ( ) const
template<typename C>
bool atlas::polynomials::Polynomial< C >::operator!= ( const Polynomial< C > &  q) const
inline
template<typename C>
Polynomial atlas::polynomials::Polynomial< C >::operator* ( c) const
inline
template<typename C >
Polynomial< C > atlas::polynomials::Polynomial< C >::operator* ( const Polynomial< C > &  q) const
template<typename C >
Polynomial< C > & atlas::polynomials::Polynomial< C >::operator*= ( c)
template<typename C>
Polynomial& atlas::polynomials::Polynomial< C >::operator*= ( const Polynomial< C > &  q)
inline
template<typename C>
Polynomial atlas::polynomials::Polynomial< C >::operator+ ( const Polynomial< C > &  q) const
inline
template<typename C >
Polynomial< C > & atlas::polynomials::Polynomial< C >::operator+= ( const Polynomial< C > &  q)
template<typename C>
Polynomial atlas::polynomials::Polynomial< C >::operator- ( const Polynomial< C > &  q) const
inline
template<typename C>
Polynomial atlas::polynomials::Polynomial< C >::operator- ( ) const
inline
template<typename C >
Polynomial< C > & atlas::polynomials::Polynomial< C >::operator-= ( const Polynomial< C > &  q)
template<typename C >
Polynomial< C > & atlas::polynomials::Polynomial< C >::operator/= ( c)
template<typename C>
bool atlas::polynomials::Polynomial< C >::operator< ( const Polynomial< C > &  q) const
inline

Operator < is the default from the standard library < on vector.

The comparison operation below is only defined in order to allow ordered data types containing polynomials, such as |std::set<Polynomial<int> >|. Currently no such types are used in the Atlas (but initially they were).

template<typename C>
bool atlas::polynomials::Polynomial< C >::operator== ( const Polynomial< C > &  q) const
inline
template<typename C >
const C & atlas::polynomials::Polynomial< C >::operator[] ( Degree  i) const
template<typename C >
C & atlas::polynomials::Polynomial< C >::operator[] ( Degree  j)
template<typename C >
std::ostream & atlas::polynomials::Polynomial< C >::print ( std::ostream &  strm,
const char *  x 
) const
template<typename C>
void atlas::polynomials::Polynomial< C >::resize ( Degree  d)
inlineprotected
template<typename C>
Degree atlas::polynomials::Polynomial< C >::size ( ) const
inline
template<typename C >
Polynomial< C > & atlas::polynomials::Polynomial< C >::subtract_from ( const Polynomial< C > &  p)
template<typename C>
void atlas::polynomials::Polynomial< C >::swap ( Polynomial< C > &  other)
inline
template<typename C >
C atlas::polynomials::Polynomial< C >::up_remainder ( c,
Degree  d 
) const

Member Data Documentation

template<typename C>
std::vector<C> atlas::polynomials::Polynomial< C >::d_data
private

The documentation for this class was generated from the following files: