Changeset 7af488e in git for libpolys/coeffs
- Timestamp:
- May 27, 2011, 11:39:02 AM (13 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 9bb545791780a99344a26d6177decb3870f6da87
- Parents:
- 6ccdd3ad26bd7de442ab57e7cc95352fcf0de398
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-05-27 11:39:02+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:39:06+01:00
- Location:
- libpolys/coeffs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/coeffs/numbers.cc
r6ccdd3a r7af488e 30 30 #endif 31 31 32 #ifdef HAVE_POLYEXTENSIONS 33 #include <polys/ext_fields/algext.h> 34 #endif 35 32 36 #ifdef HAVE_FACTORY 33 37 #include <factory/factory.h> … … 153 157 } 154 158 155 static n_coeffType nLastCoeffs=n_Z2m; 156 static cfInitCharProc *nInitCharTable=NULL; 159 static n_coeffType nLastCoeffs=n_CF; 160 cfInitCharProc nInitCharTableDefault[]= 161 { NULL, /*n_unknown */ 162 npInitChar, /* n_Zp */ 163 nlInitChar, /* n_Q */ 164 nrInitChar, /* n_R */ 165 nfInitChar, /* n_GF */ 166 ngfInitChar, /* n_long_R */ 167 #ifdef HAVE_POLYEXTENSIONS 168 naInitChar, /* n_algExt */ 169 #else 170 NULL, /* n_algExt */ 171 #endif 172 NULL, /* n_transExt */ 173 ngcInitChar, /* n_long_C */ 174 #ifdef HAVE_RINGS 175 nrzInitChar, /* n_Z */ 176 nrnInitChar, /* n_Zn */ 177 NULL, /* n_Zpn */ 178 nr2mInitChar, /* n_Z2m */ 179 #else 180 NULL, /* n_Z */ 181 NULL, /* n_Zn */ 182 NULL, /* n_Zpn */ 183 NULL, /* n_Z2m */ 184 #endif 185 NULL /* n_CF */ 186 }; 187 188 static cfInitCharProc *nInitCharTable=nInitCharTableDefault; 157 189 /*2 158 190 * init operations for coeffs r … … 206 238 BOOLEAN nOK=TRUE; 207 239 // init 208 if (( nInitCharTable!=NULL) && (t<=nLastCoeffs))240 if ((t<=nLastCoeffs) && (nInitCharTable[t]!=NULL)) 209 241 nOK = (nInitCharTable[t])(n,parameter); 210 242 else 211 Werror(" coeff init missing for %d",(int)t);243 Werror("nInitCharTable[%d] missing",(int)t); 212 244 if (nOK) 213 245 { … … 311 343 } 312 344 345 313 346 n_coeffType nRegister(n_coeffType n, cfInitCharProc p) 314 347 { … … 316 349 { 317 350 nLastCoeffs=(n_coeffType)(int(nLastCoeffs)+1); 318 if (nInitCharTable== NULL)351 if (nInitCharTable==nInitCharTableDefault) 319 352 { 320 353 nInitCharTable=(cfInitCharProc*)omAlloc0( 321 354 nLastCoeffs*sizeof(cfInitCharProc)); 355 memcpy(nInitCharTable,nInitCharTableDefault, 356 (nLastCoeffs-1)*sizeof(cfInitCharProc)); 322 357 } 323 358 else … … 333 368 else 334 369 { 335 if (nInitCharTable==NULL) 336 { 337 nInitCharTable=(cfInitCharProc*)omAlloc0( 338 ((int) nLastCoeffs)*sizeof(cfInitCharProc)); 339 } 370 if (nInitCharTable[n]!=NULL) Print("coeff %d already initialized\n",n); 340 371 nInitCharTable[n]=p; 341 372 return n; -
libpolys/coeffs/test.cc
r6ccdd3a r7af488e 274 274 #ifdef HAVE_RINGS 275 275 // TODO(Frank, Segmentation fault! (if used wihout omalloc???). Please_ investigate!); 276 type = nRegister( n_Z2m, nr2mInitChar); assume( type == n_Z2m );276 type = n_Z2m; 277 277 if( Test(type, (void*) 4) ) 278 278 c ++; 279 279 #endif 280 280 281 type = nRegister( n_Zp, npInitChar); assume( type == n_Zp );281 type = n_Zp; 282 282 if( Test(type, (void*) 101) ) 283 283 c ++; … … 286 286 // TODO(Frank, memmory corruption_ if used wihout omalloc??? Please_ investigate!); 287 287 288 type = n Register( n_Z2m, nr2mInitChar); assume( type == n_Z2m );288 type = n_Z2m; 289 289 if( Test(type, (void*) 8) ) 290 290 c ++; … … 293 293 294 294 295 type = nRegister( n_Q, nlInitChar); assume( type == n_Q );296 if( Test(type) ) 297 c ++; 298 299 type = n Register( n_R, nrInitChar); assume( type == n_R );300 if( Test(type) ) 301 c ++; 302 303 #ifdef HAVE_RINGS 304 type = n Register( n_Z, nrzInitChar); assume( type == n_Z ); // No need in GMP?305 if( Test(type) ) 306 c ++; 307 #endif 308 type = n Register( n_GF, nfInitChar); assume( type == n_GF );295 type = n_Q; 296 if( Test(type) ) 297 c ++; 298 299 type = n_R; 300 if( Test(type) ) 301 c ++; 302 303 #ifdef HAVE_RINGS 304 type = n_Z; 305 if( Test(type) ) 306 c ++; 307 #endif 308 type = n_GF; 309 309 310 310 … … 340 340 // TODO(Somebody, This will result in memory corruption at Z_2^m later on (due to the succs. setGMPFloatDigits?)...!?); // ???? 341 341 342 type = n Register( n_Zn, nrnInitChar); assume( type == n_Zn );342 type = n_Zn; 343 343 344 344 if( Test(type, (void*) 3) ) … … 351 351 352 352 353 type = n Register( n_long_C, ngcInitChar); assume( type == n_long_C );354 if( Test(type) ) 355 c ++; 356 357 type = n Register( n_long_R, ngfInitChar); assume( type == n_long_R );358 if( Test(type) ) 359 c ++; 360 361 #ifdef HAVE_RINGS 362 type = n Register( n_Z2m, nr2mInitChar); assume( type == n_Z2m );353 type = n_long_C; 354 if( Test(type) ) 355 c ++; 356 357 type = n_long_R; 358 if( Test(type) ) 359 c ++; 360 361 #ifdef HAVE_RINGS 362 type = n_Z2m; 363 363 if( Test(type, (void*) 2) ) 364 364 c ++; … … 367 367 368 368 #ifdef HAVE_RINGS 369 type = n Register( n_Zn, nrnInitChar); assume( type == n_Zn );369 type = n_Zn; 370 370 371 371 if( Test(type, (void*) 3) )
Note: See TracChangeset
for help on using the changeset viewer.