Changeset f92547 in git for kernel/kspoly.cc
- Timestamp:
- Mar 20, 2006, 9:33:57 PM (17 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 9a7b03d261325d1fc155f5625fe1867b6ef6432c
- Parents:
- f7cbb7696d6c24ac0b31ebc09c768d0a3df1a7a9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/kspoly.cc
rf7cbb7 rf92547 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kspoly.cc,v 1. 3 2006-01-13 18:10:04wienand Exp $ */4 /* $Id: kspoly.cc,v 1.4 2006-03-20 20:33:56 wienand Exp $ */ 5 5 /* 6 6 * ABSTRACT - Routines for Spoly creation and reductions … … 14 14 #include "p_Procs.h" 15 15 #include "gring.h" 16 #ifdef HAVE_RING2TOM 17 #include "polys.h" 18 #endif 16 19 17 20 #ifdef KDEBUG … … 312 315 bn = nIntDiv(bn, cn); 313 316 } 314 #ifdef HAVE_RING2TOM315 if (currRing->cring == 1) {316 while (((long) an)%2 == 0 && ((long) bn)%2 == 0) {317 an = (number) (((long) an) / 2);318 bn = (number) (((long) bn) / 2);319 }320 }321 #endif322 317 nDelete(&cn); 323 318 if (nIsOne(an)) … … 339 334 * remarks: 340 335 * 1. the coefficient is 0 (nNew) 336 * 1. a) in the case of coefficient ring, the coefficient is calculated 341 337 * 2. pNext is undefined 342 338 */ … … 352 348 BOOLEAN equal; 353 349 350 #ifdef HAVE_RING2TOM 351 number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2); 352 int ct = ksCheckCoeff(&lc1, &lc2); // gcd and zero divisors 353 if (currRing->cring == 1) 354 { 355 if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2); 356 if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1); 357 while (a1 != NULL && nIsZero(t2)) 358 { 359 pIter(a1); 360 if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2); 361 } 362 while (a2 != NULL && nIsZero(t1)) 363 { 364 pIter(a2); 365 if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1); 366 } 367 } 368 #endif 369 354 370 if (a1==NULL) 355 371 { … … 379 395 } 380 396 p_Setm(m2, currRing); 381 nNew(&(pGetCoeff(m2))); 397 #ifdef HAVE_RING2TOM 398 if (currRing->cring == 1) 399 pSetCoeff(m2, t1); 400 else 401 #endif 402 nNew(&(pGetCoeff(m2))); 382 403 return m2; 383 404 } … … 410 431 } 411 432 p_Setm(m1, currRing); 412 nNew(&(pGetCoeff(m1))); 433 #ifdef HAVE_RING2TOM 434 if (currRing->cring == 1) 435 pSetCoeff(m1, t2); 436 else 437 #endif 438 nNew(&(pGetCoeff(m1))); 413 439 return m1; 414 440 } … … 467 493 } 468 494 } 469 t1 = nMult(pGetCoeff(a2),pGetCoeff(p1)); 470 t2 = nMult(pGetCoeff(a1),pGetCoeff(p2)); 471 equal = nEqual(t1,t2); 472 nDelete(&t2); 473 nDelete(&t1); 495 #ifdef HAVE_RING2TOM 496 if (currRing->cring == 1) 497 { 498 t1 = nAdd(t1, t2); 499 equal = nIsZero(t1); 500 nDelete(&t2); 501 } 502 else 503 #endif 504 { 505 t1 = nMult(pGetCoeff(a2),pGetCoeff(p1)); 506 t2 = nMult(pGetCoeff(a1),pGetCoeff(p2)); 507 equal = nEqual(t1,t2); 508 nDelete(&t2); 509 nDelete(&t1); 510 } 474 511 if (!equal) 475 512 { 476 513 p_LmFree(m2,currRing); 477 nNew(&(pGetCoeff(m1))); 514 #ifdef HAVE_RING2TOM 515 if (currRing->cring == 1) 516 pSetCoeff(m1, t1); 517 else 518 #endif 519 nNew(&(pGetCoeff(m1))); 478 520 return m1; 479 521 } 480 522 pIter(a1); 481 523 pIter(a2); 524 #ifdef HAVE_RING2TOM 525 if (currRing->cring == 1) 526 { 527 nDelete(&t1); 528 if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1); 529 if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2); 530 while (a1 != NULL && nIsZero(t2)) 531 { 532 pIter(a1); 533 if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2); 534 } 535 while (a2 != NULL && nIsZero(t1)) 536 { 537 pIter(a2); 538 if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1); 539 } 540 } 541 #endif 482 542 if (a2==NULL) 483 543 {
Note: See TracChangeset
for help on using the changeset viewer.