atlas
0.6
|
Polynomials with coefficients in |C|. More...
#include <Atlas.h>
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 |
C | up_remainder (C c, Degree d) const |
C & | operator[] (Degree j) |
Polynomial & | operator+= (const Polynomial &q) |
Polynomial & | operator-= (const Polynomial &q) |
Polynomial & | subtract_from (const Polynomial &p) |
Polynomial & | operator*= (C) |
Polynomial & | operator/= (C) |
Polynomial | operator* (C c) const |
Polynomial | operator* (const Polynomial &q) const |
Polynomial & | operator*= (const Polynomial &q) |
Polynomial | operator+ (const Polynomial &q) const |
Polynomial | operator- (const Polynomial &q) const |
Polynomial | operator- () const |
C | 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 |
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
|
inline |
|
explicit |
atlas::polynomials::Polynomial< C >::Polynomial | ( | Degree | d, |
C | 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.
atlas::polynomials::Polynomial< C >::Polynomial | ( | Degree | d, |
const Polynomial< C > & | Q | ||
) |
|
inline |
|
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
|
inline |
|
inline |
|
inline |
|
inline |
C atlas::polynomials::Polynomial< C >::factor_by | ( | C | c, |
Degree | d | ||
) |
|
inline |
bool atlas::polynomials::Polynomial< C >::multi_term | ( | ) | const |
|
inline |
|
inline |
Polynomial< C > atlas::polynomials::Polynomial< C >::operator* | ( | const Polynomial< C > & | q | ) | const |
Polynomial< C > & atlas::polynomials::Polynomial< C >::operator*= | ( | C | c | ) |
|
inline |
|
inline |
Polynomial< C > & atlas::polynomials::Polynomial< C >::operator+= | ( | const Polynomial< C > & | q | ) |
|
inline |
|
inline |
Polynomial< C > & atlas::polynomials::Polynomial< C >::operator-= | ( | const Polynomial< C > & | q | ) |
Polynomial< C > & atlas::polynomials::Polynomial< C >::operator/= | ( | C | c | ) |
|
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).
|
inline |
const C & atlas::polynomials::Polynomial< C >::operator[] | ( | Degree | i | ) | const |
C & atlas::polynomials::Polynomial< C >::operator[] | ( | Degree | j | ) |
std::ostream & atlas::polynomials::Polynomial< C >::print | ( | std::ostream & | strm, |
const char * | x | ||
) | const |
|
inlineprotected |
|
inline |
Polynomial< C > & atlas::polynomials::Polynomial< C >::subtract_from | ( | const Polynomial< C > & | p | ) |
|
inline |
C atlas::polynomials::Polynomial< C >::up_remainder | ( | C | c, |
Degree | d | ||
) | const |
|
private |