Defined in word-range.hpp
.
This namespace contains some functions for creating word_type objects in a compact form.
- Example
01_w + 2
01_w + 01_w
Namespace containing some operators for creating words.
Definition word-range.hpp:2072
Word pow(Word const &x, size_t n)
Returns the power of a word.
Definition word-range.hpp:2230
Word prod(Container const &elts, int first, int last, int step=1)
Returns a product of letters or words.
Definition word-range.hpp:2411
|
letter_type | human_readable_index (char c) |
| Returns the index of a character in human readable order.
|
|
template<typename Word = std::string> |
Word::value_type | human_readable_letter (size_t i) |
| Returns a character by index in human readable order.
|
|
word_type | operator+ (letter_type w, word_type const &u) |
| Concatenate a letter and a word.
|
|
word_type | operator+ (word_type const &u, letter_type w) |
| Concatenate a word and a letter.
|
|
word_type | operator+ (word_type const &u, word_type const &w) |
| Concatenate two words.
|
|
void | operator+= (letter_type a, word_type &u) |
| Concatenate a letter and a word in-place.
|
|
void | operator+= (word_type &u, letter_type a) |
| Concatenate a word and a letter in-place.
|
|
static void | operator+= (word_type &u, word_type const &v) |
| Concatenate a word with another word in-place.
|
|
word_type | pow (std::initializer_list< letter_type > ilist, size_t n) |
| Returns the power of a word.
|
|
std::string | pow (std::string_view w, size_t n) |
| Returns the power of a string.
|
|
template<typename Word> |
Word | pow (Word const &x, size_t n) |
| Returns the power of a word.
|
|
template<typename Word> |
void | pow_inplace (Word &w, size_t n) |
| Power a word in-place.
|
|
template<typename Container, typename Word = Container> |
Word | prod (Container const &elts, int first, int last, int step=1) |
| Returns a product of letters or words.
|
|
template<typename Container, typename Word = Container> |
Word | prod (Container const &elts, size_t last) |
| Returns a product of letters or words.
|
|
static word_type | prod (std::initializer_list< letter_type > const &elts, size_t last) |
| Returns a product of letters.
|
|
static word_type | prod (std::initializer_list< letter_type > ilist, int first, int last, int step=1) |
| Returns a product of letters.
|
|
static std::string | prod (std::initializer_list< std::string_view > const &elts, size_t last) |
| Returns a product of words.
|
|
static std::string | prod (std::initializer_list< std::string_view > const &sv, int first, int last, int step=1) |
| Returns a product of strings.
|
|
static word_type | prod (std::initializer_list< word_type > const &elts, int first, int last, int step=1) |
| Returns a product of words.
|
|
static word_type | prod (std::initializer_list< word_type > const &elts, size_t last) |
| Returns a product of words.
|
|
static std::string | prod (std::string_view elts, size_t last) |
| Returns a product of letters.
|
|
static std::string | prod (std::string_view sv, int first, int last, int step=1) |
| Returns a product of letters.
|
|
template<typename Word = std::string>
Word::value_type human_readable_letter |
( |
size_t | i | ) |
|
This function exists to map the numbers 0
to 255
to the possible values of a char
, in such a way that the first characters are a-zA-Z0-9
. The ascii ranges for these characters are: \([97,
123)\), \([65, 91)\), \([48, 58)\) so the remaining range of chars that are appended to the end after these chars are \([0,48)\), \([58,
65)\), \([91, 97)\), \([123, 255]\).
This function is the inverse of human_readable_index.
- Parameters
-
i | the index of the character. |
- Returns
- A value of type
char
.
- Exceptions
-
template<typename Container, typename Word = Container>
Word prod |
( |
Container const & | elts, |
|
|
int | first, |
|
|
int | last, |
|
|
int | step = 1 ) |
Let elts
correspond to the ordered set \(a_0, a_1, \ldots, a_{n -
1}\), first
to \(f\), last
to \(l\), and step
to \(s\). If \(f \leq l\), let \(k\) be the greatest positive integer such that \(f + ks < l\). Then the function prod
returns the word corresponding to \(a_f a_{f + s} a_{f + 2s} \cdots a_{f +
ks}\). All subscripts are taken modulo \(n\).
If there is no such \(k\) (i.e. \(s < 0\), or \(f = l\)), then the empty word is returned. Where \(f > l\), the function works analogously, where \(k\) is the greatest positive integer such that \(f + k s > l\).
- Template Parameters
-
Container | the type of the 1st argument elts . |
Word | the return type (defaults to Container). |
- Parameters
-
elts | the ordered set. |
first | the first index. |
last | the last index. |
step | the step. |
- Returns
- A Word.
- Exceptions
-
- Examples
prod({
"aba",
"xyz"}, 0, 4, 1)
std::vector< letter_type > word_type
Type for a word over the generators of a semigroup.
Definition types.hpp:101