27 #ifndef _H_GRB_IDENTITIES 28 #define _H_GRB_IDENTITIES 53 namespace identities {
56 template<
typename D >
58 static_assert( std::is_convertible< int, D >::value,
"Cannot form identity under the requested domain" );
66 return static_cast< D >( 0 );
69 template<
typename K,
typename V >
70 class zero< std::pair< K, V > > {
72 static constexpr std::pair< K, V >
value() {
78 template<
typename D >
80 static_assert( std::is_convertible< int, D >::value,
"Cannot form identity under the requested domain" );
88 return static_cast< D >( 1 );
91 template<
typename K,
typename V >
92 class one< std::pair< K, V > > {
94 static constexpr std::pair< K, V >
value() {
100 template<
typename D >
102 static_assert( std::is_arithmetic< D >::value,
"Cannot form identity under the requested domain" );
111 return std::numeric_limits< D >::has_infinity ? std::numeric_limits< D >::infinity() : std::numeric_limits< D >::max();
114 template<
typename K,
typename V >
115 class infinity< std::pair< K, V > > {
117 static constexpr std::pair< K, V >
value() {
123 template<
typename D >
125 static_assert( std::is_arithmetic< D >::value,
"Cannot form identity under the requested domain" );
134 return std::numeric_limits< D >::min() == 0 ? 0 : ( std::numeric_limits< D >::has_infinity ? -std::numeric_limits< D >::infinity() : std::numeric_limits< D >::min() );
137 template<
typename K,
typename V >
138 class negative_infinity< std::pair< K, V > > {
140 static constexpr std::pair< K, V >
value() {
150 template<
typename D >
152 static_assert( std::is_convertible< bool, D >::value,
"Cannot form identity under the requested domain" );
161 return static_cast< D >(
false );
164 template<
typename K,
typename V >
165 class logical_false< std::pair< K, V > > {
167 static constexpr std::pair< K, V >
value() {
177 template<
typename D >
179 static_assert( std::is_convertible< bool, D >::value,
"Cannot form identity under the requested domain" );
188 return static_cast< D >(
true );
191 template<
typename K,
typename V >
192 class logical_true< std::pair< K, V > > {
194 static constexpr std::pair< K, V >
value() {
Standard identity for numerical addition.
Definition: identities.hpp:57
static constexpr D value()
Definition: identities.hpp:187
Standard identity for numerical multiplication.
Definition: identities.hpp:79
Standard identity for the minimum operator.
Definition: identities.hpp:101
Standard identitity for the logical or operator.
Definition: identities.hpp:151
static const constexpr D value()
Definition: identities.hpp:160
Standard identity for the logical AND operator.
Definition: identities.hpp:178
The ALP/GraphBLAS namespace.
Definition: graphblas.hpp:477
static constexpr D value()
Definition: identities.hpp:65
static constexpr D value()
Definition: identities.hpp:87
static constexpr D value()
Definition: identities.hpp:110
static constexpr D value()
Definition: identities.hpp:133
Standard identity for the maximum operator.
Definition: identities.hpp:124