Changeset ab2923 in git
- Timestamp:
- Aug 7, 2007, 4:11:18 PM (16 years ago)
- Branches:
- (u'spielwiese', 'd1b01e9d51ade4b46b745d3bada5c5f3696be3a8')
- Children:
- e61df204676c5cfbf13c624fb0a8a94e0c49c8eb
- Parents:
- 592e22040e058cea577d1be39a41916d20067d38
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/gfops.cc
r592e22 rab2923 1 1 /* emacs edit mode for this file is -*- C++ -*- */ 2 /* $Id: gfops.cc,v 1. 5 1998-06-12 14:33:41 schmidtExp $ */2 /* $Id: gfops.cc,v 1.6 2007-08-07 14:11:18 Singular Exp $ */ 3 3 4 4 #include <config.h> … … 20 20 21 21 22 const int gf_maxtable = 32767;22 const int gf_maxtable = 63001; 23 23 const int gf_maxbuffer = 200; 24 24 … … 31 31 97, 101, 103, 107, 109, 113, 127, 131, 32 32 137, 139, 149, 151, 157, 163, 167, 173, 33 179, 181 33 179, 181, 191, 193, 197, 199, 223, 211, 34 227, 229, 233, 239, 241, 251 34 35 }; 35 36 … … 50 51 int i; 51 52 CanonicalForm result; 52 for ( i = 0; i <= degree; i++ ) { 53 for ( i = 0; i <= degree; i++ ) 54 { 53 55 result += CanonicalForm( coeffs[ i ] ) * power( Variable( level ), degree - i ); 54 56 } … … 65 67 66 68 // do not read the table a second time 67 if ( gf_q == q ) { 69 if ( gf_q == q ) 70 { 68 71 return; 69 72 } … … 71 74 #ifdef SINGULAR 72 75 // just copy the table if Singular already read it 73 if ( q == nfCharQ ) { 76 if ( q == nfCharQ ) 77 { 74 78 gf_p = p; gf_n = n; 75 79 gf_q = q; gf_q1 = q - 1; … … 112 116 bufptr = (char *)strchr( bufptr, ' ' ) + 1; 113 117 int * mipo = new int[degree + 1]; 114 for ( i = 0; i <= degree; i++ ) { 118 for ( i = 0; i <= degree; i++ ) 119 { 115 120 sscanf( bufptr, "%d", mipo + i ); 116 121 bufptr = (char *)strchr( bufptr, ' ' ) + 1; … … 125 130 int k, digs = gf_tab_numdigits62( gf_q ); 126 131 i = 1; 127 while ( i < gf_q ) { 132 while ( i < gf_q ) 133 { 128 134 success = fgets( buffer, gf_maxbuffer, inputfile ); 129 135 STICKYASSERT( strlen( buffer ) - 1 == (size_t)digs * 30, "illegal table" ); 130 136 bufptr = buffer; 131 137 k = 0; 132 while ( i < gf_q && k < 30 ) { 138 while ( i < gf_q && k < 30 ) 139 { 133 140 gf_table[i] = convertback62( bufptr, digs ); 134 141 bufptr += digs; … … 154 161 if ( i == gf_primes_len ) 155 162 return false; 156 else { 163 else 164 { 157 165 i = n; 158 166 int a = 1; 159 while ( a < gf_maxtable && i > 0 ) { 167 while ( a < gf_maxtable && i > 0 ) 168 { 160 169 a *= p; 161 170 i--; … … 181 190 if ( gf_iszero( a ) ) 182 191 return 0; 183 else { 192 else 193 { 184 194 // starting from z^0=1, step through the table 185 195 // counting the steps until we hit z^a or z^0 … … 187 197 // latter is guaranteed to be fulfilled. 188 198 int i = 0, ff = 1; 189 do { 199 do 200 { 190 201 if ( i == a ) 191 202 return ff; … … 202 213 if ( gf_iszero( a ) ) 203 214 return true; 204 else { 215 else 216 { 205 217 // z^a in GF(p) iff (z^a)^p-1=1 206 218 return gf_isone( gf_power( a, gf_p - 1 ) );
Note: See TracChangeset
for help on using the changeset viewer.