Regina 7.4 Calculation Engine
|
Represents a conjugacy class of permutations on n elements. More...
#include <maths/perm.h>
Public Member Functions | |
PermClass () | |
Creates the conjugacy class for the identity permutation. | |
PermClass (const PermClass &src) | |
Creates a copy of the given conjugacy class. | |
PermClass & | operator= (const PermClass &src) |
Sets this to be a copy of the given conjugacy class. | |
bool | operator== (const PermClass &other) const |
Determines whether this and the given object describe the same conjugacy class. | |
bool | isIdentity () const |
Determines whether this is the conjugacy class for the identity permutation. | |
int | cycle (int which) const |
Returns the length of the given cycle in this conjugacy class. | |
int | countCycles () const |
Returns the number of cycles in this conjugacy class. | |
Perm< n > | rep () const |
Returns the minimal representative of this conjugacy class. | |
std::string | str () const |
Returns a string representation of this conjugacy class. | |
PermClass & | operator++ () |
A preincrement operator that changes this to become the next conjugacy class in a lexicographical enumeration. | |
PermClass | operator++ (int) |
A postincrement operator that changes this to become the next conjugacy class in a lexicographical enumeration. | |
operator bool () const | |
Determines whether this represents a genuine conjugacy class, or whether it represents the special past-the-end value. | |
Static Public Attributes | |
static constexpr int | count = detail::countPermClasses[n] |
The total number of distinct conjugacy classes of permutations on n elements. | |
Represents a conjugacy class of permutations on n elements.
Each such conjugacy class correpsonds to an unordered partition of n, describing the cycle structure of the permutations in the conjugacy class.
There is a special "past-the-end" conjugacy class, which effectively holds no value; the only way you can obtain such a class is to iterate through all classes using the increment operators. You can test for a past-the-end value by casting to bool
.
PermClass objects are, in their current implementation, entirely stack-based. This means they cannot support fast move or swap operations. However, their size is linear in n, so while copy operations are not enormously expensive, they are not as cheap as copying a Perm object (which just holds a single machine-native integer). This decision is a deliberate trade-off between speed versus space; the implication for end users is that you should be economical about copying PermClass objects, and work with them in-place where possible.
n | the number of objects being permuted. This must be between 2 and 16 inclusive. |
|
inline |
Creates the conjugacy class for the identity permutation.
The corresponding cycle structure (i.e., partition of n) is n cycles, each of length 1.
|
inline |
Creates a copy of the given conjugacy class.
src | the conjugacy class to clone. |
|
inline |
Returns the number of cycles in this conjugacy class.
Recall from the class notes that a conjugacy class identifies the cycle structure of a permutation. This routine simply returns the number of cycles for this conjugacy class. Fixed points are also counted (they are considered to be cycles of length 1).
|
inline |
Returns the length of the given cycle in this conjugacy class.
Recall from the class notes that a conjugacy class identifies the cycle structure of a permutation. If the cycle lengths are listed in order from shortest to longest, then this routine returns the whichth cycle length in this sequence. Fixed points are included in this sequence (they are considered to be cycles of length 1, and will appear at the beginning of the sequence).
For example, for a conjugacy class in PermClass<9>
with cycle lengths (1,1,3,4)
, calling cycle(2)
will return 3.
which | indicates which cycle length to return; this must be between 0 and countCycles()-1 inclusive. |
|
inline |
Determines whether this is the conjugacy class for the identity permutation.
true
if and only if this conjugacy class represents the identity permutation.
|
inline |
Determines whether this represents a genuine conjugacy class, or whether it represents the special past-the-end value.
See the class notes and the increment operators for further discussion on what past-the-end represents.
false
if this is the past-the-end conjugacy class, or true
otherwise.
|
inline |
A preincrement operator that changes this to become the next conjugacy class in a lexicographical enumeration.
Specifically, the increment operators work through conjugacy classes in lexicographical order, where each class is represented by its sequence of cycle lengths (given in increasing order). Thus the conjugacy class 11...1
(representing the identity permutation) will come first, and the conjugacy class n
(representing a single long cycle) will come last.
If there are no more conjugacy classes (i.e., this represents a single cycle of length n), then this object will be set to the special past-the-end value (which can be tested by casting to a bool
).
|
inline |
A postincrement operator that changes this to become the next conjugacy class in a lexicographical enumeration.
Specifically, the increment operators work through conjugacy classes in lexicographical order, where each class is represented by its sequence of cycle lengths (given in increasing order). Thus the conjugacy class 11...1
(representing the identity permutation) will come first, and the conjugacy class n
(representing a single long cycle) will come last.
If there are no more conjugacy classes (i.e., this represents a single cycle of length n), then this object will be set to the special past-the-end value (which can be tested by casting to a bool
).
|
inline |
Sets this to be a copy of the given conjugacy class.
src | the conjugacy class to clone. |
|
inline |
Determines whether this and the given object describe the same conjugacy class.
Two past-the-end conjugacy classes will be treated as equal.
other | the conjugacy class to compare with this. |
true
if and only if this and the given conjugacy class are identical.
|
inline |
Returns the minimal representative of this conjugacy class.
The minimal representative is the permutation belonging to this class with the smallest index in Perm<n>::Sn.
Because all permutations in the same class must have the same sign, it follows that this is also the permutation in this class with the smallest index in Perm<n>::orderedSn.
|
inline |
Returns a string representation of this conjugacy class.
At present, the string representation consists of a sequence of digits indicating the cycle lengths (where cycle lengths 10,11,...,16 use a,b,...,g
for their respective digits).
If this is the past-the-end conjugacy class, a suitable string will be returned.
|
staticconstexpr |
The total number of distinct conjugacy classes of permutations on n elements.