26 #include <strstream.h>
61 2, 3, 5, 7, 11, 13, 17, 19,
62 23, 29, 31, 37, 41, 43, 47, 53,
63 59, 61, 67, 71, 73, 79, 83, 89,
64 97, 101, 103, 107, 109, 113, 127, 131,
65 137, 139, 149, 151, 157, 163, 167, 173,
66 179, 181, 191, 193, 197, 199, 211, 223,
67 227, 229, 233, 239, 241, 251
79 if (F.
getFirst().factor().inCoeffDomain())
97 while ( e <= q && ! prod.
isOne() ) {
99 prod = ( prod *
x ) % f;
130 cerr <<
"."; cerr.flush();
133 cerr <<
"*"; cerr.flush();
146 else if ( n == d || n == 0 ) {
149 for ( i = 1; i <
p; i++ )
154 for ( i = 0; i <
p; i++ )
176 bool ok =
findGenRec( d, d, q, 0, x, result );
202 fname <<
"gftables/" << q <<
'\0';
203 char * fn = fname.str();
205 outfile.open( fn, ios::out );
206 STICKYASSERT1( outfile,
"can not open GF(q) table %s for writing", fn );
209 cerr <<
"mipo = " << mipo <<
": ";
210 cerr <<
"generating multiplicative group ... ";
218 for ( i = 1; i < q; i++ )
219 T[i] = ( T[i-1] * x ) % mipo;
221 cerr <<
"generating addition table ... ";
228 for ( i = 0; i < q; i++ ) {
231 while ( j < q && T[j] != f ) j++;
235 cerr <<
"writing table ... ";
238 outfile <<
"@@ factory GF(q) table @@" << endl;
239 outfile << p <<
" " << d <<
" " << mipo <<
"; ";
244 for ( i = d; MiPo.
hasTerms(); i--, MiPo++ ) {
246 for ( exp = MiPo.
exp(); exp <
i; i-- )
248 outfile <<
" " << MiPo.
coeff();
255 char * outstr =
new char[30*m+1];
260 char * sptr = outstr;
261 while ( i < q && k < 30 ) {
271 outfile << outstr << endl;
296 int ntmp,ptmp,pos1,pos2,ii;
298 string LineSe,coef,PC;
300 ifstream in(
"./ConwayList.txt");
304 while((flag) && (err != LineSe))
310 pos1 = LineSe.find(
",", 0 );
311 pos2 = LineSe.find(
",", pos1 + 1);
312 ps = LineSe.substr(0, pos1);
313 ns = LineSe.substr(pos1 + 1,pos2 - pos1);
314 ptmp = atoi(ps.c_str());
315 ntmp = atoi(ns.c_str());
317 if((ntmp==n)&&(ptmp==
p)){flag=0;}
329 pos2 = LineSe.find(
",", pos1 + 1);
330 conway = atoi(LineSe.substr(pos1, pos2 - pos1).c_str());
332 pos2 = LineSe.find(
",", pos1 + 1);
334 for(ii = 2; ii <=
n; ii++)
336 coef = LineSe.substr(pos1 + 1,pos2 - pos1 - 1);
339 conway = conway + atoi(coef.c_str()) *
power(x, ii - 1) ;
342 pos2 = LineSe.find(
",", pos1+1);
345 pos2 = LineSe.find(
",END", pos1 + 1);
346 coef = LineSe.substr(pos1 + 1,pos2 - pos1 - 1);
347 conway = conway + atoi(coef.c_str()) *
power(x, ii - 1) ;
367 ASSERT( f != 0,
"no generator found" );
static CanonicalForm findGenNew(int n, int q)
The new function for getting the minimal polynomials.
void convert62(int i, int n, char *p)
factory's class for variables
utility functions to access GF Tables
const CanonicalForm CFMap CFMap int &both_non_zero int n
static unsigned short primes[]
primes, primes_len: used to step through possible extensions
bool isIrreducible(const CanonicalForm &f)
bool isIrreducible ( const CanonicalForm & f )
CF_NO_INLINE int hasTerms() const
check if iterator has reached < the end of CanonicalForm
const int maxtable
constants.
CFFList factorize(const CanonicalForm &f, bool issqrfree=false)
factorization over or
CF_NO_INLINE CanonicalForm coeff() const
get the current coefficient
const int primes_len
primes, primes_len: used to step through possible extensions
int gf_tab_numdigits62(int q)
#define STICKYASSERT1(expression, message, parameter1)
Iterators for CanonicalForm's.
declarations of higher level algorithms.
class to iterate through CanonicalForm's
CF_NO_INLINE int exp() const
get the current exponent
CanonicalForm findGen(int d, int q)
CanonicalForm findGen ( int d, int q )
void printTable(int d, int q, CanonicalForm mipo)
void printTable ( int d, int q, CanonicalForm mipo )
#define ASSERT(expression, message)
bool findGenRec(int d, int n, int q, const CanonicalForm &m, const Variable &x, CanonicalForm &result)
bool findGenRec ( int d, int n, int q, const CanonicalForm & m, const Variable & x, CanonicalForm & result )
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )