Regina 7.3 Calculation Engine
Public Member Functions | Static Public Attributes | List of all members
regina::PermClass< n > Class Template Reference

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. More...
 
 PermClass (const PermClass &src)
 Creates a copy of the given conjugacy class. More...
 
PermClassoperator= (const PermClass &src)
 Sets this to be a copy of the given conjugacy class. More...
 
bool operator== (const PermClass &other) const
 Determines whether this and the given object describe the same conjugacy class. More...
 
bool operator!= (const PermClass &other) const
 Determines whether this and the given object describe different conjugacy classes. More...
 
bool isIdentity () const
 Determines whether this is the conjugacy class for the identity permutation. More...
 
int cycle (int which) const
 Returns the length of the given cycle in this conjugacy class. More...
 
int countCycles () const
 Returns the number of cycles in this conjugacy class. More...
 
Perm< n > rep () const
 Returns the minimal representative of this conjugacy class. More...
 
std::string str () const
 Returns a string representation of this conjugacy class. More...
 
PermClassoperator++ ()
 A preincrement operator that changes this to become the next conjugacy class in a lexicographical enumeration. More...
 
PermClass operator++ (int)
 A postincrement operator that changes this to become the next conjugacy class in a lexicographical enumeration. More...
 
 operator bool () const
 Determines whether this represents a genuine conjugacy class, or whether it represents the special past-the-end value. More...
 

Static Public Attributes

static constexpr int count = detail::countPermClasses[n]
 The total number of distinct conjugacy classes of permutations on n elements. More...
 

Detailed Description

template<int n>
class regina::PermClass< n >

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.

Python
Python does not support templates. For each n = 2,...,16, this class is available in Python under the corresponding name PermClass2, PermClass3, ..., PermClass16.
Template Parameters
nthe number of objects being permuted. This must be between 2 and 16 inclusive.

Constructor & Destructor Documentation

◆ PermClass() [1/2]

template<int n>
regina::PermClass< n >::PermClass
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.

◆ PermClass() [2/2]

template<int n>
regina::PermClass< n >::PermClass ( const PermClass< n > &  src)
inline

Creates a copy of the given conjugacy class.

Parameters
srcthe conjugacy class to clone.

Member Function Documentation

◆ countCycles()

template<int n>
int regina::PermClass< n >::countCycles
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).

Returns
the number of cycles.

◆ cycle()

template<int n>
int regina::PermClass< n >::cycle ( int  which) const
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.

Parameters
whichindicates which cycle length to return; this must be between 0 and countCycles()-1 inclusive.
Returns
the requested cycle length.

◆ isIdentity()

template<int n>
bool regina::PermClass< n >::isIdentity
inline

Determines whether this is the conjugacy class for the identity permutation.

Returns
true if and only if this conjugacy class represents the identity permutation.

◆ operator bool()

template<int n>
regina::PermClass< n >::operator bool
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.

Returns
false if this is the past-the-end conjugacy class, or true otherwise.

◆ operator!=()

template<int n>
bool regina::PermClass< n >::operator!= ( const PermClass< n > &  other) const
inline

Determines whether this and the given object describe different conjugacy classes.

Two past-the-end conjugacy classes will be treated as equal.

Parameters
otherthe conjugacy class to compare with this.
Returns
true if and only if this and the given conjugacy class are different.

◆ operator++() [1/2]

template<int n>
PermClass< n > & regina::PermClass< n >::operator++
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).

Python
Not present. The postincrement operator is present in Python as the member function inc().
Returns
a reference to this conjugacy class after the increment.

◆ operator++() [2/2]

template<int n>
PermClass< n > regina::PermClass< n >::operator++ ( int  )
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).

Python
This routine is named inc() since python does not support the increment operator.
Returns
a copy of this conjugacy class before the increment took place.

◆ operator=()

template<int n>
PermClass< n > & regina::PermClass< n >::operator= ( const PermClass< n > &  src)
inline

Sets this to be a copy of the given conjugacy class.

Parameters
srcthe conjugacy class to clone.
Returns
a reference to this conjugacy class.

◆ operator==()

template<int n>
bool regina::PermClass< n >::operator== ( const PermClass< n > &  other) const
inline

Determines whether this and the given object describe the same conjugacy class.

Two past-the-end conjugacy classes will be treated as equal.

Parameters
otherthe conjugacy class to compare with this.
Returns
true if and only if this and the given conjugacy class are identical.

◆ rep()

template<int n>
Perm< n > regina::PermClass< n >::rep
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.

Precondition
This is not the past-the-end conjugacy class.
Returns
the minimal representative of this conjugacy class.

◆ str()

template<int n>
std::string regina::PermClass< n >::str
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.

Returns
a string representation of this conjugacy class.

Member Data Documentation

◆ count

template<int n>
constexpr int regina::PermClass< n >::count = detail::countPermClasses[n]
staticconstexpr

The total number of distinct conjugacy classes of permutations on n elements.


The documentation for this class was generated from the following file:

Copyright © 1999-2023, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).