36 #include <type_traits> 53 template<
class _OP,
template<
typename >
class _ID >
59 "Cannot form a monoid using the given operator since it is not " 62 static_assert( std::is_same< typename _OP::D1, typename _OP::D3 >::value || std::is_same< typename _OP::D2, typename _OP::D3 >::value,
63 "Cannot form a monoid when the output domain does not match at least " 64 "one of its input domains" );
69 typedef typename _OP::D1
D1;
72 typedef typename _OP::D2
D2;
75 typedef typename _OP::D3
D3;
81 template<
typename IdentityType >
110 template<
typename D >
126 template<
class _OP,
template<
typename >
class _ID >
127 struct is_monoid< Monoid< _OP, _ID > > {
129 static const constexpr
bool value =
true;
132 template<
class OP,
template<
typename >
class ID >
133 struct has_immutable_nonzeroes< Monoid< OP, ID > > {
135 std::is_same< OP, typename grb::operators::logical_or< typename OP::D1, typename OP::D2, typename OP::D3 > >
::value;
Used to inspect whether a given operator or monoid is associative.
Definition: type_traits.hpp:202
Monoid()
Constructor that infers a default operator, given the operator type.
Definition: monoid.hpp:99
Used to inspect whether a given type is an ALP monoid.
Definition: type_traits.hpp:85
_OP Operator
The type of the underlying operator.
Definition: monoid.hpp:78
constexpr D getIdentity() const
Retrieves the identity corresponding to this monoid.
Definition: monoid.hpp:111
Provides a set of standard identities for use with ALP.
_ID1< IdentityType > Identity
The underlying identity.
Definition: monoid.hpp:82
_OP::D1 D1
The left-hand side input domain.
Definition: monoid.hpp:56
Operator getOperator() const
Retrieves the underlying operator.
Definition: monoid.hpp:120
Specifies the ALP algebraic type traits.
The ALP/GraphBLAS namespace.
Definition: graphblas.hpp:477
static const constexpr bool value
Whether T is an ALP monoid.
Definition: type_traits.hpp:92
_OP::D2 D2
The right-hand side input domain.
Definition: monoid.hpp:72
_OP::D3 D3
The output domain.
Definition: monoid.hpp:75
Used to inspect whether a given type is an ALP operator.
Definition: type_traits.hpp:104
static const constexpr bool value
Whether T a semiring where nonzeroes are immutable.
Definition: type_traits.hpp:286
Provides a set of standard binary operators.
A generalised monoid.
Definition: monoid.hpp:54