Changeset a539ad in git for kernel/kspoly.cc
- Timestamp:
- Feb 6, 2008, 10:12:47 AM (15 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 8f2bd1fc11ce18b5be7a734f75309011e212a4d3
- Parents:
- 4dcfc0f02d5040e014133baff89ccfc1bbc383ed
- File:
-
- 1 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;
Note: See TracChangeset
for help on using the changeset viewer.