Changeset 8c484e in git
- Timestamp:
- May 5, 2010, 3:05:12 PM (13 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 2336d0a674d92415a0e20e0b4abf6b1a96ab56e2
- Parents:
- 63c3a8df898418cfb9484633a8d9eb78c299a95c
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2010-05-05 15:05:12+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:51:39+01:00
- Location:
- coeffs
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
coeffs/coeffs.h
r63c3a8 r8c484e 128 128 // ? 129 129 // initialisation: 130 void (*cfInitChar)(coeffs r ); // do one-time initialisations130 void (*cfInitChar)(coeffs r, int parameter); // do one-time initialisations 131 131 void (*cfKillChar)(coeffs r); // undo all initialisations 132 132 // or NULL -
coeffs/modulop.cc
r63c3a8 r8c484e 8 8 9 9 #include <string.h> 10 #include "config.h" 11 #include <omalloc.h> 10 12 #include "coeffs.h" 13 #include "output.h" 11 14 #include "numbers.h" 12 15 #include "longrat.h" 13 16 #include "mpr_complex.h" 17 #include "mylimits.h" 14 18 #include "modulop.h" 15 19 16 20 int npGen=0; 17 long npMapPrime;18 21 19 22 #ifdef HAVE_DIV_MOD … … 243 246 ii *= 10; 244 247 ii += *s++ - '0'; 245 if (ii >= (MAX_INT _VAL/ 10)) ii = ii % r->npPrimeM;248 if (ii >= (MAX_INT / 10)) ii = ii % r->npPrimeM; 246 249 } 247 250 while (((*s) >= '0') && ((*s) <= '9')); … … 304 307 } 305 308 306 void npInitChar(int c, coeffs r) 309 void npKillChar(coeffs r) 310 { 311 #ifdef HAVE_DIV_MOD 312 if (r->npInvTable!=NULL) 313 omFreeSize( (void *)r->npInvTable, r->npPrimeM*sizeof(unsigned short) ); 314 r->npInvTable=NULL; 315 #else 316 if (r->npExpTable!=NULL) 317 { 318 omFreeSize( (void *)r->npExpTable, r->npPrimeM*sizeof(unsigned short) ); 319 omFreeSize( (void *)r->npLogTable, r->npPrimeM*sizeof(unsigned short) ); 320 r->npExpTable=NULL; r->npLogTable=NULL; 321 } 322 #endif 323 } 324 325 void npInitChar(coeffs r, int c) 307 326 { 308 327 int i, w; … … 353 372 #endif 354 373 } 374 r->cfKillChar=npKillChar; 375 r->cfSetChar=NULL; 376 r->cfInit = npInit; 377 r->n_Int = npInt; 378 r->nAdd = npAdd; 379 r->nSub = npSub; 380 r->nMult = npMult; 381 r->nDiv = npDiv; 382 r->nExactDiv= npDiv; 383 r->nNeg = npNeg; 384 r->nInvers= npInvers; 385 r->cfCopy = ndCopy; 386 r->nGreater = npGreater; 387 r->nEqual = npEqual; 388 r->nIsZero = npIsZero; 389 r->nIsOne = npIsOne; 390 r->nIsMOne = npIsMOne; 391 r->nGreaterZero = npGreaterZero; 392 r->cfWrite = npWrite; 393 r->nRead = npRead; 394 r->nPower = npPower; 395 r->cfSetMap = npSetMap; 396 r->nName= ndName; 397 r->nSize = ndSize; 398 #ifdef LDEBUG 399 r->nDBTest=npDBTest; 400 #endif 401 #ifdef NV_OPS 402 if (c>NV_MAX_PRIME) 403 { 404 r->nMult = nvMult; 405 r->nDiv = nvDiv; 406 r->nExactDiv= nvDiv; 407 r->nInvers= nvInvers; 408 r->nPower= nvPower; 409 } 410 #endif 355 411 } 356 412 else … … 372 428 #endif 373 429 374 number npMap0(number from, const coeffs dst_r)430 number npMap0(number from, const coeffs src, const coeffs dst_r) 375 431 { 376 432 return npInit(nlModP(from,dst_r->npPrimeM),dst_r); 377 433 } 378 434 379 number npMapP(number from, const coeffs dst_r)435 number npMapP(number from, const coeffs src, const coeffs dst_r) 380 436 { 381 437 long i = (long)from; 382 if (i> npMapPrime/2)383 { 384 i-= npMapPrime;438 if (i>src->npPrimeM/2) 439 { 440 i-=src->npPrimeM; 385 441 while (i < 0) i+=dst_r->npPrimeM; 386 442 } … … 389 445 } 390 446 391 static number npMapLongR(number from, const coeffs dst_r)447 static number npMapLongR(number from, const coeffs src, const coeffs dst_r) 392 448 { 393 449 gmp_float *ff=(gmp_float*)from; … … 455 511 mpz_clear(dest); 456 512 if(res->s==0) 457 iz=(long)npDiv((number)iz,(number)in );513 iz=(long)npDiv((number)iz,(number)in,dst_r); 458 514 omFreeBin((void *)res, rnumber_bin); 459 515 return (number)iz; … … 507 563 if (n_GetChar(src) == n_GetChar(dst)) 508 564 { 509 return ndCopy ;565 return ndCopyMap; 510 566 } 511 567 else 512 568 { 513 npMapPrime=n_GetChar(src);514 569 return npMapP; 515 570 } -
coeffs/modulop.h
r63c3a8 r8c484e 24 24 extern int npGen; 25 25 extern long npMapPrime; 26 27 void npInitChar(coeffs r, int ch); 26 28 27 29 BOOLEAN npGreaterZero (number k, const coeffs r); -
coeffs/numbers.cc
r63c3a8 r8c484e 396 396 /*----------------------char. p----------------*/ 397 397 { 398 /* never again: 398 399 npInitChar(c,r); 399 400 n->cfInit = npInit; … … 417 418 n->nPower = npPower; 418 419 n->cfSetMap = npSetMap; 419 / * nName= ndName; */420 / *nSize = ndSize;*/420 // nName= ndName; 421 // nSize = ndSize; 421 422 #ifdef LDEBUG 422 423 n->nDBTest=npDBTest; … … 433 434 } 434 435 #endif 436 */ 437 r->cfInitChar=npInitChar; 438 npInitChar(r,c); 435 439 } 436 440 /* -------------- GF(p^m) -----------------------*/ … … 594 598 if (cf_root==r) cf_root=n->next; 595 599 r->cfDelete(&(r->nNULL),r); 600 if (r->cfKillChar!=NULL) r->cfKillChar(r); 601 /* was: 596 602 switch(r->type) 597 603 { 598 case n_Zp:599 #ifdef HAVE_DIV_MOD600 if (r->npInvTable!=NULL)601 omFreeSize( (void *)r->npInvTable,602 r->npPrimeM*sizeof(unsigned short) );603 #else604 if (r->npExpTable!=NULL)605 {606 omFreeSize( (void *)r->npExpTable,607 r->npPrimeM*sizeof(unsigned short) );608 omFreeSize( (void *)r->npLogTable,609 r->npPrimeM*sizeof(unsigned short) );610 }611 #endif612 break;613 604 case n_Zp_a: 614 605 case n_Q_a: … … 626 617 break; 627 618 } 619 */ 628 620 omFreeSize((void *)r, sizeof(n_Procs_s)); 629 621 r=NULL; -
coeffs/numbers.h
r63c3a8 r8c484e 66 66 number ndCopy(number a, const coeffs r); 67 67 number ndCopyMap(number a, const coeffs r, const coeffs aRing); 68 int ndSize(number a, const coeffs r); 69 char * ndName(number n, const coeffs r); 68 70 69 71 void ndInpMult(number &a, number b, const coeffs r);
Note: See TracChangeset
for help on using the changeset viewer.