Public Member Functions | Private Member Functions | Private Attributes
AlgExtGenerator Class Reference

generate all elements in F_p(alpha) starting from 0 More...

#include <cf_generator.h>

Public Member Functions

 AlgExtGenerator (const Variable &a)
 
 ~AlgExtGenerator ()
 
bool hasItems () const
 
void reset ()
 
CanonicalForm item () const
 
void next ()
 
void operator++ ()
 
void operator++ (int)
 
CFGeneratorclone () const
 
 AlgExtGenerator (const Variable &a)
 
 ~AlgExtGenerator ()
 
bool hasItems () const
 
void reset ()
 
CanonicalForm item () const
 
void next ()
 
void operator++ ()
 
void operator++ (int)
 
CFGeneratorclone () const
 
 AlgExtGenerator (const Variable &a)
 
 ~AlgExtGenerator ()
 
bool hasItems () const
 
void reset ()
 
CanonicalForm item () const
 
void next ()
 
void operator++ ()
 
void operator++ (int)
 
CFGeneratorclone () const
 
- Public Member Functions inherited from CFGenerator
 CFGenerator ()
 
virtual ~CFGenerator ()
 
 CFGenerator ()
 
virtual ~CFGenerator ()
 
 CFGenerator ()
 
virtual ~CFGenerator ()
 

Private Member Functions

 AlgExtGenerator ()
 
 AlgExtGenerator (const AlgExtGenerator &)
 
AlgExtGeneratoroperator= (const AlgExtGenerator &)
 
 AlgExtGenerator ()
 
 AlgExtGenerator (const AlgExtGenerator &)
 
AlgExtGeneratoroperator= (const AlgExtGenerator &)
 
 AlgExtGenerator ()
 
 AlgExtGenerator (const AlgExtGenerator &)
 
AlgExtGeneratoroperator= (const AlgExtGenerator &)
 

Private Attributes

Variable algext
 
FFGenerator ** gensf
 
GFGenerator ** gensg
 
int n
 
bool nomoreitems
 

Detailed Description

generate all elements in F_p(alpha) starting from 0

Definition at line 93 of file cf_generator.h.

Constructor & Destructor Documentation

AlgExtGenerator::AlgExtGenerator ( )
private

Definition at line 94 of file cf_generator.cc.

95 {
96  ASSERT( 0, "not a valid generator" );
97 }
#define ASSERT(expression, message)
Definition: cf_assert.h:99
AlgExtGenerator::AlgExtGenerator ( const AlgExtGenerator )
private

Definition at line 99 of file cf_generator.cc.

100 {
101  ASSERT( 0, "not a valid generator" );
102 }
#define ASSERT(expression, message)
Definition: cf_assert.h:99
AlgExtGenerator::AlgExtGenerator ( const Variable a)

Definition at line 110 of file cf_generator.cc.

111 {
112  ASSERT( a.level() < 0, "not an algebraic extension" );
113  ASSERT( getCharacteristic() > 0, "not a finite field" );
114  algext = a;
115  n = degree( getMipo( a ) );
116  if ( getGFDegree() > 1 )
117  {
118  gensg = new GFGenerator * [n];
119  for ( int i = 0; i < n; i++ )
120  gensg[i] = new GFGenerator();
121  }
122  else
123  {
124  gensf = new FFGenerator * [n];
125  for ( int i = 0; i < n; i++ )
126  gensf[i] = new FFGenerator();
127  }
128  nomoreitems = false;
129 }
int level() const
Definition: factory.h:132
const poly a
Definition: syzextra.cc:212
generate all elements in F_p starting from 0
Definition: cf_generator.h:55
FFGenerator ** gensf
Definition: cf_generator.h:97
CanonicalForm getMipo(const Variable &alpha, const Variable &x)
Definition: variable.cc:207
int getCharacteristic()
Definition: cf_char.cc:51
Variable algext
Definition: cf_generator.h:96
int i
Definition: cfEzgcd.cc:123
int getGFDegree()
Definition: cf_char.cc:56
generate all elements in GF starting from 0
Definition: cf_generator.h:74
GFGenerator ** gensg
Definition: cf_generator.h:98
#define ASSERT(expression, message)
Definition: cf_assert.h:99
int degree(const CanonicalForm &f)
AlgExtGenerator::~AlgExtGenerator ( )

Definition at line 131 of file cf_generator.cc.

132 {
133  if ( getGFDegree() > 1 )
134  {
135  for ( int i = 0; i < n; i++ )
136  delete gensg[i];
137  delete [] gensg;
138  }
139  else
140  {
141  for ( int i = 0; i < n; i++ )
142  delete gensf[i];
143  delete [] gensf;
144  }
145 }
FFGenerator ** gensf
Definition: cf_generator.h:97
int i
Definition: cfEzgcd.cc:123
int getGFDegree()
Definition: cf_char.cc:56
GFGenerator ** gensg
Definition: cf_generator.h:98
AlgExtGenerator::AlgExtGenerator ( )
private
AlgExtGenerator::AlgExtGenerator ( const AlgExtGenerator )
private
AlgExtGenerator::AlgExtGenerator ( const Variable a)
AlgExtGenerator::~AlgExtGenerator ( )
AlgExtGenerator::AlgExtGenerator ( )
private
AlgExtGenerator::AlgExtGenerator ( const AlgExtGenerator )
private
AlgExtGenerator::AlgExtGenerator ( const Variable a)
AlgExtGenerator::~AlgExtGenerator ( )

Member Function Documentation

CFGenerator * AlgExtGenerator::clone ( ) const
virtual

Reimplemented from CFGenerator.

Definition at line 216 of file cf_generator.cc.

217 {
218  return new AlgExtGenerator(algext);
219 }
Variable algext
Definition: cf_generator.h:96
CFGenerator* AlgExtGenerator::clone ( ) const
virtual

Reimplemented from CFGenerator.

CFGenerator* AlgExtGenerator::clone ( ) const
virtual

Reimplemented from CFGenerator.

bool AlgExtGenerator::hasItems ( ) const
inlinevirtual

Reimplemented from CFGenerator.

Definition at line 108 of file cf_generator.h.

108 { return ! nomoreitems; }
bool AlgExtGenerator::hasItems ( ) const
inlinevirtual

Reimplemented from CFGenerator.

Definition at line 757 of file factory.h.

757 { return ! nomoreitems; }
bool AlgExtGenerator::hasItems ( ) const
inlinevirtual

Reimplemented from CFGenerator.

Definition at line 757 of file factory.h.

757 { return ! nomoreitems; }
CanonicalForm AlgExtGenerator::item ( ) const
virtual

Reimplemented from CFGenerator.

Definition at line 162 of file cf_generator.cc.

163 {
164  ASSERT( ! nomoreitems, "no more items" );
165  CanonicalForm result = 0;
166  if ( getGFDegree() > 1 )
167  {
168  for ( int i = 0; i < n; i++ )
169  result += power( algext, i ) * gensg[i]->item();
170  }
171  else
172  {
173  for ( int i = 0; i < n; i++ )
174  result += power( algext, i ) * gensf[i]->item();
175  }
176  return result;
177 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
CanonicalForm item() const
Definition: cf_generator.cc:72
factory&#39;s main class
Definition: canonicalform.h:75
CanonicalForm item() const
Definition: cf_generator.cc:40
FFGenerator ** gensf
Definition: cf_generator.h:97
Variable algext
Definition: cf_generator.h:96
int i
Definition: cfEzgcd.cc:123
int getGFDegree()
Definition: cf_char.cc:56
GFGenerator ** gensg
Definition: cf_generator.h:98
#define ASSERT(expression, message)
Definition: cf_assert.h:99
return result
Definition: facAbsBiFact.cc:76
CanonicalForm AlgExtGenerator::item ( ) const
virtual

Reimplemented from CFGenerator.

CanonicalForm AlgExtGenerator::item ( ) const
virtual

Reimplemented from CFGenerator.

void AlgExtGenerator::next ( )
virtual

Reimplemented from CFGenerator.

Definition at line 179 of file cf_generator.cc.

180 {
181  ASSERT( ! nomoreitems, "no more items" );
182  int i = 0;
183  bool stop = false;
184  if ( getGFDegree() > 1 )
185  {
186  while ( ! stop && i < n )
187  {
188  gensg[i]->next();
189  if ( ! gensg[i]->hasItems() )
190  {
191  gensg[i]->reset();
192  i++;
193  }
194  else
195  stop = true;
196  }
197  }
198  else
199  {
200  while ( ! stop && i < n )
201  {
202  gensf[i]->next();
203  if ( ! gensf[i]->hasItems() )
204  {
205  gensf[i]->reset();
206  i++;
207  }
208  else
209  stop = true;
210  }
211  }
212  if ( ! stop )
213  nomoreitems = true;
214 }
FFGenerator ** gensf
Definition: cf_generator.h:97
void reset()
Definition: cf_generator.h:63
int i
Definition: cfEzgcd.cc:123
void reset()
Definition: cf_generator.cc:67
int getGFDegree()
Definition: cf_char.cc:56
GFGenerator ** gensg
Definition: cf_generator.h:98
#define ASSERT(expression, message)
Definition: cf_assert.h:99
bool hasItems() const
Definition: cf_generator.h:108
void AlgExtGenerator::next ( )
virtual

Reimplemented from CFGenerator.

void AlgExtGenerator::next ( )
virtual

Reimplemented from CFGenerator.

void AlgExtGenerator::operator++ ( )
inline

Definition at line 112 of file cf_generator.h.

112 { next(); }
void AlgExtGenerator::operator++ ( int  )
inline

Definition at line 113 of file cf_generator.h.

113 { next(); }
void AlgExtGenerator::operator++ ( )
inline

Definition at line 761 of file factory.h.

761 { next(); }
void AlgExtGenerator::operator++ ( )
inline

Definition at line 761 of file factory.h.

761 { next(); }
void AlgExtGenerator::operator++ ( int  )
inline

Definition at line 762 of file factory.h.

762 { next(); }
void AlgExtGenerator::operator++ ( int  )
inline

Definition at line 762 of file factory.h.

762 { next(); }
AlgExtGenerator & AlgExtGenerator::operator= ( const AlgExtGenerator )
private

Definition at line 104 of file cf_generator.cc.

105 {
106  ASSERT( 0, "not a valid generator" );
107  return *this;
108 }
#define ASSERT(expression, message)
Definition: cf_assert.h:99
AlgExtGenerator& AlgExtGenerator::operator= ( const AlgExtGenerator )
private
AlgExtGenerator& AlgExtGenerator::operator= ( const AlgExtGenerator )
private
void AlgExtGenerator::reset ( )
virtual

Reimplemented from CFGenerator.

Definition at line 147 of file cf_generator.cc.

148 {
149  if ( getGFDegree() > 1 )
150  {
151  for ( int i = 0; i < n; i++ )
152  gensg[i]->reset();
153  }
154  else
155  {
156  for ( int i = 0; i < n; i++ )
157  gensf[i]->reset();
158  }
159  nomoreitems = false;
160 }
FFGenerator ** gensf
Definition: cf_generator.h:97
int i
Definition: cfEzgcd.cc:123
int getGFDegree()
Definition: cf_char.cc:56
GFGenerator ** gensg
Definition: cf_generator.h:98
void AlgExtGenerator::reset ( )
virtual

Reimplemented from CFGenerator.

void AlgExtGenerator::reset ( )
virtual

Reimplemented from CFGenerator.

Field Documentation

Variable AlgExtGenerator::algext
private

Definition at line 96 of file cf_generator.h.

FFGenerator ** AlgExtGenerator::gensf
private

Definition at line 97 of file cf_generator.h.

GFGenerator ** AlgExtGenerator::gensg
private

Definition at line 98 of file cf_generator.h.

int AlgExtGenerator::n
private

Definition at line 99 of file cf_generator.h.

bool AlgExtGenerator::nomoreitems
private

Definition at line 100 of file cf_generator.h.


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