Regina 7.4 Calculation Engine
|
A lightweight array-like object that indexes smaller permutations within larger permutation groups; that is, it embeds the group S_m inside S_n for some n > m
.
More...
#include <maths/permsn.h>
Public Member Functions | |
constexpr Perm< n > | operator[] (int index) const |
Returns the permutation at the given index. | |
constexpr int | size () |
Returns the total number of permutations on m objects. | |
constexpr bool | operator== (const PermSubSn &) const |
A trivial equality test that always returns true . | |
Static Public Member Functions | |
static constexpr Perm< n > | at (int index) |
Returns the permutation at the given index. | |
A lightweight array-like object that indexes smaller permutations within larger permutation groups; that is, it embeds the group S_m inside S_n for some n > m
.
This class is not intended for end users. Its main purpose is to support other parts of Regina's API, such as Perm<n>::extend()
, and some old (and now deprecated) permutation class constants such as Perm<4>::S3
. This class is hard-coded only for some specific small values of n and m (where the operations are trivial or the compiler can use small lookup tables). If you need to express a smaller permutation using a larger permutation class, you should use Perm<n>::extend()
instead.
This class only offers index-based lookup: you can either use the static function at(index)
, or you can treat an object of
this class like a container and use c[index]
and c.size()
(and in Python, len(c)
). This class does not support iteration in C++ (although Python still allows it because Python detects the array-like structure).
Permutations are indexed according to the template parameter order. In particular, PermSubSn<n, m, order>
indexes permutations in the same order as PermSn<m, order>
.
All operations in this class are fast constant time.
Objects of this type contain no data at all, which means they are trivial to pass by value or swap with std::swap(), and all objects of this type are essentially identical.
Perm<4>::S3
. The "officially
supported" way of accessing the ith permutation of m objects using the type Perm<n>
is Perm<n>::extend(Perm<m>::Sn[i])
.detail
namespace, though as an internal class it is subject to change or removal without notice (see the warning above). Moreover, Python does not support templates, and so the name of this class is constructed by appending n, m and order as suffixes (e.g., PermSubSn4_3_Sign, or PermSubSn5_3_Lex). The only template parameters that are bound in Python are those that are used in Regina's public-facing API (specifically, those that are used by deprecated constants such as Perm4.S3
).n | indicates the return type: permutations of m objects will be returned as the larger type Perm<n> . It is required that 2 ≤ n ≤ 5 . |
m | the number of objects being permuted in the group S_m that we are enumerating. It is required that 1 ≤ m < n . |
order | the way in which this class orders permutations for the purposes of indexing. |
|
staticconstexpr |
Returns the permutation at the given index.
This is a permutation on m objects being returned as the larger type Perm<n>
, and so the unused elements m,m+1,...,n-1
will all be mapped to themselves.
index | an index between 0 and m!-1 inclusive. |
|
constexpr |
|
constexpr |
Returns the permutation at the given index.
This is a permutation on m objects being returned as the larger type Perm<n>
, and so the unused elements m,m+1,...,n-1
will all be mapped to themselves.
This operator is identical to calling the static member function at(). It is provided for convenience so that permutations can be accessed using array-like syntax.
index | an index between 0 and m!-1 inclusive. |
|
constexpr |
Returns the total number of permutations on m objects.
This of course is just m!
.