A polynomial basis class. More...
#include <libalgebra.h>
Classes | |
struct | KEY_LESS |
Public Types | |
typedef std::map< LET, DEG > | KEY |
A key is a map from letters to degrees (i.e. a monomial of letters). | |
typedef RAT | RATIONAL |
The rationals. | |
typedef std::map< KEY, SCA, KEY_LESS > | MAP |
The MAP type. | |
typedef poly< SCA, RAT > | POLY |
The Multivariate Polynomials Algebra element type. | |
Public Member Functions | |
poly_basis (void) | |
Default constructor. Empty basis. | |
SCA | eval_key (const KEY &k, const std::map< LET, SCA > &values) const |
Evaluate the key from a vector of scalars. | |
KEY | keyofletter (LET letter) const |
Returns the key (monomial) corresponding to a letter (variable). | |
KEY | begin (void) const |
Returns the value of the smallest key in the basis. | |
Static Public Member Functions | |
static KEY | prod2 (const KEY &k1, const KEY &k2) |
Multiplication of two monomials, outputted as a monomial. | |
static POLY | prod (const KEY &k1, const KEY &k2) |
Returns the polynomial corresponding to the product of two keys (monomials). | |
static DEG | degree (const KEY &k) |
Returns the degree of a monomial. | |
Public Attributes | |
const KEY | empty_key |
A default key corresponds to the monomial of degree 0. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const std::pair< poly_basis *, KEY > &t) |
Outputs a std::pair<poly_basis*, KEY> to an std::ostream. |
A polynomial basis class.
This is the basis used to implement the polynomial class as a specialisation of the algebra class. A key implements a monomial in several variables, with scalar coefficient one. Each variable corresponds to a letter. The product of monomial, provided by the member function prod(), is the standard commutative product of monomials. The type LET is used to number the variables (i.e. letters). The type SCA is used to evaluate the monomial. In the current implementation, no key is stored in memory, only the member functions are provided.
An empty monomial corresponds to a constant term, i.e. a scalar SCA.
static POLY alg::poly_basis< SCA, RAT >::prod | ( | const KEY & | k1, | |
const KEY & | k2 | |||
) | [inline, static] |
Returns the polynomial corresponding to the product of two keys (monomials).
For polynomials, this product is unidimensional, i.e. it is a key since the product of two monomials (keys) is a monomial (key) again. To satisfy the condtions of algebra, the output is in the form of a polynomial.