Changeset 806c18 in git for factory/gengftables.cc
 Timestamp:
 Nov 15, 2010, 4:34:57 PM (13 years ago)
 Branches:
 (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
 Children:
 7c3bca08c96331a56864c1d35b8c2e8ff2e0be89
 Parents:
 c840d97af622b4e4da8761738b540e21144f716b
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

factory/gengftables.cc
rc840d9 r806c18 79 79 CanonicalForm prod = x; 80 80 while ( e <= q && ! prod.isOne() ) { 81 82 81 e++; 82 prod = ( prod * x ) % f; 83 83 } 84 84 return e; … … 108 108 bool 109 109 findGenRec ( int d, int n, int q, 110 111 110 const CanonicalForm & m, const Variable & x, 111 CanonicalForm & result ) 112 112 { 113 113 int i, p = getCharacteristic(); 114 114 if ( n < 0 ) { 115 116 117 118 119 120 121 122 123 124 125 126 127 128 115 cerr << "."; cerr.flush(); 116 // check whether m is irreducible 117 if ( isIrreducible( m ) ) { 118 cerr << "*"; cerr.flush(); 119 // check whether m generates multiplicative group 120 if ( exponent( m, q ) == q  1 ) { 121 result = m; 122 return true; 123 } 124 else 125 return false; 126 } 127 else 128 return false; 129 129 } 130 130 // for each monomial x^0, ..., x^n, ..., x^d, try all possible coefficients 131 131 else if ( n == d  n == 0 ) { 132 133 134 135 136 132 // we want to have a leading coefficient and a constant term, 133 // so start with coefficient >= 1 134 for ( i = 1; i < p; i++ ) 135 if ( findGenRec( d, n1, q, m + i * power( x, n ), x, result ) ) 136 return true; 137 137 } 138 138 else { 139 140 141 139 for ( i = 0; i < p; i++ ) 140 if ( findGenRec( d, n1, q, m + i * power( x, n ), x, result ) ) 141 return true; 142 142 } 143 143 return false; … … 164 164 cerr << endl; 165 165 if ( ! ok ) 166 166 return 0; 167 167 else 168 168 return result; 169 169 } 170 170 //}}} … … 206 206 T[0] = 1; 207 207 for ( i = 1; i < q; i++ ) 208 208 T[i] = ( T[i1] * x ) % mipo; 209 209 210 210 cerr << "generating addition table ... "; … … 216 216 217 217 for ( i = 0; i < q; i++ ) { 218 219 220 221 218 f = T[i] + 1; 219 int j = 0; 220 while ( j < q && T[j] != f ) j++; 221 table[i] = j; 222 222 } 223 223 … … 232 232 CFIterator MiPo = mipo; 233 233 for ( i = d; MiPo.hasTerms(); i, MiPo++ ) { 234 235 236 237 234 int exp; 235 for ( exp = MiPo.exp(); exp < i; i ) 236 outfile << " 0"; 237 outfile << " " << MiPo.coeff(); 238 238 } 239 239 // since mipo is irreducible, it has a constant term, … … 246 246 i = 1; 247 247 while ( i < q ) { 248 249 250 251 252 253 254 255 256 257 258 259 260 248 int k = 0; 249 char * sptr = outstr; 250 while ( i < q && k < 30 ) { 251 convert62( table[i], m, sptr ); 252 sptr += m; 253 k++; i++; 254 } 255 while ( k < 30 ) { 256 convert62( 0, m, sptr ); 257 sptr += m; 258 k++; 259 } 260 outfile << outstr << endl; 261 261 } 262 262 outfile.close(); … … 275 275 int i, p, q, n; 276 276 for ( i = 0; i < primes_len; i++ ) { 277 278 279 280 281 282 283 284 285 286 287 } 288 } 277 p = primes[i]; 278 q = p*p; 279 n = 2; 280 setCharacteristic( p ); 281 while ( q < maxtable ) { 282 CanonicalForm f = findGen( n, q ); 283 ASSERT( f != 0, "no generator found" ); 284 printTable( n, q, f ); 285 n++; q *= p; 286 } 287 } 288 }
Note: See TracChangeset
for help on using the changeset viewer.