ALP User Documentation 0.7.0
Algebraic Programming User Documentation
Classes
Algebraic Type Traits

Algebraic type traits allows compile-time reasoning on algebraic structures. More...

Classes

struct  has_immutable_nonzeroes< T >
 Used to inspect whether a given semiring has immutable nonzeroes under addition. More...
 
struct  is_associative< T, typename >
 Used to inspect whether a given operator or monoid is associative. More...
 
struct  is_commutative< T, typename >
 Used to inspect whether a given operator or monoid is commutative. More...
 
struct  is_container< T >
 Used to inspect whether a given type is an ALP/GraphBLAS container. More...
 
struct  is_idempotent< T, typename >
 Used to inspect whether a given operator or monoid is idempotent. More...
 
struct  is_monoid< T >
 Used to inspect whether a given type is an ALP monoid. More...
 
struct  is_object< T >
 Used to inspect whether a given type is an ALP/GraphBLAS object. More...
 
struct  is_operator< T >
 Used to inspect whether a given type is an ALP operator. More...
 
struct  is_semiring< T >
 Used to inspect whether a given type is an ALP semiring. More...
 

Detailed Description

Algebraic type traits allows compile-time reasoning on algebraic structures.

Under algebraic type traits, ALP defines two classes of type traits:

  1. classical type traits, akin to, e.g., std::is_integral, defined over the ALP-specific algebraic objects such as grb::Semiring, and
  2. algebraic type traits that allow for the compile-time introspection of algebraic structures.

Under the first class, the following type traits are defined by ALP:

Under the second class, the following type traits are defined by ALP:

Algebraic type traits are a central concept to ALP; depending on algebraic properties, ALP applies different optimisations. Properties such as associativity furthermore often define whether primitives may be automatically parallelised. Therefore, some primitives only allow algebraic structures with certain properties.

Since algebraic type traits are compile-time, the composition of invalid structures (e.g., composing a monoid out of a non-associative binary operator), or the calling of a primitive using an incompatible algebraic structure, results in an compile-time error. Such errors are furthermore accompanied by clear messages and suggestions.