chsvlib
chsv helper source code
Tags denoting various algebraic structures.

Defines an algebraic tag used to identify an algebraic structure, some type appertains to. More...

Collaboration diagram for Tags denoting various algebraic structures.:

Classes

struct  additive_group_algebraic_tag
 A containing class implements an algebraic group over addition. More...
 
struct  rng_algebraic_tag
 A containing class satisfies the rng_concept. More...
 
struct  ring_algebraic_tag
 A containing class satisfies the ring_concept. More...
 
struct  commutative_ring_algebraic_tag
 A containing class satisfies the commutative_ring_concept. More...
 
struct  division_ring_algebraic_tag
 A containing class satisfies the division_ring_concept. More...
 
struct  field_algebraic_tag
 A containing class satisfies the field_concept. More...
 
struct  not_an_algebraic_type_tag
 An explicit tag declaring that an enclosing type is not algebraic, which is useful when the type derives from an algebraic type. More...
 

Detailed Description

Defines an algebraic tag used to identify an algebraic structure, some type appertains to.

The tags are introduced to support compile-time program optimization based on specific traits of algebraic (arithmetic) types, both built-in and defined by a user with respect to the algebraic_type concept.

In order to do this support for several algebraic structures is implemented, which are (from most general to most detailed): Rng, ring, commutative ring, division ring, and field.

For a user to create a compatible arithmetic class type, the one should define appropriate publicly available algebraic_category type field within one's class which could be resolved to one of the algebraic tags. Additionally, the user class must be built with respect to the requirements given by a corresponding concept, e.g. for Rng, ring, and so forth with respect to a resolution of algebraic_category type alias. The corresponding chsvlib algorithms are chosen based upon this alias.

To retrieve a tag for a given type one should use algebraic_traits helper template for one's (or built-in arithmetic) type instead of direct access to the field. The template defines a SFINAE friendly type field resolving to one of these tags. Also, since these tags are types with an established inheritance hierarchy, it is useful to use either a helper template is_algebraic_structure or one of corresponding alias templates, such as is_rng, is_division_ring and so on.

Support for built-in arithmetic types is also implemented. As such integral types (char, int, long long, etc.) are considered rings, while floating point types (float, double, long double) are considered fields. Note that the latter is an approximation and can lead to computing errors, since these types only implement a limited subset of rational numbers and hence actually correspond to a ring, not field.

See also
algebraic_traits;
is_algebraic_structure;
is_rng;
is_ring;
is_commutative_ring;
is_division_ring;
is_field.