89constexpr bool commutativeFlag(
void )
91 if constexpr(
requires {
92 { G::commutative } -> std::convertible_to< bool >;
94 return(
bool( G::commutative ) );
101constexpr bool selectiveFlag(
void )
103 if constexpr(
requires {
104 { G::selective } -> std::convertible_to< bool >;
106 return(
bool( G::selective ) );
117concept Monoid =
requires(
const typename G::Value & a )
119 { G::identity() } -> std::convertible_to< typename G::Value >;
120 { G::combine( a , a ) } -> std::convertible_to< typename G::Value >;
132 { G::inverse( a ) } -> std::convertible_to< typename G::Value >;
148template<
class A ,
class G >
150 Monoid< G > &&
requires(
const typename A::Map & f ,
151 const typename G::Value & a , std::size_t n )
153 { A::id() } -> std::convertible_to< typename A::Map >;
154 { A::compose( f , f ) } -> std::convertible_to< typename A::Map >;
155 { A::apply( f , a , n ) } -> std::convertible_to< typename G::Value >;
162 ! std::is_floating_point_v< typename G::Value >;
194 if constexpr( std::numeric_limits< T >::has_infinity )
195 return( std::numeric_limits< T >::infinity() );
197 return( std::numeric_limits< T >::max() );
201 return( b < a ? b : a );
215 if constexpr( std::numeric_limits< T >::has_infinity )
216 return( -std::numeric_limits< T >::infinity() );
218 return( std::numeric_limits< T >::lowest() );
222 return( a < b ? b : a );
a group whose operation commutes
Definition Algebra.h:137
a monoid of the maps A::Map acting on the values of the monoid G: the identity map A::id(),...
Definition Algebra.h:149
a monoid whose operation commutes, by the opt-in G::commutative
Definition Algebra.h:125
a monoid with the inverse G::inverse( a ), i.e., combine( inverse( a) , a ) and combine( a ,...
Definition Algebra.h:130
a monoid on G::Value: the identity G::identity() and the associative operation G::combine( a ,...
Definition Algebra.h:117
a monoid whose combine( a , b ) is always or , by the opt-in G::selective
Definition Algebra.h:142
constexpr bool exact_v
whether the values of G are exact, false for the floating point types, whose groups drift by rounding...
Definition Algebra.h:161
the selective commutative monoid of the largest value of T, of identity if T has it,...
Definition Algebra.h:209
static constexpr bool selective
one of the two
Definition Algebra.h:212
static constexpr bool commutative
it commutes
Definition Algebra.h:211
static constexpr Value identity(void)
the least value of the type
Definition Algebra.h:214
static constexpr Value combine(const Value &a, const Value &b)
, if they are equivalent
Definition Algebra.h:221
T Value
the maxima
Definition Algebra.h:210
the selective commutative monoid of the least value of T, of identity if T has it,...
Definition Algebra.h:188
static constexpr bool selective
one of the two
Definition Algebra.h:191
static constexpr Value combine(const Value &a, const Value &b)
, if they are equivalent
Definition Algebra.h:200
T Value
the minima
Definition Algebra.h:189
static constexpr Value identity(void)
the largest value of the type
Definition Algebra.h:193
static constexpr bool commutative
it commutes
Definition Algebra.h:190
the abelian group of the sums of T, of identity T()
Definition Algebra.h:171
static constexpr Value combine(const Value &a, const Value &b)
Definition Algebra.h:177
static constexpr bool commutative
Definition Algebra.h:173
static constexpr Value inverse(const Value &a)
Definition Algebra.h:181
static constexpr Value identity(void)
0, the value made by T()
Definition Algebra.h:175
T Value
the sums
Definition Algebra.h:172