Cayley
Pseudo-Random Bits from Finite Groups
Public Member Functions | Private Attributes | List of all members
CPowerTable Class Reference

Table of all powers of a permutation. More...

#include <PowerTable.h>

Public Member Functions

 ~CPowerTable ()
 Destructor. More...
 
void Initialize (const CPerm &p)
 Initialize. More...
 
const CPermoperator[] (int n) const
 Look up power of permutation. More...
 
const uint32_t GetOrder () const
 Get the order of the permutation. More...
 

Private Attributes

std::vector< CPerm * > m_stdPower
 Table of powers.
 
uint32_t m_nOrder = 0
 Order of the underlying permutation.
 

Detailed Description

The power table stores power of permutations as an optimization so that we don't have to keep recomputing them. We just keep computing powers until we get the identity permutation (which we eventually do because groups).

Definition at line 17 of file PowerTable.h.

Constructor & Destructor Documentation

◆ ~CPowerTable()

CPowerTable::~CPowerTable ( )

Delete all of the permutations we computed to fill the power table.

Definition at line 8 of file PowerTable.cpp.

Member Function Documentation

◆ GetOrder()

const uint32_t CPowerTable::GetOrder ( ) const

Reader function for the order of the permutation. Assumes that Initialize() has been called.

Returns
The order of the permutation whose powers are in this table.

Definition at line 42 of file PowerTable.cpp.

◆ Initialize()

void CPowerTable::Initialize ( const CPerm p)

Initialize the power table to hold all of the powers of a permutation up to one less than its order.

Parameters
pThe initial permutation.

Definition at line 17 of file PowerTable.cpp.

◆ operator[]()

const CPerm & CPowerTable::operator[] ( int  n) const

Reader function for the permutation table. Assumes that Initialize() has been called.

Parameters
nAn exponent.
Returns
The n'th power of the permutation in this table.

Definition at line 51 of file PowerTable.cpp.