Public Types | Public Member Functions | Public Attributes

alg::monomial_basis< SCA, n_letters, max_degree > Class Template Reference

Implements an interface for the set of words of a finite number of letters. More...

#include <libalgebra.h>

Inheritance diagram for alg::monomial_basis< SCA, n_letters, max_degree >:
alg::free_monomial_basis< SCA, RAT, n_letters, max_degree >

List of all members.

Public Types

typedef std::deque< LETKEY
 A key is an STD dual ended queue of letters.
typedef std::map< KEY, SCA > MAP
 The MAP type.

Public Member Functions

 monomial_basis (void)
 Default constructor. Empty basis.
KEY keyofletter (LET letter) const
 Returns the key corresponding to a letter.
bool letter (const KEY &k) const
 Tells if a key is a letter (i.e. word of length one).
LET getletter (const KEY &k) const
 Returns the first letter of a key.
KEY lparent (const KEY &k) const
 Returns the first letter of a key. For compatibility with lie_basis.
KEY rparent (const KEY &k) const
 Returns the key which corresponds to the sub-word after the first letter.
DEG degree (const KEY &k) const
 Returns the length of the key viewed as a word of letters.
DEG size (void) const
 Returns the size of the basis.
DEG keypos (const KEY &k) const
 Computes the position of a key in the basis total order (it has a cost).
KEY begin (void) const
 Returns the value of the smallest key in the basis.
KEY end (void) const
 Returns the key next the biggest key of the basis.
KEY nextkey (const KEY &k) const
 Returns the key next a given key in the basis.
std::string key2string (const KEY &k) const
 Outputs a key as a string of letters to an std::ostringstream.

Public Attributes

const KEY empty_key
 A default key corresponds to the empty word.

Detailed Description

template<typename SCA, DEG n_letters, DEG max_degree>
class alg::monomial_basis< SCA, n_letters, max_degree >

Implements an interface for the set of words of a finite number of letters.

A basis is a finite total ordered set of keys, its cardinal is size() and its minimal element is begin(). The successor key of a given key is given by nextkey(). The successor of the maximal key is end() and does not belong to the basis. The position of a given key in the total order of the basis is given by keypos(), and equals 1 for begin(). To each letter corresponds a key.

The monomial_basis is a basis for which keys are words of letters, totally ordered by the lexicographical order. Letters corresponds to words of length one. The empty word is a special key which serves for the embeding of scalars into the tensor algebra. The begin() key is the empty word.

Implementation: a key is implemeted using dual ended queue of letters. Letters are natural numbers, enumerated starting from 1, in such a way that n_letters is the biggest letter. We use the lexicographical order. The invalid key made with one occurrence of letter 0 is used for end().

There is no key product here since the monomial_basis class serves as a common ancestor for monomial_basis and shuffle_tensor_basis classes. The implementation of the prod() member function constitutes the essential difference between monomial_basis and shuffle_tensor_basis.


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