This page contains the documentation for several class and function templates for comparing words or strings with respect to certain reduction orderings.
Classes | |
| struct | LexicographicalCompare |
| A stateless struct with binary call operator using std::lexicographical_compare. More... | |
| struct | RecursivePathCompare |
| A stateless struct with binary call operator using recursive_path_compare. More... | |
| struct | ShortLexCompare |
| A stateless struct with binary call operator using shortlex_compare. More... | |
| struct | WtLexCompare |
| A stateful struct with binary call operator using wt_lex_compare or wt_lex_compare_no_checks. More... | |
| struct | WtShortLexCompare |
| A stateful struct with binary call operator using wt_shortlex_compare or wt_shortlex_compare_no_checks. More... | |
Functions | |
| template<typename Thing> | |
| bool | lexicographical_compare (Thing *const x, Thing *const y) |
| Compare two objects via their pointers using std::lexicographical_compare. | |
| template<typename Thing, typename = std::enable_if_t<!rx::is_input_or_sink_v<Thing>>> | |
| bool | lexicographical_compare (Thing const &x, Thing const &y) |
| Compare two objects of the same type using std::lexicographical_compare. | |
| template<typename Iterator, typename = std::enable_if_t<!rx::is_input_or_sink_v<Iterator>>> | |
| bool | recursive_path_compare (Iterator first1, Iterator last1, Iterator first2, Iterator last2) noexcept |
| Compare two objects of the same type using the recursive path comparison. | |
| template<typename Thing> | |
| bool | recursive_path_compare (Thing *const x, Thing *const y) noexcept |
| Compare two objects via their pointers using recursive_path_compare. | |
| template<typename Thing, typename = std::enable_if_t<!rx::is_input_or_sink_v<Thing>>> | |
| bool | recursive_path_compare (Thing const &x, Thing const &y) noexcept |
| Compare two objects of the same type using recursive_path_compare. | |
| template<typename Iterator, typename = std::enable_if_t<!rx::is_input_or_sink_v<Iterator>>> | |
| bool | shortlex_compare (Iterator first1, Iterator last1, Iterator first2, Iterator last2) |
| Compare two objects of the same type using the short-lex reduction ordering. | |
| template<typename Thing> | |
| bool | shortlex_compare (Thing *const x, Thing *const y) |
| Compare two objects via their pointers using shortlex_compare. | |
| template<typename Thing, typename = std::enable_if_t<!rx::is_input_or_sink_v<Thing>>> | |
| bool | shortlex_compare (Thing const &x, Thing const &y) |
| Compare two objects of the same type using shortlex_compare. | |
| template<typename Iterator, typename = std::enable_if_t<!rx::is_input_or_sink_v<Iterator>>> | |
| bool | wt_lex_compare (Iterator first1, Iterator last1, Iterator first2, Iterator last2, std::vector< size_t > const &weights) |
| Compare two objects of the same type using the weighted lex ordering and check validity. | |
| template<typename Thing> | |
| bool | wt_lex_compare (Thing *const x, Thing *const y, std::vector< size_t > const &weights) |
| Compare two objects via their pointers using wt_lex_compare and check validity. | |
| template<typename Thing, typename = std::enable_if_t<!rx::is_input_or_sink_v<Thing>>> | |
| bool | wt_lex_compare (Thing const &x, Thing const &y, std::vector< size_t > const &weights) |
| Compare two objects of the same type using wt_lex_compare and check validity. | |
| template<typename Iterator, typename = std::enable_if_t<!rx::is_input_or_sink_v<Iterator>>> | |
| bool | wt_lex_compare_no_checks (Iterator first1, Iterator last1, Iterator first2, Iterator last2, std::vector< size_t > const &weights) |
| Compare two objects of the same type using the weighted lex ordering without checks. | |
| template<typename Thing> | |
| bool | wt_lex_compare_no_checks (Thing *const x, Thing *const y, std::vector< size_t > const &weights) |
| Compare two objects via their pointers using wt_lex_compare_no_checks without checks. | |
| template<typename Thing, typename = std::enable_if_t<!rx::is_input_or_sink_v<Thing>>> | |
| bool | wt_lex_compare_no_checks (Thing const &x, Thing const &y, std::vector< size_t > const &weights) |
| Compare two objects of the same type using wt_lex_compare_no_checks without checks. | |
| template<typename Iterator, typename = std::enable_if_t<!rx::is_input_or_sink_v<Iterator>>> | |
| bool | wt_shortlex_compare (Iterator first1, Iterator last1, Iterator first2, Iterator last2, std::vector< size_t > const &weights) |
| Compare two objects of the same type using the weighted short-lex ordering and check validity. | |
| template<typename Thing> | |
| bool | wt_shortlex_compare (Thing *const x, Thing *const y, std::vector< size_t > const &weights) |
| Compare two objects via their pointers using wt_shortlex_compare and check validity. | |
| template<typename Thing, typename = std::enable_if_t<!rx::is_input_or_sink_v<Thing>>> | |
| bool | wt_shortlex_compare (Thing const &x, Thing const &y, std::vector< size_t > const &weights) |
| Compare two objects of the same type using wt_shortlex_compare and check validity. | |
| template<typename Iterator, typename = std::enable_if_t<!rx::is_input_or_sink_v<Iterator>>> | |
| bool | wt_shortlex_compare_no_checks (Iterator first1, Iterator last1, Iterator first2, Iterator last2, std::vector< size_t > const &weights) |
| Compare two objects of the same type using the weighted short-lex ordering without checks. | |
| template<typename Thing> | |
| bool | wt_shortlex_compare_no_checks (Thing *const x, Thing *const y, std::vector< size_t > const &weights) |
| Compare two objects via their pointers using wt_shortlex_compare_no_checks without checks. | |
| template<typename Thing, typename = std::enable_if_t<!rx::is_input_or_sink_v<Thing>>> | |
| bool | wt_shortlex_compare_no_checks (Thing const &x, Thing const &y, std::vector< size_t > const &weights) |
| Compare two objects of the same type using wt_shortlex_compare_no_checks without checks. | |
|
nodiscard |
Defined in order.hpp.
This function compares two objects via their pointers using std::lexicographical_compare.
| Thing | the type of the objects to be compared. |
| x | pointer to the first object for comparison. |
| y | pointer to the second object for comparison. |
true if x is lexicographically less than y, and false otherwise.
|
nodiscard |
Defined in order.hpp.
This function compares two objects of the same type using std::lexicographical_compare.
| Thing | the type of the objects to be compared. |
| x | const reference to the first object for comparison. |
| y | const reference to the second object for comparison. |
true if x is lexicographically less than y, and false otherwise.
|
nodiscardnoexcept |
Defined in order.hpp.
This function compares two objects of the same type using the recursive path comparison described in [38] (Definition 1.2.14, page 24).
If \(u, v\in X ^ {*}\), \(u \neq v\), and \(u = a'u\), \(v = bv'\) for some \(a,b \in X\), \(u',v'\in X ^ {*}\), then \(u > v\) if one of the following conditions holds:
This documentation and the implementation of recursive_path_compare is based on the source code of [35].
| Iterator | the type of iterators that are the arguments. |
| first1 | beginning iterator of first object for comparison. |
| last1 | ending iterator of first object for comparison. |
| first2 | beginning iterator of second object for comparison. |
| last2 | ending iterator of second object for comparison. |
true if the range [first1, last1) is less than the range [first2, last2) with respect to the recursive path ordering, and false otherwise.noexcept and is guaranteed never to throw.
|
nodiscardnoexcept |
Defined in order.hpp.
This function compares two objects via their pointers using recursive_path_compare.
| Thing | the type of the objects to be compared. |
| x | pointer to the first object for comparison. |
| y | pointer to the second object for comparison. |
true if the value pointed to by x is less than the value pointed to by y with r to the recursive path ordering, and false otherwise.noexcept and is guaranteed never to throw.
|
nodiscardnoexcept |
Defined in order.hpp.
This function compares two objects of the same type using recursive_path_compare.
| Thing | the type of the objects to be compared. |
| x | const reference to the first object for comparison. |
| y | const reference to the second object for comparison. |
true if x is less than y with respect to the recursive path ordering, and false otherwise.noexcept and is guaranteed never to throw.
|
nodiscard |
Defined in order.hpp.
This function compares two objects of the same type using the short-lex reduction ordering.
| Iterator | the type of iterators that are the parameters. |
| first1 | beginning iterator of first object for comparison. |
| last1 | ending iterator of first object for comparison. |
| first2 | beginning iterator of second object for comparison. |
| last2 | ending iterator of second object for comparison. |
true if the range [first1, last1) is short-lex less than the range [first2, last2), and false otherwise.last1 and first1, and the distance between last2 and first2.
|
nodiscard |
Defined in order.hpp.
This function compares two objects via their pointers using shortlex_compare.
| Thing | the type of the objects to be compared. |
| x | pointer to the first object for comparison. |
| y | pointer to the second object for comparison. |
true if x points to a word short-lex less than the word pointed to by y, and false otherwise.x and the length of word pointed to by y.
|
nodiscard |
Defined in order.hpp.
This function compares two objects of the same type using shortlex_compare.
| Thing | the type of the objects to be compared. |
| x | const reference to the first object for comparison. |
| y | const reference to the second object for comparison. |
true if x is short-lex less than y, and false otherwise.x and the length of y.
|
nodiscard |
Defined in order.hpp.
This function compares two objects of the same type using the weighted lex ordering. The weight of a word is computed by adding up the weights of the letters in the word, where the ith index of the weights vector corresponds to the weight of the ith letter in the alphabet. Heavier words come later in the ordering than all lighter words. Amongst words of equal weight, lexicographic ordering is used.
After checking that all letters in both ranges are valid indices into the weights vector, this function performs the same as wt_lex_compare_no_checks(first1, last1, first2, last2, weights).
| Iterator | the type of iterators to the first object to be compared. |
| first1 | beginning iterator of first object for comparison. |
| last1 | ending iterator of first object for comparison. |
| first2 | beginning iterator of second object for comparison. |
| last2 | ending iterator of second object for comparison. |
| weights | the weights vector. |
true if the range [first1, last1) is weighted lex less than the range [first2, last2), and false otherwise.| LibsemigroupsException | if any letter in either range is not a valid index into the weights vector (i.e., if any letter is greater than or equal to weights.size()). |
last1 and first1, and \(m\) is the distance between last2 and first2.
|
nodiscard |
Defined in order.hpp.
This function compares two objects via their pointers using wt_lex_compare, where the ith index of the weights vector corresponds to the weight of the ith letter in the alphabet.
After checking that all letters are valid indices into the weights vector, this function performs the same as wt_lex_compare_no_checks(*x, *y, weights).
| Thing | the type of the objects to be compared. |
| x | pointer to the first object for comparison. |
| y | pointer to the second object for comparison. |
| weights | the weights vector. |
true if x points to a word weighted lex less than the word pointed to by y, and false otherwise.| LibsemigroupsException | if any letter is not a valid index into the weights vector. |
x and \(m\) is the length of word pointed to by y.
|
nodiscard |
Defined in order.hpp.
This function compares two objects of the same type using wt_lex_compare, where the ith index of the weights vector corresponds to the weight of the ith letter in the alphabet.
After checking that all letters in both objects are valid indices into the weights vector, this function performs the same as wt_lex_compare_no_checks(x, y, weights).
| Thing | the type of the objects to be compared. |
| x | const reference to the first object for comparison. |
| y | const reference to the second object for comparison. |
| weights | the weights vector. |
true if x is weighted lex less than y, and false otherwise.| LibsemigroupsException | if any letter in x or y is not a valid index into the weights vector. |
x and \(m\) is the length of y.
|
nodiscard |
Defined in order.hpp.
This function compares two objects of the same type using the weighted lex ordering. The weight of a word is computed by adding up the weights of the letters in the word, where the ith index of the weights vector corresponds to the weight of the ith letter in the alphabet. Heavier words come later in the ordering than all lighter words. Amongst words of equal weight, lexicographic ordering is used.
| Iterator | the type of iterators to the first object to be compared. |
| first1 | beginning iterator of first object for comparison. |
| last1 | ending iterator of first object for comparison. |
| first2 | beginning iterator of second object for comparison. |
| last2 | ending iterator of second object for comparison. |
| weights | the weights vector. |
true if the range [first1, last1) is weighted lex less than the range [first2, last2), and false otherwise.last1 and first1, and \(m\) is the distance between last2 and first2.
|
nodiscard |
Defined in order.hpp.
This function compares two objects via their pointers using wt_lex_compare_no_checks, where the ith index of the weights vector corresponds to the weight of the ith letter in the alphabet.
| Thing | the type of the objects to be compared. |
| x | pointer to the first object for comparison. |
| y | pointer to the second object for comparison. |
| weights | the weights vector. |
true if x points to a word weighted lex less than the word pointed to by y, and false otherwise.x and \(m\) is the length of word pointed to by y.
|
nodiscard |
Defined in order.hpp.
This function compares two objects of the same type using wt_lex_compare_no_checks, where the ith index of the weights vector corresponds to the weight of the ith letter in the alphabet.
| Thing | the type of the objects to be compared. |
| x | const reference to the first object for comparison. |
| y | const reference to the second object for comparison. |
| weights | the weights vector. |
true if x is weighted lex less than y, and false otherwise.x and \(m\) is the length of y.x and y are valid indices into the weights vector.
|
nodiscard |
Defined in order.hpp.
This function compares two objects of the same type using the weighted short-lex ordering. The weight of a word is computed by adding up the weights of the letters in the word, where the ith index of the weights vector corresponds to the weight of the ith letter in the alphabet. Heavier words come later in the ordering than all lighter words. Amongst words of equal weight, short-lex ordering is used.
After checking that all letters in both ranges are valid indices into the weights vector, this function performs the same as wt_shortlex_compare_no_checks(first1, last1, first2, last2, weights).
| Iterator | the type of iterators to the first object to be compared. |
| first1 | beginning iterator of first object for comparison. |
| last1 | ending iterator of first object for comparison. |
| first2 | beginning iterator of second object for comparison. |
| last2 | ending iterator of second object for comparison. |
| weights | the weights vector. |
true if the range [first1, last1) is weighted short-lex less than the range [first2, last2), and false otherwise.| LibsemigroupsException | if any letter in either range is not a valid index into the weights vector (i.e., if any letter is greater than or equal to weights.size()). |
last1 and first1, and \(m\) is the distance between last2 and first2.
|
nodiscard |
Defined in order.hpp.
This function compares two objects via their pointers using wt_shortlex_compare, where the ith index of the weights vector corresponds to the weight of the ith letter in the alphabet.
After checking that all letters are valid indices into the weights vector, this function performs the same as wt_shortlex_compare_no_checks(*x, *y, weights).
| Thing | the type of the objects to be compared. |
| x | pointer to the first object for comparison. |
| y | pointer to the second object for comparison. |
| weights | the weights vector. |
true if x points to a word weighted short-lex less than the word pointed to by y, and false otherwise.| LibsemigroupsException | if any letter is not a valid index into the weights vector. |
x and \(m\) is the length of word pointed to by y.
|
nodiscard |
Defined in order.hpp.
This function compares two objects of the same type using wt_shortlex_compare, where the ith index of the weights vector corresponds to the weight of the ith letter in the alphabet.
After checking that all letters in both objects are valid indices into the weights vector, this function performs the same as wt_shortlex_compare_no_checks(x, y, weights).
| Thing | the type of the objects to be compared. |
| x | const reference to the first object for comparison. |
| y | const reference to the second object for comparison. |
| weights | the weights vector. |
true if x is weighted short-lex less than y, and false otherwise.| LibsemigroupsException | if any letter in x or y is not a valid index into the weights vector. |
x and \(m\) is the length of y.
|
nodiscard |
Defined in order.hpp.
This function compares two objects of the same type using the weighted short-lex ordering. The weight of a word is computed by adding up the weights of the letters in the word, where the ith index of the weights vector corresponds to the weight of the ith letter in the alphabet. Heavier words come later in the ordering than all lighter words. Amongst words of equal weight, short-lex ordering is used.
| Iterator | the type of iterators that are the arguments. |
| first1 | beginning iterator of first object for comparison. |
| last1 | ending iterator of first object for comparison. |
| first2 | beginning iterator of second object for comparison. |
| last2 | ending iterator of second object for comparison. |
| weights | the weights vector. |
true if the range [first1, last1) is weighted short-lex less than the range [first2, last2), and false otherwise.last1 and first1, and \(m\) is the distance between last2 and first2.weights vector.
|
nodiscard |
Defined in order.hpp.
This function compares two objects via their pointers using wt_shortlex_compare_no_checks, where the ith index of the weights vector corresponds to the weight of the ith letter in the alphabet.
| Thing | the type of the objects to be compared. |
| x | pointer to the first object for comparison. |
| y | pointer to the second object for comparison. |
| weights | the weights vector. |
true if x points to a word weighted short-lex less than the word pointed to by y, and false otherwise.x and \(m\) is the length of word pointed to by y.
|
nodiscard |
Defined in order.hpp.
This function compares two objects of the same type using wt_shortlex_compare_no_checks, where the ith index of the weights vector corresponds to the weight of the ith letter in the alphabet.
| Thing | the type of the objects to be compared. |
| x | const reference to the first object for comparison. |
| y | const reference to the second object for comparison. |
| weights | the weights vector. |
true if x is weighted short-lex less than y, and false otherwise.x and \(m\) is the length of y.x and y are valid indices into the weights vector.