77{
80
81
83 {
84 return;
85 }
86
89
90
91 char *gffilename;
92 FILE * inputfile;
94 {
95 sprintf( buffer, "gftables/%d", q);
99 strcat(gffilename,buffer);
100 inputfile = fopen( gffilename, "r" );
101 }
102 else
103 {
104 sprintf( buffer, "gftables/%d", q );
105 gffilename = buffer;
106#ifndef SINGULAR
107 inputfile = fopen( buffer, "r" );
108#else
109 inputfile =
feFopen( buffer,
"r" );
110#endif
111 }
112 if (!inputfile)
113 {
114 fprintf(stderr,"can not open GF(q) addition table: %s\n",gffilename);
116 }
117
118
119 char * bufptr;
120 char * success;
123 STICKYASSERT( strcmp( buffer,
"@@ factory GF(q) table @@\n" ) == 0,
"illegal table" );
124
125 int pFile, nFile;
127 STICKYASSERT( success,
"illegal table (reading p and n)" );
128 sscanf( buffer, "%d %d", &pFile, &nFile );
130
131
132 bufptr = (char *)strchr( buffer, ';' ) + 2;
133
135 sscanf( bufptr,
"%d", &
degree );
136 bufptr = (char *)strchr( bufptr, ' ' ) + 1;
139 {
140 sscanf( bufptr,
"%d",
mipo +
i );
141 bufptr = (char *)strchr( bufptr, ' ' ) + 1;
142 }
143
148
149
153 {
155 STICKYASSERT( strlen( buffer ) - 1 == (
size_t)digs * 30,
"illegal table" );
156 bufptr = buffer;
158 while (
i <
gf_q &&
k < 30 )
159 {
161 bufptr += digs;
163 {
166 else
168 }
170 }
171 }
174
175 (void)fclose( inputfile );
176}
#define STICKYASSERT(expression, message)
int ipower(int b, int m)
int ipower ( int b, int m )
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
int convertback62(char *p, int n)
int gf_tab_numdigits62(int q)
STATIC_VAR char * gftable_dir
VAR unsigned short * gf_table
static CanonicalForm intVec2CF(int degree, int *coeffs, int level)
INST_VAR CanonicalForm gf_mipo