My Project
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 ()
 
virtual bool hasItems () const
 
virtual void reset ()
 
virtual CanonicalForm item () const
 
virtual void next ()
 
virtual CFGeneratorclone () const
 
 CFGenerator ()
 
virtual ~CFGenerator ()
 
virtual bool hasItems () const
 
virtual void reset ()
 
virtual CanonicalForm item () const
 
virtual void next ()
 
virtual CFGeneratorclone () const
 
 CFGenerator ()
 
virtual ~CFGenerator ()
 
virtual bool hasItems () const
 
virtual void reset ()
 
virtual CanonicalForm item () const
 
virtual void next ()
 
virtual CFGeneratorclone () const
 

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() [1/9]

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() [2/9]

AlgExtGenerator::AlgExtGenerator ( const AlgExtGenerator )
private

Definition at line 99 of file cf_generator.cc.

100{
101 ASSERT( 0, "not a valid generator" );
102}

◆ AlgExtGenerator() [3/9]

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 degree(const CanonicalForm &f)
int getGFDegree()
Definition: cf_char.cc:75
int FACTORY_PUBLIC getCharacteristic()
Definition: cf_char.cc:70
int i
Definition: cfEzgcd.cc:132
FFGenerator ** gensf
Definition: cf_generator.h:97
GFGenerator ** gensg
Definition: cf_generator.h:98
Variable algext
Definition: cf_generator.h:96
generate all elements in F_p starting from 0
Definition: cf_generator.h:56
generate all elements in GF starting from 0
Definition: cf_generator.h:75
int level() const
Definition: factory.h:143
CanonicalForm getMipo(const Variable &alpha, const Variable &x)
Definition: variable.cc:207

◆ ~AlgExtGenerator() [1/3]

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}

◆ AlgExtGenerator() [4/9]

AlgExtGenerator::AlgExtGenerator ( )
private

◆ AlgExtGenerator() [5/9]

AlgExtGenerator::AlgExtGenerator ( const AlgExtGenerator )
private

◆ AlgExtGenerator() [6/9]

AlgExtGenerator::AlgExtGenerator ( const Variable a)

◆ ~AlgExtGenerator() [2/3]

AlgExtGenerator::~AlgExtGenerator ( )

◆ AlgExtGenerator() [7/9]

AlgExtGenerator::AlgExtGenerator ( )
private

◆ AlgExtGenerator() [8/9]

AlgExtGenerator::AlgExtGenerator ( const AlgExtGenerator )
private

◆ AlgExtGenerator() [9/9]

AlgExtGenerator::AlgExtGenerator ( const Variable a)

◆ ~AlgExtGenerator() [3/3]

AlgExtGenerator::~AlgExtGenerator ( )

Member Function Documentation

◆ clone() [1/3]

CFGenerator * AlgExtGenerator::clone ( ) const
virtual

Reimplemented from CFGenerator.

Definition at line 216 of file cf_generator.cc.

217{
218 return new AlgExtGenerator(algext);
219}

◆ clone() [2/3]

CFGenerator * AlgExtGenerator::clone ( ) const
virtual

Reimplemented from CFGenerator.

◆ clone() [3/3]

CFGenerator * AlgExtGenerator::clone ( ) const
virtual

Reimplemented from CFGenerator.

◆ hasItems() [1/3]

bool AlgExtGenerator::hasItems ( ) const
inlinevirtual

Reimplemented from CFGenerator.

Definition at line 108 of file cf_generator.h.

108{ return ! nomoreitems; }

◆ hasItems() [2/3]

bool AlgExtGenerator::hasItems ( ) const
inlinevirtual

Reimplemented from CFGenerator.

Definition at line 773 of file factory.h.

773{ return ! nomoreitems; }

◆ hasItems() [3/3]

bool AlgExtGenerator::hasItems ( ) const
inlinevirtual

Reimplemented from CFGenerator.

Definition at line 773 of file factory.h.

773{ return ! nomoreitems; }

◆ item() [1/3]

CanonicalForm AlgExtGenerator::item ( ) const
virtual

Reimplemented from CFGenerator.

Definition at line 162 of file cf_generator.cc.

163{
164 ASSERT( ! nomoreitems, "no more items" );
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
factory's main class
Definition: canonicalform.h:86
CanonicalForm item() const
Definition: cf_generator.cc:40
CanonicalForm item() const
Definition: cf_generator.cc:72
return result
Definition: facAbsBiFact.cc:75

◆ item() [2/3]

CanonicalForm AlgExtGenerator::item ( ) const
virtual

Reimplemented from CFGenerator.

◆ item() [3/3]

CanonicalForm AlgExtGenerator::item ( ) const
virtual

Reimplemented from CFGenerator.

◆ next() [1/3]

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}
bool hasItems() const
Definition: cf_generator.h:108
void reset()
Definition: cf_generator.h:63
void reset()
Definition: cf_generator.cc:67

◆ next() [2/3]

void AlgExtGenerator::next ( )
virtual

Reimplemented from CFGenerator.

◆ next() [3/3]

void AlgExtGenerator::next ( )
virtual

Reimplemented from CFGenerator.

◆ operator++() [1/6]

void AlgExtGenerator::operator++ ( )
inline

Definition at line 112 of file cf_generator.h.

112{ next(); }

◆ operator++() [2/6]

void AlgExtGenerator::operator++ ( )
inline

Definition at line 777 of file factory.h.

777{ next(); }

◆ operator++() [3/6]

void AlgExtGenerator::operator++ ( )
inline

Definition at line 777 of file factory.h.

777{ next(); }

◆ operator++() [4/6]

void AlgExtGenerator::operator++ ( int  )
inline

Definition at line 113 of file cf_generator.h.

113{ next(); }

◆ operator++() [5/6]

void AlgExtGenerator::operator++ ( int  )
inline

Definition at line 778 of file factory.h.

778{ next(); }

◆ operator++() [6/6]

void AlgExtGenerator::operator++ ( int  )
inline

Definition at line 778 of file factory.h.

778{ next(); }

◆ operator=() [1/3]

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}

◆ operator=() [2/3]

AlgExtGenerator & AlgExtGenerator::operator= ( const AlgExtGenerator )
private

◆ operator=() [3/3]

AlgExtGenerator & AlgExtGenerator::operator= ( const AlgExtGenerator )
private

◆ reset() [1/3]

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}

◆ reset() [2/3]

void AlgExtGenerator::reset ( )
virtual

Reimplemented from CFGenerator.

◆ reset() [3/3]

void AlgExtGenerator::reset ( )
virtual

Reimplemented from CFGenerator.

Field Documentation

◆ algext

Variable AlgExtGenerator::algext
private

Definition at line 96 of file cf_generator.h.

◆ gensf

FFGenerator ** AlgExtGenerator::gensf
private

Definition at line 97 of file cf_generator.h.

◆ gensg

GFGenerator ** AlgExtGenerator::gensg
private

Definition at line 98 of file cf_generator.h.

◆ n

int AlgExtGenerator::n
private

Definition at line 99 of file cf_generator.h.

◆ nomoreitems

bool AlgExtGenerator::nomoreitems
private

Definition at line 100 of file cf_generator.h.


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