@@ -35,13 +35,13 @@ namespace alp {
3535 namespace internal {
3636
3737 /* *
38- * Standard less then ( lt) operator.
38+ * Standard less-than (\a lt) operator.
3939 *
40- * Assumes native availability of operator < on the given data types
40+ * Assumes native availability of operator< on the given data types
4141 * or assumes that the relevant operators are properly overloaded.
4242 *
43- * Assumes that the < operator is a strict total order. Non-standard/non-matching
44- * data types or non-standard (overloaded) < operators should
43+ * Assumes that \a lt is a strict total order. Non-standard/non-matching
44+ * data types or non-standard (overloaded) \a operator< should
4545 * therefore be used with caution.
4646 *
4747 * @tparam SET The input data type.
@@ -120,14 +120,99 @@ namespace alp {
120120 };
121121
122122 /* *
123- * Standard equal (eq ) operator.
123+ * Standard greater-than (\a gt ) operator.
124124 *
125- * Assumes native availability of operator == on the given data types
125+ * Assumes native availability of \a operator> on the given data types
126126 * or assumes that the relevant operators are properly overloaded.
127127 *
128- * Assumes that the == operator is an equivalence relation.
128+ * Assumes that \a gt is a strict total order. Non-standard/non-matching
129+ * data types or non-standard (overloaded) \a operator> should
130+ * therefore be used with caution.
131+ *
132+ * @tparam SET The input data type.
133+ */
134+ template < typename SET, enum Backend implementation = config::default_backend >
135+ class gt {
136+
137+ public:
138+ /* * Alias to the left-hand input data type. */
139+ typedef SET left_type;
140+
141+ /* * Alias to the right-hand input data type. */
142+ typedef SET right_type;
143+
144+ /* *
145+ * Whether this relation is \em reflexive; that is,
146+ * for all \a a in \a SET, \f$ a > a \f$.
147+ */
148+ static constexpr bool is_reflexive = false ;
149+
150+ /* *
151+ * Whether this relation is \em irreflexive; that is,
152+ * for all \a a in \a SET, not \f$ a > a \f$.
153+ */
154+ static constexpr bool is_irreflexive = true ;
155+
156+ /* *
157+ * Whether this relation is \em symmetric; that is,
158+ * for all \a a, \a b in \a SET,
159+ * if \f$ a > b \f$ then \f$ b > a \f$.
160+ */
161+ static constexpr bool is_symmetric = false ;
162+
163+ /* *
164+ * Whether this relation is \em antisymmetric; that is,
165+ * for all \a a, \a b in \a SET, if \f$ a > b \f$ and
166+ * \f$ b > a \f$ then \f$ a = b \f$.
167+ */
168+ static constexpr bool is_antisymmetric = true ;
169+
170+ /* *
171+ * Whether this relation is \em transitive; that is,
172+ * for all \a a, \a b, \a c in \a SET, if \f$ a > b \f$ and
173+ * \f$ b > c \f$ then \f$ a > c \f$.
174+ */
175+ static constexpr bool is_transitive = true ;
176+
177+ /* *
178+ * Whether this relation is \em connected (or total); that is,
179+ * for all \a a, \a b in \a SET, if \f$ a \neq b \f$ then
180+ * either \f$ a > b \f$ or \f$ b > a \f$.
181+ */
182+ static constexpr bool is_connected = true ;
183+
184+ /* *
185+ * Whether this relation is <em> strongly connected </em>;
186+ * that is,
187+ * for all \a a, \a b in \a SET,
188+ * either \f$ a > b \f$ or \f$ b > a \f$.
189+ */
190+ static constexpr bool is_strongly_connected = false ;
191+
192+ /* *
193+ * This function checks if <em> a > b </em>.
194+ *
195+ * @param[in] a The left-hand side input. Must be pre-allocated and initialised.
196+ * @param[in] b The right-hand side input. Must be pre-allocated and initialised.
197+ *
198+ * \warning Passing invalid pointers will result in UB.
199+ */
200+ static bool check ( const left_type * __restrict__ const a,
201+ const right_type * __restrict__ const b
202+ ) {
203+ return *a > *b;
204+ }
205+ };
206+
207+ /* *
208+ * Standard equal (\a eq) relation.
209+ *
210+ * Assumes native availability of \a operator== on the given data types
211+ * or assumes that the relevant operators are properly overloaded.
212+ *
213+ * Assumes that \a eq is an equivalence relation.
129214 * Non-standard/non-matching data types or non-standard (overloaded)
130- * == operators should therefore be used with caution.
215+ * \a operator== should therefore be used with caution.
131216 *
132217 * @tparam SET The input data type.
133218 */
@@ -205,13 +290,100 @@ namespace alp {
205290 };
206291
207292 /* *
208- * Standard less then or equal (le ) operator.
293+ * Standard not- equal (\a neq ) operator.
209294 *
210- * Assumes native availability of operator < = on the given data types
295+ * Assumes native availability of \a operator! = on the given data types
211296 * or assumes that the relevant operators are properly overloaded.
212297 *
213- * Assumes that the <= operator is a total order. Non-standard/non-matching
214- * data types or non-standard (overloaded) <= operators should
298+ * While \a neq does not require two values to be members of
299+ * an ordered set, the relation is still assumed to be irreflexive,
300+ * symmetric and connected.
301+ * Non-standard/non-matching data types or non-standard (overloaded)
302+ * \a operator!= should therefore be used with caution.
303+ *
304+ * @tparam SET The input data type.
305+ */
306+ template < typename SET, enum Backend implementation = config::default_backend >
307+ class neq {
308+
309+ public:
310+ /* * Alias to the left-hand input data type. */
311+ typedef SET left_type;
312+
313+ /* * Alias to the right-hand input data type. */
314+ typedef SET right_type;
315+
316+ /* *
317+ * Whether this relation is \em reflexive; that is,
318+ * for all \a a in \a SET, \f$ a \neq a \f$.
319+ */
320+ static constexpr bool is_reflexive = false ;
321+
322+ /* *
323+ * Whether this relation is \em irreflexive; that is,
324+ * for all \a a in \a SET, not \f$ a \neq a \f$.
325+ */
326+ static constexpr bool is_irreflexive = true ;
327+
328+ /* *
329+ * Whether this relation is \em symmetric; that is,
330+ * for all \a a, \a b in \a SET,
331+ * if \f$ a \neq b \f$ then \f$ b \neq a \f$.
332+ */
333+ static constexpr bool is_symmetric = true ;
334+
335+ /* *
336+ * Whether this relation is \em antisymmetric; that is,
337+ * for all \a a, \a b in \a SET, if \f$ a \neq b \f$ and
338+ * \f$ b \neq a \f$ then \f$ a = b \f$.
339+ */
340+ static constexpr bool is_antisymmetric = false ;
341+
342+ /* *
343+ * Whether this relation is \em transitive; that is,
344+ * for all \a a, \a b, \a c in \a SET, if \f$ a \neq b \f$ and
345+ * \f$ b \neq c \f$ then \f$ a \neq c \f$.
346+ */
347+ static constexpr bool is_transitive = false ;
348+
349+ /* *
350+ * Whether this relation is \em connected; that is,
351+ * for all \a a, \a b in \a SET, if \f$ a \neq b \f$ then
352+ * either \f$ a \neq b \f$ or \f$ b \neq a \f$.
353+ */
354+ static constexpr bool is_connected = true ;
355+
356+ /* *
357+ * Whether this relation is <em> strongly connected </em> (or total);
358+ * that is,
359+ * for all \a a, \a b in \a SET,
360+ * either \f$ a \neq b \f$ or \f$ b \neq a \f$.
361+ */
362+ static constexpr bool is_strongly_connected = false ;
363+
364+ /* *
365+ * This function checks if <em> a != b </em>.
366+ *
367+ * @param[in] a The left-hand side input. Must be pre-allocated and initialised.
368+ * @param[in] b The right-hand side input. Must be pre-allocated and initialised.
369+ *
370+ * \warning Passing invalid pointers will result in UB.
371+ */
372+ static bool check ( const left_type * __restrict__ const a,
373+ const right_type * __restrict__ const b
374+ ) {
375+ return *a != *b;
376+ }
377+ };
378+
379+ /* *
380+ * Standard less-than-or-equal (\a le) operator.
381+ *
382+ * Assumes native availability of \a operator<= on the given data types
383+ * or assumes that the relevant operators are properly overloaded.
384+ *
385+ * Assumes that \a le is a total order. Non-standard/non-matching
386+ * data types or non-standard (overloaded) \a operator<= should
215387 * therefore be used with caution.
216388 *
217389 * @tparam SET The input data type.
@@ -289,6 +461,91 @@ namespace alp {
289461 }
290462 };
291463
464+ /* *
465+ * Standard greater-than-or-equal (\a ge) operator.
466+ *
467+ * Assumes native availability of \a operator>= on the given data types
468+ * or assumes that the relevant operators are properly overloaded.
469+ *
470+ * Assumes that \a ge is a total order. Non-standard/non-matching
471+ * data types or non-standard (overloaded) \a operator>= should
472+ * therefore be used with caution.
473+ *
474+ * @tparam SET The input data type.
475+ */
476+ template < typename SET, enum Backend implementation = config::default_backend >
477+ class ge {
478+
479+ public:
480+ /* * Alias to the left-hand input data type. */
481+ typedef SET left_type;
482+
483+ /* * Alias to the right-hand input data type. */
484+ typedef SET right_type;
485+
486+ /* *
487+ * Whether this relation is \em reflexive; that is,
488+ * for all \a a in \a SET, \f$ a \ge a \f$.
489+ */
490+ static constexpr bool is_reflexive = true ;
491+
492+ /* *
493+ * Whether this relation is \em irreflexive; that is,
494+ * for all \a a in \a SET, not \f$ a \ge a \f$.
495+ */
496+ static constexpr bool is_irreflexive = false ;
497+
498+ /* *
499+ * Whether this relation is \em symmetric; that is,
500+ * for all \a a, \a b in \a SET,
501+ * if \f$ a \ge b \f$ then \f$ b \ge a \f$.
502+ */
503+ static constexpr bool is_symmetric = false ;
504+
505+ /* *
506+ * Whether this relation is \em antisymmetric; that is,
507+ * for all \a a, \a b in \a SET, if \f$ a \ge b \f$ and
508+ * \f$ b \ge a \f$ then \f$ a = b \f$.
509+ */
510+ static constexpr bool is_antisymmetric = true ;
511+
512+ /* *
513+ * Whether this relation is \em transitive; that is,
514+ * for all \a a, \a b, \a c in \a SET, if \f$ a \ge b \f$ and
515+ * \f$ b \ge c \f$ then \f$ a \ge c \f$.
516+ */
517+ static constexpr bool is_transitive = true ;
518+
519+ /* *
520+ * Whether this relation is \em connected; that is,
521+ * for all \a a, \a b in \a SET, if \f$ a \neq b \f$ then
522+ * either \f$ a \ge b \f$ or \f$ b \ge a \f$.
523+ */
524+ static constexpr bool is_connected = true ;
525+
526+ /* *
527+ * Whether this relation is <em> strongly connected </em> (or total);
528+ * that is,
529+ * for all \a a, \a b in \a SET,
530+ * either \f$ a \ge b \f$ or \f$ b \ge a \f$.
531+ */
532+ static constexpr bool is_strongly_connected = true ;
533+
534+ /* *
535+ * This function checks if <em> a >= b </em>.
536+ *
537+ * @param[in] a The left-hand side input. Must be pre-allocated and initialised.
538+ * @param[in] b The right-hand side input. Must be pre-allocated and initialised.
539+ *
540+ * \warning Passing invalid pointers will result in UB.
541+ */
542+ static bool check ( const left_type * __restrict__ const a,
543+ const right_type * __restrict__ const b
544+ ) {
545+ return *a >= *b;
546+ }
547+ };
548+
292549 /* *
293550 * This class takes a generic operator implementation and exposes a more
294551 * convenient test() function based on it. This function allows arbitrary
0 commit comments