Changeset a539ad in git
- Timestamp:
- Feb 6, 2008, 10:12:47 AM (15 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'cdfcdb8287f66bc6070028082cbbc6eff10e609b')
- Children:
- 8f2bd1fc11ce18b5be7a734f75309011e212a4d3
- Parents:
- 4dcfc0f02d5040e014133baff89ccfc1bbc383ed
- Location:
- kernel
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/kspoly.cc
r4dcfc0f ra539ad 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kspoly.cc,v 1.1 2 2008-02-01 15:11:33wienand Exp $ */4 /* $Id: kspoly.cc,v 1.13 2008-02-06 09:12:45 wienand Exp $ */ 5 5 /* 6 6 * ABSTRACT - Routines for Spoly creation and reductions … … 346 346 Exponent_t c; 347 347 poly m1,m2; 348 number t1 ,t2;348 number t1 = NULL,t2 = NULL; 349 349 int cm,i; 350 350 BOOLEAN equal; … … 352 352 #ifdef HAVE_RINGS 353 353 number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2); 354 int ct = ksCheckCoeff(&lc1, &lc2); // gcd and zero divisors355 354 if (rField_is_Ring(currRing)) 356 355 { 356 ksCheckCoeff(&lc1, &lc2); // gcd and zero divisors 357 357 if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2); 358 358 if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1); … … 360 360 { 361 361 pIter(a1); 362 nDelete(&t2); 362 363 if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2); 363 364 } … … 365 366 { 366 367 pIter(a2); 368 nDelete(&t1); 367 369 if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1); 368 370 } … … 399 401 #ifdef HAVE_RINGS 400 402 if (rField_is_Ring(currRing)) 403 { 404 nDelete(&lc1); 405 nDelete(&lc2); 406 nDelete(&t2); 401 407 pSetCoeff0(m2, t1); 408 } 402 409 else 403 410 #endif … … 406 413 } 407 414 else 415 { 416 #ifdef HAVE_RINGS 417 if (rField_is_Ring(currRing)) 418 { 419 nDelete(&lc1); 420 nDelete(&lc2); 421 nDelete(&t1); 422 nDelete(&t2); 423 } 424 #endif 408 425 return NULL; 426 } 409 427 } 410 428 if (a2==NULL) … … 434 452 p_Setm(m1, currRing); 435 453 #ifdef HAVE_RINGS 436 if (rField_is_Ring(currRing)) 437 pSetCoeff0(m1, t2); 454 if (rField_is_Ring(currRing)) 455 { 456 pSetCoeff0(m1, t2); 457 nDelete(&lc1); 458 nDelete(&lc2); 459 nDelete(&t1); 460 } 438 461 else 439 462 #endif … … 487 510 #ifdef HAVE_RINGS 488 511 if (rField_is_Ring(currRing)) 512 { 489 513 pSetCoeff0(m1, t2); 514 nDelete(&lc1); 515 nDelete(&lc2); 516 nDelete(&t1); 517 } 490 518 else 491 519 #endif … … 498 526 #ifdef HAVE_RINGS 499 527 if (rField_is_Ring(currRing)) 500 pSetCoeff0(m2, t1); 528 { 529 pSetCoeff0(m2, t1); 530 nDelete(&lc1); 531 nDelete(&lc2); 532 nDelete(&t2); 533 } 501 534 else 502 535 #endif … … 508 541 if (rField_is_Ring(currRing)) 509 542 { 510 t1 = nSub(t1, t2); 511 equal = nIsZero(t1); 512 nDelete(&t2); 543 equal = nEqual(t1,t2); 513 544 } 514 545 else … … 526 557 #ifdef HAVE_RINGS 527 558 if (rField_is_Ring(currRing)) 528 pSetCoeff0(m1, t1); 559 { 560 pSetCoeff0(m1, nSub(t1, t2)); 561 nDelete(&lc1); 562 nDelete(&lc2); 563 nDelete(&t1); 564 nDelete(&t2); 565 } 529 566 else 530 567 #endif … … 537 574 if (rField_is_Ring(currRing)) 538 575 { 539 nDelete(&t1); 540 if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1); 541 if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2); 576 if (a2 != NULL) 577 { 578 nDelete(&t1); 579 t1 = nMult(pGetCoeff(a2),lc1); 580 } 581 if (a1 != NULL) 582 { 583 nDelete(&t2); 584 t2 = nMult(pGetCoeff(a1),lc2); 585 } 542 586 while (a1 != NULL && nIsZero(t2)) 543 587 { 544 588 pIter(a1); 545 if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2); 589 if (a1 != NULL) 590 { 591 nDelete(&t2); 592 t2 = nMult(pGetCoeff(a1),lc2); 593 } 546 594 } 547 595 while (a2 != NULL && nIsZero(t1)) 548 596 { 549 597 pIter(a2); 550 if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1); 598 if (a2 != NULL) 599 { 600 nDelete(&t1); 601 t1 = nMult(pGetCoeff(a2),lc1); 602 } 551 603 } 552 604 } … … 557 609 if (a1==NULL) 558 610 { 611 #ifdef HAVE_RINGS 612 if (rField_is_Ring(currRing)) 613 { 614 nDelete(&lc1); 615 nDelete(&lc2); 616 nDelete(&t1); 617 nDelete(&t2); 618 } 619 #endif 559 620 p_LmFree(m1,currRing); 560 621 return NULL; -
kernel/kstd1.cc
r4dcfc0f ra539ad 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kstd1.cc,v 1.3 0 2007-11-09 11:31:52 SingularExp $ */4 /* $Id: kstd1.cc,v 1.31 2008-02-06 09:12:46 wienand Exp $ */ 5 5 /* 6 6 * ABSTRACT: … … 748 748 if (pNext(strat->L[j].p) == strat->tail) 749 749 { 750 pLmFree(strat->L[j].p); /*deletes the short spoly and computes*/ 750 #ifdef HAVE_RINGS 751 if (rField_is_Ring(currRing)) 752 pLmDelete(strat->L[j].p); /*deletes the short spoly and computes*/ 753 else 754 #else 755 pLmFree(strat->L[j].p); /*deletes the short spoly and computes*/ 756 #endif 751 757 strat->L[j].p = NULL; 752 758 poly m1 = NULL, m2 = NULL; -
kernel/kstd2.cc
r4dcfc0f ra539ad 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kstd2.cc,v 1.5 7 2008-01-30 09:01:36 wienand Exp $ */4 /* $Id: kstd2.cc,v 1.58 2008-02-06 09:12:46 wienand Exp $ */ 5 5 /* 6 6 * ABSTRACT - Kernel: alg. of Buchberger … … 365 365 if (h->GetLmTailRing() == NULL) 366 366 { 367 if (h->lcm!=NULL) pLm Free(h->lcm);367 if (h->lcm!=NULL) pLmDelete(h->lcm); 368 368 #ifdef KDEBUG 369 369 h->lcm=NULL; … … 382 382 if (at <= strat->Ll) 383 383 { 384 #if 0385 if (kRingFindDivisibleByInS(strat->S, strat->sevS, strat->sl, h) < 0)386 return 1;387 #endif388 384 #ifdef KDEBUG 389 385 if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at); … … 1111 1107 { 1112 1108 // deletes the short spoly 1113 pLmFree(strat->P.p); 1109 #ifdef HAVE_RINGS 1110 if (rField_is_Ring(currRing)) 1111 pLmDelete(strat->P.p); 1112 else 1113 #endif 1114 pLmFree(strat->P.p); 1114 1115 strat->P.p = NULL; 1115 1116 poly m1 = NULL, m2 = NULL; … … 1243 1244 if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat); 1244 1245 // Print("[%d]",hilbeledeg); 1245 if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);1246 1246 if (strat->sl>srmax) srmax = strat->sl; 1247 1247 } … … 1250 1250 p_Delete(&strat->P.p2, currRing, strat->tailRing); 1251 1251 } 1252 1253 if (strat->P.lcm!=NULL) 1254 #ifdef HAVE_RINGS 1255 pLmDelete(strat->P.lcm); 1256 #else 1257 pLmFree(strat->P.lcm); 1258 #endif 1252 1259 #ifdef KDEBUG 1253 1260 memset(&(strat->P), 0, sizeof(strat->P)); -
kernel/kutil.cc
r4dcfc0f ra539ad 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kutil.cc,v 1.7 7 2008-02-01 15:11:33wienand Exp $ */4 /* $Id: kutil.cc,v 1.78 2008-02-06 09:12:46 wienand Exp $ */ 5 5 /* 6 6 * ABSTRACT: kernel: utils for kStd … … 917 917 { 918 918 if (set[j].lcm!=NULL) 919 #ifdef HAVE_RINGS _OLD919 #ifdef HAVE_RINGS 920 920 if (pGetCoeff(set[j].lcm) != NULL) 921 921 pLmDelete(set[j].lcm); … … 927 927 if (pNext(set[j].p) == strat->tail) 928 928 { 929 #ifdef HAVE_RINGS _OLD929 #ifdef HAVE_RINGS 930 930 if (pGetCoeff(set[j].p) != NULL) 931 931 pLmDelete(set[j].p); … … 1064 1064 strat->cp++; 1065 1065 pLmDelete(Lp.lcm); 1066 Lp.lcm=NULL;1067 1066 return; 1068 1067 } … … 1086 1085 strat->cp++; 1087 1086 pLmDelete(Lp.lcm); 1088 Lp.lcm=NULL;1089 1087 return; 1090 1088 } … … 1195 1193 } 1196 1194 #endif 1195 pLmDelete(Lp.lcm); 1197 1196 return; 1198 1197 } … … 1202 1201 // Is from a previous computed GB, therefore we know that spoly will 1203 1202 // reduce to zero. Oliver. 1203 WarnS("Could we come here? 8738947389"); 1204 1204 Lp.p=NULL; 1205 1205 } … … 1230 1230 *the first case is handeled in chainCrit 1231 1231 */ 1232 if (Lp.lcm!=NULL)pLmDelete(Lp.lcm);1232 pLmDelete(Lp.lcm); 1233 1233 } 1234 1234 else … … 2643 2643 { 2644 2644 poly p = p_Copy(h->next, strat->tailRing); 2645 number tmp = gcd; 2645 2646 gcd = nIntDiv(0, gcd); 2647 nDelete(&tmp); 2646 2648 p = p_Mult_nn(p, gcd, strat->tailRing); 2647 2649 nDelete(&gcd); … … 2711 2713 } 2712 2714 } 2715 nDelete(&gcd); 2713 2716 } 2714 2717 -
kernel/polys1.cc
r4dcfc0f ra539ad 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: polys1.cc,v 1.3 0 2008-01-30 09:01:38wienand Exp $ */4 /* $Id: polys1.cc,v 1.31 2008-02-06 09:12:47 wienand Exp $ */ 5 5 6 6 /* … … 482 482 { 483 483 #ifdef HAVE_RINGS 484 if (rField_is_Ring(currRing)) 484 if (rField_is_Ring(currRing)) 485 485 { 486 486 if ((ph!=NULL) && rField_has_Units(currRing)) … … 489 489 if (!nIsOne(k)) 490 490 { 491 number tmpGMP = k; 491 492 k = nInvers(k); 493 nDelete(&tmpGMP); 492 494 poly h = pNext(ph); 493 pSetCoeff 0(ph, nMult(pGetCoeff(ph), k));495 pSetCoeff(ph, nMult(pGetCoeff(ph), k)); 494 496 while (h != NULL) 495 497 { … … 497 499 pIter(h); 498 500 } 499 nDelete(&k);500 }501 } 502 nDelete(&k); 501 503 } 502 504 return; -
kernel/rintegers.cc
r4dcfc0f ra539ad 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: rintegers.cc,v 1. 8 2008-02-01 15:16:14wienand Exp $ */4 /* $Id: rintegers.cc,v 1.9 2008-02-06 09:12:47 wienand Exp $ */ 5 5 /* 6 6 * ABSTRACT: numbers modulo n … … 235 235 number nrzNeg (number c) 236 236 { 237 int_number erg = (int_number) omAllocBin(gmp_nrz_bin); // evtl. spaeter mit bin 238 mpz_init(erg); 239 mpz_mul_si(erg, (int_number) c, -1); 240 return (number) erg; 237 // nNeg inplace !!! TODO 238 // int_number erg = (int_number) omAllocBin(gmp_nrn_bin); // evtl. spaeter mit bin 239 // mpz_init(erg); 240 mpz_mul_si((int_number) c, (int_number) c, -1); 241 return c; 241 242 } 242 243 -
kernel/rmodulon.cc
r4dcfc0f ra539ad 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: rmodulon.cc,v 1.1 6 2008-02-01 15:16:15wienand Exp $ */4 /* $Id: rmodulon.cc,v 1.17 2008-02-06 09:12:47 wienand Exp $ */ 5 5 /* 6 6 * ABSTRACT: numbers modulo n … … 115 115 number nrnNeg (number c) 116 116 { 117 int_number erg = (int_number) omAllocBin(gmp_nrn_bin); // evtl. spaeter mit bin 118 mpz_init(erg); 119 mpz_sub(erg, nrnModul, (int_number) c); 120 return (number) erg; 117 // nNeg inplace !!! TODO 118 // int_number erg = (int_number) omAllocBin(gmp_nrn_bin); // evtl. spaeter mit bin 119 // mpz_init(erg); 120 mpz_sub((int_number) c, nrnModul, (int_number) c); 121 return c; 121 122 } 122 123
Note: See TracChangeset
for help on using the changeset viewer.