Cayley
Pseudo-Random Bits from Finite Groups
PowerTable.cpp
Go to the documentation of this file.
1 
4 #include "PowerTable.h"
5 
7 
9  for(auto p: m_stdPower)
10  delete p;
11 } //destructor
12 
16 
18  //clean up in case we are re-initializing
19  for(auto p: m_stdPower)
20  delete p;
21  m_stdPower.clear();
22 
23  //build new table
24 
25  const int n = p.GetSize(); //permutation size
26 
27  m_stdPower.push_back(new CPerm(n)); //first entry is p^0
28  CPerm q(p); //a power of p, which starts out at p^1
29  m_nOrder = 1; //its order might be 1 as far as we know
30 
31  while(!q.IsIdentity()){ //eventually we'll get back to the identity
32  m_stdPower.push_back(new CPerm(q)); //push the current power of p
33  q *= p; //next power of p
34  m_nOrder++; //next order
35  } //while
36 } //Initialize
37 
41 
42 const uint32_t CPowerTable::GetOrder() const{
43  return m_nOrder;
44 } //GetOrder
45 
50 
51 const CPerm& CPowerTable::operator[](int n) const{
52  return *(m_stdPower[n]);
53 } //operator[]
54 
Declaration of the power table class CPowerTable.
const uint32_t GetOrder() const
Get the order of the permutation.
Definition: PowerTable.cpp:42
bool IsIdentity() const
Identity permutation test.
~CPowerTable()
Destructor.
Definition: PowerTable.cpp:8
uint32_t m_nOrder
Order of the underlying permutation.
Definition: PowerTable.h:20
uint8_t GetSize() const
Get size.
Permutation.
Definition: Permutation.h:20
const CPerm & operator[](int n) const
Look up power of permutation.
Definition: PowerTable.cpp:51
std::vector< CPerm * > m_stdPower
Table of powers.
Definition: PowerTable.h:19
void Initialize(const CPerm &p)
Initialize.
Definition: PowerTable.cpp:17