Declarations of functions associated with group_F.
Version of Monday 23 September 2024.
This declaration:
/* F1 */ struct perm_bool;
is for this definition:
struct permzbi::perm_bool { permzbi p; bool b; };
When a perm_bool is returned from a function, its members are p containing the next or previous permutation; and b containing false if the result is the first permutation (in the case of next_perm_) or the last (in the case of prev_perm_). In other words, b is false if the calculation had to "wrap around". Otherwise, b is true.
The function names with _modify and _create involve the same considerations as those in group_E. Also, the begin and end parameters have the same significance.
The next four functions presume lexicographical sequence, and are little more than wrappers for the Standard Library's next_permutation and prev_permutation.
/* F1 */ bool next_perm_lex_modify (int begin = 0, int end = −1); /* F1 */ perm_bool next_perm_lex_create (int begin = 0, int end = −1) const; /* F1 */ bool prev_perm_lex_modify (int begin = 0, int end = −1); /* F1 */ perm_bool prev_perm_lex_create (int begin = 0, int end = −1) const;
The next four functions calculate next_perm and prev_perm according to the Steinhaus-Johnson-Trotter sequence. Much of the support for these functions is found in file group_W.permzbi_W1.h.
/* F2 */ bool next_perm_SJT_modify (int begin = 0, int end = −1); /* F2 */ perm_bool next_perm_SJT_create (int begin = 0, int end = −1) const; /* F2 */ bool prev_perm_SJT_modify (int begin = 0, int end = −1); /* F2 */ perm_bool prev_perm_SJT_create (int begin = 0, int end = −1) const;
Function permzbi::first_perm can used with both kinds of sequences, but permzbi::last_perm_lex and permzbi::last_perm_SJT differ.