![]() |
Symmetric Polynomials
V3.1
A C++ library for generating symmetric polynomials with relations
|
The default ordered/unordered monomial container. More...
#include <Polynomials.hpp>
Classes | |
class | ConstIterator |
Constant iterator traversing the monomials of a polynomial. More... | |
class | Iterator |
Non const iterator traversing the monomials of a polynomial. More... | |
Public Member Functions | |
size_t | number_of_monomials () const |
Returns number of monomials in the polynomial. More... | |
bool | operator== (const DefaultContainer &) const |
Equality of polynomials. More... | |
bool | operator!= (const DefaultContainer &b) const |
Inequality of polynomials. More... | |
void | reserve (size_t n) |
Reserve number of monomials in polynomial. More... | |
void | insert (const exp_t &exp, scl_t coeff) |
Inserts monomial in polynomial. More... | |
ConstIterator | begin () const |
ConstIterator to the first monomial. More... | |
ConstIterator | end () const |
ConstIterator to just after the final monomial. More... | |
ConstIterator | highest_term () const |
ConstIterator to the highest term monomial. More... | |
Protected Types | |
typedef _scl | scl_t |
The scalar (coefficient) type eg int64_t . More... | |
typedef _exp | exp_t |
The exponent (variable) type eg StandardVariables or HalfIdempotentVariables . More... | |
typedef _exp::deg_t | deg_t |
The degree type eg size_t . More... | |
Protected Member Functions | |
Iterator | begin () |
Iterator to the first monomial. More... | |
Iterator | end () |
Iterator to just after the final monomial. More... | |
void | add (const std::pair< const std::pair< deg_t, exp_t >, scl_t > &kvp) |
Adds given monomial to polynomial. More... | |
void | subtract (const std::pair< const std::pair< deg_t, exp_t >, scl_t > &kvp) |
Subtracts given monomial from polynomial. More... | |
void | multiply_add (const std::pair< const std::pair< deg_t, exp_t >, scl_t > &kvp1, const std::pair< const std::pair< deg_t, exp_t >, scl_t > &kvp2) |
Multiplies the two given monomials and then adds the product to polynomial. More... | |
![]() | |
BaseContainer (const deg_t *dimensions=nullptr) | |
Constructor given pointer to dimensions of the variables. More... | |
deg_t | compute_degree (const _exp &exponent) const |
Computes degree of given exponent. More... | |
Additional Inherited Members | |
![]() | |
const deg_t * | dimensions |
The pointer to the dimensions of the variables. More... | |
The default ordered/unordered monomial container.
Monomials are stored as key-value pairs where each key consists of degree+exponent and the value is the coefficient of the monomial.
_scl | The scalar/coefficient type of the monomials eg float or int64_t |
_exp | The variable/exponent type of the monomials eg StandardVariables or HalfIdempotentVariables |
_cnt | The underlying container: this should be equivalent to std::map if _ord==1 and std::unordered_map otherwise |
_ord | This should be 1 if _cnt is equivalent to std::map and 0 if it's equivalent to std::unordered_map |
_arg | Any extra optional arguments to pass to _cnt apart from key,value, comparator/hash (the latter two are provided in _exp ) eg an allocator |
_ord==1
then exp_t
needs to have a comparator bool operator<(const _exp&) const
and otherwise exp_t
needs to have a hash function size_t operator()() const
exp_t
|
protected |
The scalar (coefficient) type eg int64_t
.
|
protected |
The exponent (variable) type eg StandardVariables
or HalfIdempotentVariables
.
|
protected |
The degree type eg size_t
.
size_t number_of_monomials | ( | ) | const |
Returns number of monomials in the polynomial.
bool operator== | ( | const DefaultContainer< _scl, _exp, _cnt, _ord, _arg > & | ) | const |
Equality of polynomials.
bool operator!= | ( | const DefaultContainer< _scl, _exp, _cnt, _ord, _arg > & | b | ) | const |
Inequality of polynomials.
void reserve | ( | size_t | n | ) |
Reserve number of monomials in polynomial.
n | Number to reserve |
_ord==1
Inserts monomial in polynomial.
exp | The exponent of the monomial. |
coeff | The coefficient of the monomial. |
coeff
is not 0 ConstIterator begin | ( | ) | const |
ConstIterator to the first monomial.
ConstIterator end | ( | ) | const |
ConstIterator to just after the final monomial.
ConstIterator highest_term | ( | ) | const |
ConstIterator to the highest term monomial.
Adds given monomial to polynomial.
kvp | The key-value pair representing the monomial |
Subtracts given monomial from polynomial.
kvp | The key-value pair representing the monomial |
|
protected |
Multiplies the two given monomials and then adds the product to polynomial.
kvp1 | The key-value pair representing the first monomial |
kvp2 | The key-value pair representing the second monomial |