A class to store and manipulate associative algebras elements. More...
#include <algebra.h>
Classes | |
struct | rational_post_div |
function object for post-multiplying a scalar by stored version of the scalar 1 / rational More... | |
struct | scalar_minus |
function object for changing the sign of a scalar More... | |
struct | scalar_passthrough |
function objects for doing nothing to a scalar More... | |
struct | scalar_post_mult |
function object for post-multiplying a scalar by a scalar More... | |
struct | wraprational |
struct | wrapscalar |
Public Types | |
typedef sparse_vector< BASIS > | VECT |
The inherited sparse vector type. | |
typedef VECT::iterator | iterator |
Import of the iterator type from sparse_vector. | |
typedef VECT::const_iterator | const_iterator |
Import of the constant iterator type from sparse_vector. | |
typedef VECT::KEY | KEY |
Import of the KEY type from sparse_vector. | |
typedef VECT::SCALAR | SCALAR |
Import of the SCALAR type from sparse_vector. | |
typedef VECT::RATIONAL | RATIONAL |
Import of the RATIONAL type from sparse_vector. | |
Public Member Functions | |
template<class Transform , unsigned DEPTH1> | |
void | triangularbufferedmultiplyandcombine (const algebra &rhs, algebra &result, Transform fn) const |
template<class Transform > | |
void | squarebufferedmultiplyandcombine (const algebra &rhs, algebra &result, Transform fn) const |
template<unsigned DEPTH1> | |
void | bufferedmultiplyandadd (const algebra &rhs, algebra &result) const |
multiplies *this and rhs adding it to result | |
template<> | |
void | bufferedmultiplyandadd (const algebra &rhs, algebra &result) const |
multiplies *this and rhs adding it to result without optimizations coming from degree | |
template<unsigned DEPTH1> | |
void | bufferedmultiplyandsub (const algebra &rhs, algebra &result) const |
multiplies *this and rhs subtracting it from result | |
template<> | |
void | bufferedmultiplyandsub (const algebra &rhs, algebra &result) const |
multiplies *this and rhs subtracting it to result without optimizations coming from degree | |
template<unsigned DEPTH1> | |
void | bufferedmultiplyandsmult (const wrapscalar &ss, const algebra &rhs, algebra &result) const |
multiplies *this and rhs adds it * s to result | |
template<> | |
void | bufferedmultiplyandsmult (const wrapscalar &ss, const algebra &rhs, algebra &result) const |
multiplies *this and rhs adds it * s to result without optimizations coming from degree | |
template<unsigned DEPTH1> | |
void | bufferedmultiplyandsdiv (const algebra &rhs, const wraprational &ss, algebra &result) const |
multiplies *this and rhs adds it * s to result | |
template<> | |
void | bufferedmultiplyandsdiv (const algebra &rhs, const wraprational &ss, algebra &result) const |
multiplies *this and rhs adds it * s to result without optimizations coming from degree | |
algebra (void) | |
Default constructor. | |
algebra (const algebra &a) | |
Copy constructor. | |
algebra (const VECT &v) | |
Constructs an algebra instance from a sparse_vector. | |
algebra (const KEY &k, const SCALAR &s=VECT::one) | |
Unidimensional constructor. | |
algebra & | operator*= (const SCALAR &s) |
Multiplies the instance with scalar s. | |
algebra & | operator/= (const RATIONAL &s) |
Divides the instance by scalar s. | |
__DECLARE_BINARY_OPERATOR (algebra,*,*=, SCALAR) inline __DECLARE_BINARY_OPERATOR(algebra | |
SCALAR | __DECLARE_BINARY_OPERATOR (algebra,+,+=, algebra) inline __DECLARE_BINARY_OPERATOR(algebra |
SCALAR algebra | __DECLARE_UNARY_OPERATOR (algebra,-,-, VECT) |
Ensures that the return type is an instance of algebra. | |
algebra & | operator*= (const algebra &rhs) |
Multiplies the instance by an instance of algebra. | |
__DECLARE_BINARY_OPERATOR (algebra,*,*=, algebra) | |
Binary version of the product of algebra instances. | |
algebra & | add_mul (const algebra &a, const algebra &b) |
Adds to the instance a product of algebra instances. | |
algebra & | sub_mul (const algebra &a, const algebra &b) |
Subtracts to the instance a product of algebra instances. | |
algebra & | mul_scal_prod (const algebra &rhs, const SCALAR &s) |
Multiplies the instance by (algebra instance)*s. | |
algebra & | mul_scal_div (const algebra &rhs, const RATIONAL &s) |
Multiplies the instance by (algebra instance)/s. | |
algebra | truncate (const DEG min, const DEG max) const |
Returns a truncated version of the instance, by using basis::degree(). | |
DEG | degree (void) const |
Returns the degree of the instance by using basis:degree(). | |
Static Public Attributes | |
static const DEG | MAX_DEGREE = BASIS::MAX_DEGREE |
Friends | |
algebra | commutator (const algebra &a, const algebra &b) |
Returns an instance of the commutator of two algebra instances. |
A class to store and manipulate associative algebras elements.
The template class BASIS must (1) Satisfies the assumptions made by the sparse_vector template class. (2) Provides two member functions DEG BASIS::degree(const KEY&) const BASIS::prod(const KEY&, const KEY&) with a return type suitable for use as the first arg of sparse_vector::add_scal_prod(). (3) The sparse_vector::MAP class must provide the swap() member function.
Default constructor.
Constructs an empty algebra element.
algebra< BASIS >::__DECLARE_BINARY_OPERATOR | ( | algebra< BASIS > | , | |
* | , | |||
* | , | |||
SCALAR | ||||
) | [inline] |
Ensures that the return type is an instance of algebra.
SCALAR algebra< BASIS >::__DECLARE_BINARY_OPERATOR | ( | algebra< BASIS > | , | |
+ | , | |||
+ | , | |||
algebra< BASIS > | ||||
) | [inline] |
Ensures that the return type is an instance of algebra.