Skip to content

Permutation

A group of permutations

Source permutation_group.hpp

Constructor

Creates an PermutationGroup out of a vector of Permutation objects.

PermutationGroup(permutations::Vector{Permutation})
PermutationGroup(std::vector<Permutation> const &permutations);

Methods

n_sites

Returns the number of sites on which the permutations of the group acts.

n_sites(group::PermutationGroup)
int64_t n_sites() const

size

Returns the size of the permutation group, i.e. the number permutations

size(group::PermutationGroup)
int64_t size() const;

inverse

Given an index of a permutation, it returns the index of the inverse permutation.

inverse(group::PermutationGroup, idx::Integer)
// As a member function
int64_t inverse(int64_t sym) const;

Usage Example

# Define a cyclic group of order 3
p1 = Permutation([1, 2, 3])
p2 = Permutation([2, 3, 1])
p3 = Permutation([3, 1, 2])
C3 = PermutationGroup([p1, p2, p3])

@show size(C3)
@show n_sites(C3)
@show inverse(C3, 1) # = 2
// Define a cyclic group of order 3
Permutation p1 = {0, 1, 2};
Permutation p2 = {1, 2, 0};
Permutation p3 = {2, 0, 1};
auto C3 = PermutationGroup({p1, p2, p3});

XDIAG_SHOW(C3.size());
XDIAG_SHOW(C3.n_sites());
XDIAG_SHOW(C3.inverse(1)); // = 2