Changeset a6a239 in git for Singular/polys-impl.cc
- Timestamp:
- Sep 12, 2000, 6:01:23 PM (24 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38077648e7239f98078663eb941c3c979511150a')
- Children:
- fe7bd4983d0c4322efb17bf36dbf3b28109b9608
- Parents:
- 47e83c37a0601dd5b7dadba83e9c5b04d7efeaf1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/polys-impl.cc
r47e83c3 ra6a239 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: polys-impl.cc,v 1. 49 2000-09-04 13:39:03obachman Exp $ */4 /* $Id: polys-impl.cc,v 1.50 2000-09-12 16:01:09 obachman Exp $ */ 5 5 6 6 /*************************************************************** … … 20 20 #include <string.h> 21 21 #include "mod2.h" 22 #include <omalloc.h> 22 23 #include "omalloc.h" 24 #ifdef PDEBUG 25 #undef NO_INLINE3 26 #define NO_INLINE3 27 #endif 28 #include "polys-impl.h" 29 23 30 #include "tok.h" 24 31 #include "structs.h" … … 27 34 #include "polys.h" 28 35 #include "ring.h" 29 #include "polys-impl.h"30 36 #include "p_Procs.h" 31 37 #include "dError.h" 32 38 33 #ifdef HAVE_SHIFTED_EXPONENTS34 39 #ifdef PDEBUG 35 40 int pDBsyzComp=0; 36 #endif37 41 #endif 38 42 … … 42 46 * 43 47 ***************************************************************/ 44 45 46 /*2 47 * delete a poly, resets pointer 48 * put the monomials in the freelist 49 */ 50 void _pDelete(poly* p, omBin heap) 51 { 52 poly h = *p; 53 poly pp; 54 55 while (h!=NULL) 56 { 57 nDelete(&(h->coef)); 58 pp=h; 59 pIter(h); 60 _pFree1((ADDRESS)pp, heap); 61 } 62 *p = NULL; 63 } 64 65 /*2 66 * remove first monom 67 */ 68 void _pDelete1(poly* p, omBin heap) 69 { 70 poly h = *p; 71 72 if (h==NULL) return; 73 nDelete(&(h->coef)); 74 *p = pNext(h); 75 _pFree1((ADDRESS)h, heap); 76 } 48 #ifdef PDEBUG 49 BOOLEAN pIsMonomOf(poly p, poly m) 50 { 51 if (m == NULL) return TRUE; 52 while (p != NULL) 53 { 54 if (p == m) return TRUE; 55 pIter(p); 56 } 57 return FALSE; 58 } 59 60 BOOLEAN pHaveCommonMonoms(poly p, poly q) 61 { 62 while (p != NULL) 63 { 64 if (pIsMonomOf(q, p)) 65 { 66 return TRUE; 67 } 68 pIter(p); 69 } 70 return FALSE; 71 } 72 #endif 77 73 78 74 … … 85 81 } 86 82 87 /*288 * creates a copy of p89 */90 poly _pCopy(omBin d_h, poly s_p)91 {92 spolyrec dp;93 poly d_p = &dp;94 95 assume(d_h != NULL && (d_h == currPolyBin) ||96 d_h->sizeW == currPolyBin->sizeW);97 pTest(s_p);98 while (s_p != NULL)99 {100 omTypeAllocBin( poly,d_p->next, d_h);101 d_p = d_p->next;102 pSetCoeff0(d_p, nCopy(pGetCoeff(s_p)));103 omMemcpyW(&(d_p->exp.l[0]), &(s_p->exp.l[0]), currRing->ExpLSize);104 pIter(s_p);105 }106 pNext(d_p) = NULL;107 pHeapTest(dp.next, d_h);108 return dp.next;109 }110 111 poly _pCopy(poly s_p)112 {113 return _pCopy(currPolyBin, s_p);114 }115 116 117 83 poly _pShallowCopyDelete(omBin d_h, poly *p, omBin s_h) 118 84 { … … 134 100 135 101 d_p->coef = s_p->coef; 136 d_p->exp .l[0] = s_p->exp.l[0];102 d_p->exp[0] = s_p->exp[0]; 137 103 138 104 tmp = pNext(s_p); … … 149 115 150 116 d_p->coef = s_p->coef; 151 d_p->exp .l[0] = s_p->exp.l[0];152 d_p->exp .l[1] = s_p->exp.l[1];117 d_p->exp[0] = s_p->exp[0]; 118 d_p->exp[1] = s_p->exp[1]; 153 119 154 120 tmp = pNext(s_p); … … 169 135 170 136 d_p->coef = s_p->coef; 171 omMemcpy_nwODD(&(d_p->exp .l[0]), &(s_p->exp.l[1]), currRing->ExpLSize);137 omMemcpy_nwODD(&(d_p->exp[0]), &(s_p->exp[1]), currRing->ExpLSize); 172 138 173 139 tmp = pNext(s_p); … … 185 151 186 152 d_p->coef = s_p->coef; 187 omMemcpy_nwEVEN(&(d_p->exp .l[0]), &(s_p->exp.l[1]), currRing->ExpLSize);153 omMemcpy_nwEVEN(&(d_p->exp[0]), &(s_p->exp[1]), currRing->ExpLSize); 188 154 189 155 tmp = pNext(s_p); … … 199 165 } 200 166 201 202 /*2203 * creates a copy of the initial monomial of p204 * sets the coeff of the copy to a defined value205 */206 poly _pCopy1(poly p)207 {208 poly w;209 w = pNew();210 pCopy2(w,p);211 nNew(&(w->coef));212 pNext(w) = NULL;213 return w;214 }215 216 /*2217 * returns (a copy of) the head term of a218 */219 poly _pHead(omBin heap, poly p)220 {221 poly w=NULL;222 223 if (p!=NULL)224 {225 assume(heap != NULL && (heap == currPolyBin) ||226 heap->sizeW == currPolyBin->sizeW);227 228 omTypeAllocBin( poly,w, heap);229 omMemcpyW(&(w->exp.l[0]), &(p->exp.l[0]), currRing->ExpLSize);230 pSetCoeff0(w,nCopy(pGetCoeff(p)));231 pNext(w) = NULL;232 }233 return w;234 }235 236 poly _pShallowCopyDeleteHead(omBin d_h, poly *s_p, omBin s_h)237 {238 poly w = NULL;239 poly p = *s_p;240 241 if (p!=NULL)242 {243 assume(d_h != NULL && s_h != NULL &&244 d_h->sizeW == s_h->sizeW);245 246 omTypeAllocBin( poly,w, d_h);247 omMemcpyW(&(w->exp.l[0]), &(p->exp.l[0]), currRing->ExpLSize);248 pSetCoeff0(w,pGetCoeff(p));249 pNext(w) = NULL;250 251 *s_p = pNext(p);252 omFreeBin(p, s_h);253 }254 return w;255 }256 257 258 259 167 poly pHeadProc(poly p) 260 168 { … … 262 170 } 263 171 264 /*2265 * returns (a copy of) the head term of a without the coef266 */267 poly _pHead0(poly p)268 {269 poly w=NULL;270 271 if (p!=NULL)272 {273 w = pNew();274 pCopy2(w,p);275 pSetCoeff0(w,NULL);276 pNext(w) = NULL;277 }278 return w;279 }280 281 282 /***************************************************************283 *284 * Routines for turned on debugging285 *286 ***************************************************************/287 288 #if defined(PDEBUG) && PDEBUG > 1289 Exponent_t pPDSetExp(poly p, int v, Exponent_t e, char* f, int l)290 {291 if (v == 0)292 {293 dReportError("zero index to exponent in %s:%d\n", f, l);294 }295 if (v > pVariables)296 {297 dReportError("index %d to exponent too large in %s:%d\n", v, f, l);298 }299 return (p)->exp.e[_pExpIndex(v)]=(e);300 }301 302 Exponent_t pPDGetExp(poly p, int v, char* f, int l)303 {304 if (v == 0)305 {306 dReportError("zero index to exponent in %s:%d\n", f, l);307 }308 if (v > pVariables)309 {310 dReportError("index %d to exponent too large in %s:%d\n", v, f, l);311 }312 return (p)->exp.e[_pExpIndex(v)];313 }314 315 Exponent_t pPDRingSetExp(ring r, poly p, int v, Exponent_t e, char* f, int l)316 {317 if (v == 0)318 {319 dReportError("zero index to exponent in %s:%d\n", f, l);320 }321 if (v > r->N)322 {323 dReportError("index %d to exponent too large in %s:%d\n", v, f, l);324 }325 return (p)->exp.e[_pRingExpIndex(r, v)]=(e);326 }327 328 Exponent_t pPDRingGetExp(ring r, poly p, int v, char* f, int l)329 {330 if (v == 0)331 {332 dReportError("zero index to exponent in %s:%d\n", f, l);333 }334 if (v > r->N)335 {336 dReportError("index %d to exponent too large in %s:%d\n", v, f, l);337 }338 return (p)->exp.e[_pRingExpIndex(r,v)];339 }340 341 Exponent_t pPDIncrExp(poly p, int v, char* f, int l)342 {343 if (v == 0)344 {345 dReportError("zero index to exponent in %s:%d\n", f, l);346 }347 if (v > pVariables)348 {349 dReportError("index %d to exponent too large in %s:%d\n", v, f, l);350 }351 return ((p)->exp.e[_pExpIndex(v)])++;352 }353 354 Exponent_t pPDDecrExp(poly p, int v, char* f, int l)355 {356 if (v == 0)357 {358 dReportError("zero index to exponent in %s:%d\n", f, l);359 }360 if (v > pVariables)361 {362 dReportError("index %d to exponent too large in %s:%d\n", v, f, l);363 }364 return ((p)->exp.e[_pExpIndex(v)])--;365 }366 367 Exponent_t pPDAddExp(poly p, int v, Exponent_t e, char* f, int l)368 {369 if (v == 0)370 {371 dReportError("zero index to exponent in %s:%d\n", f, l);372 }373 if (v > pVariables)374 {375 dReportError("index %d to exponent too large in %s:%d\n", v, f, l);376 }377 return ((p)->exp.e[_pExpIndex(v)]) += (e);378 }379 380 Exponent_t pPDSubExp(poly p, int v, Exponent_t e, char* f, int l)381 {382 if (v == 0)383 {384 dReportError("zero index to exponent in %s:%d\n", f, l);385 }386 if (v > pVariables)387 {388 dReportError("index %d to exponent too large in %s:%d\n", v, f, l);389 }390 return ((p)->exp.e[_pExpIndex(v)]) -= (e);391 }392 393 Exponent_t pPDMultExp(poly p, int v, Exponent_t e, char* f, int l)394 {395 if (v == 0)396 {397 dReportError("zero index to exponent in %s:%d\n", f, l);398 }399 if (v > pVariables)400 {401 dReportError("index %d to exponent too large in %s:%d\n", v, f, l);402 }403 return ((p)->exp.e[_pExpIndex(v)]) *= (e);404 }405 406 // routines on components407 Exponent_t pDBSetComp(poly p, Exponent_t k, int le, char* f, int l)408 {409 if (k < 0)410 {411 dReportError("set negative component %d in %s:%d", k, f, l);412 }413 if (currRing->order[1] == ringorder_S)414 {415 if (le <= 0) le = currRing->typ[1].data.syzcomp.length;416 if (k > l)417 {418 dReportError("component %d larger then max %d in %s:%d",419 k, le, f, l);420 }421 }422 return _pGetComp(p) = (k);423 }424 425 Exponent_t pDBDecrComp(poly p, char* f, int l)426 {427 if (_pGetComp(p) < 1)428 {429 dReportError("decrement to negative component %d in %s:%d\n", _pGetComp(p), f, l);430 }431 return _pGetComp(p)--;432 }433 434 Exponent_t pDBAddComp(poly p, Exponent_t k, int le, char* f, int l)435 {436 if (_pGetComp(p) + k < 0)437 {438 dReportError("add to negative component %d + %d = %d in %s:%d\n", _pGetComp(p),439 k, _pGetComp(p) + k, f, l);440 }441 _pGetComp(p) += (k);442 443 if (currRing->order[1] == ringorder_S)444 {445 if (le <= 0) le = currRing->typ[1].data.syzcomp.length;446 if (_pGetComp(p) > le)447 {448 dReportError("sum of components %d larger then max %d in %s:%d\n",449 _pGetComp(p), le, f, l);450 assume(0);451 }452 }453 return _pGetComp(p);454 }455 456 Exponent_t pDBSubComp(poly p, Exponent_t k, char* f, int l)457 {458 if (_pGetComp(p) - k < 0)459 {460 dReportError("sub to negative component %d - %d = %d in %s:%d\n", _pGetComp(p),461 k, _pGetComp(p) - k, f, l);462 }463 return _pGetComp(p) -= (k);464 }465 466 Exponent_t pDBRingSetComp(ring r, poly p, Exponent_t k, char* f, int l)467 {468 if (k < 0)469 {470 dReportError("set negative component %d in %s:%d\n", k, f, l);471 }472 return _pRingGetComp(r, p) = (k);473 }474 475 // checks whether fast monom add did not overflow476 void pDBMonAddOn(poly p1, poly p2, char* f, int l)477 {478 poly ptemp = pHead0(p1);479 480 if (pGetComp(p1) != 0 && pGetComp(p2) != 0)481 {482 dReportError("Error in pMonAddOn: both components %d:%d !=0 in %s:%d",483 pGetComp(p1), pGetComp(p2), f, l);484 }485 486 __pMonAddOn(p1, p2);487 488 for (int i=1; i<=pVariables; i++)489 {490 pAddExp(ptemp, i, pGetExp(p2, i));491 }492 pAddComp(ptemp, pGetComp(p2));493 pSetm(ptemp);494 495 if (! pEqual(ptemp, p1))496 {497 dReportError("Error in pMonAddOn in %s:%d\n", f, l);498 }499 500 pFree1(ptemp);501 }502 503 void pDBMonSubFrom(poly p1, poly p2, char* f, int l)504 {505 poly ptemp = pNew();506 pCopy2(ptemp, p1);507 508 if ((pGetComp(p1) != pGetComp(p2)) && (pGetComp(p2)!=0))509 {510 dReportError("Error in pMonSubFrom: components are different %d:%d in %s:%d",511 pGetComp(p1), pGetComp(p2), f, l);512 }513 514 __pMonSubFrom(p1, p2);515 516 for (int i=1; i<=pVariables; i++)517 {518 if (pGetExp(ptemp, i) < pGetExp(p2, i))519 {520 dReportError("Error in pMonSubFrom: %dth exponent %d of p1 smaller than %d of p2", i, pGetExp(ptemp, i), pGetExp(p2, i));521 }522 pSubExp(ptemp, i, pGetExp(p2, i));523 }524 pSetComp(ptemp, pGetComp(ptemp)-pGetComp(p2));525 pSetm(ptemp);526 527 if (! pEqual(ptemp, p1))528 {529 dReportError("Error in pMonSubFrom in %s:%d", f, l);530 }531 532 pFree1(ptemp);533 }534 535 void prDBMonAdd(poly p1, poly p2, poly p3, ring r, char* f, int l)536 {537 if (r == currRing)538 {539 if (pGetComp(p3) != 0 && pGetComp(p2) != 0)540 {541 dReportError("Error in pMonAdd: both components %d:%d !=0 in %s:%d",542 pGetComp(p3), pGetComp(p2), f, l);543 }544 if (p2 == p1 || p3 == p1)545 {546 dReportError("Error in pMonAdd: Destination equals source in %s:%d", f, l);547 }548 }549 __pMonAdd(p1, p2, p3, r);550 551 if (r == currRing)552 {553 poly ptemp = pInit();554 for (int i=1; i<=pVariables; i++)555 {556 pSetExp(ptemp, i, pGetExp(p2, i) + pGetExp(p3, i));557 if (pGetExp(ptemp, i) != pGetExp(p1, i))558 {559 dReportError("Error in pMonAdd: %th exponent: %d != (%d == %d + %d)",560 i, pGetExp(p1, i), pGetExp(ptemp, i), pGetExp(p2, i),561 pGetExp(p3, i));562 }563 }564 pSetComp(ptemp, pGetComp(p2) + pGetComp(p3));565 pSetm(ptemp);566 567 if (! pEqual(ptemp, p1))568 dReportError("Error in pMonAdd in %s:%d", f, l);569 pFree1(ptemp);570 }571 }572 573 static BOOLEAN OldpDivisibleBy(poly a, poly b)574 {575 if ((a!=NULL)&&((pGetComp(a)==0) || (pGetComp(a) == pGetComp(b))))576 {577 for (int i = 1; i<=pVariables; i++)578 if (pGetExp(a, i) > pGetExp(b,i)) return FALSE;579 return TRUE;580 }581 return FALSE;582 }583 584 585 BOOLEAN pDBDivisibleBy(poly a, poly b, char* f, int l)586 {587 BOOLEAN istrue = OldpDivisibleBy(a,b);588 BOOLEAN f_istrue = _pDivisibleBy_orig(a, b);589 590 if (istrue != f_istrue)591 {592 dReportError("Error in pDivisibleBy in %s:%d\n", f, l);593 _pDivisibleBy_orig(a, b);594 }595 return istrue;596 }597 598 BOOLEAN pDBDivisibleBy1(poly a, poly b, char* f, int l)599 {600 BOOLEAN istrue = OldpDivisibleBy(a,b);601 BOOLEAN f_istrue = _pDivisibleBy1_orig(a, b);602 603 if (istrue != f_istrue)604 {605 dReportError("Error in pDivisibleBy1 in %s:%d\n", f, l);606 _pDivisibleBy1_orig(a, b);607 }608 return istrue;609 }610 611 BOOLEAN pDBDivisibleBy2(poly a, poly b, char* f, int l)612 {613 BOOLEAN istrue = OldpDivisibleBy(a,b);614 BOOLEAN f_istrue = __pDivisibleBy(a, b);615 616 if (istrue != f_istrue)617 {618 dReportError("Error in pDivisibleBy2 in %s:%d\n", f, l);619 __pDivisibleBy(a, b);620 }621 return f_istrue;622 }623 624 #endif // defined(PDEBUG) && PDEBUG > 1625 626 172 #ifdef PDEBUG 627 BOOLEAN mmDBEqual(poly p, poly q, char *f, int l)628 {629 int i;630 631 for (i = 1; i<=pVariables; i++)632 {633 if (pGetExp(p,i) != pGetExp(q, i)) return FALSE;634 }635 if (pGetComp(p) != pGetComp(q)) return FALSE;636 if (__pEqual(p, q) != TRUE)637 {638 dReportError("Error in pEqual: exp/comp same, bug monoms different in %s:%d",639 f, l);640 }641 return TRUE;642 }643 644 173 BOOLEAN prDBTest(poly p, ring r, char* f, int l) 645 174 { … … 681 210 if ((p->coef==NULL)&&(nGetChar()<2)) 682 211 { 683 dReportError("NULL coef in poly in %s:%d \n",f,l);212 dReportError("NULL coef in poly in %s:%d",f,l); 684 213 return FALSE; 685 214 } 686 215 if (nIsZero(p->coef)) 687 216 { 688 dReportError("zero coef in poly in %s:%d \n",f,l);217 dReportError("zero coef in poly in %s:%d",f,l); 689 218 return FALSE; 690 219 } 691 220 int i=pVariables; 692 #ifndef HAVE_SHIFTED_EXPONENTS693 // can not hapen for SHIFTED_EXPONENTS694 for(;i;i--)695 {696 if (pGetExp(p,i)<0)697 {698 dReportError("neg. Exponent %d of x(%d) in %s:%d\n",pGetExp(p,i),i,f,l);699 return FALSE;700 }701 }702 #endif703 if (pGetComp(p)<0)704 {705 dReportError("neg Component in %s:%d\n",f,l);706 return FALSE;707 }708 221 if (ismod==0) 709 222 { … … 715 228 if (pGetComp(p)==0) 716 229 { 717 dReportError("mix vec./poly in %s:%d \n",f,l);230 dReportError("mix vec./poly in %s:%d",f,l); 718 231 return FALSE; 719 232 } … … 723 236 if (pGetComp(p)!=0) 724 237 { 725 dReportError("mix poly/vec. in %s:%d \n",f,l);238 dReportError("mix poly/vec. in %s:%d",f,l); 726 239 return FALSE; 727 240 } … … 737 250 if (! (c1 == 0 || cc1 != 0)) 738 251 { 739 dReportError("Component <-> TrueComponent zero mismatch \n", f, l);252 dReportError("Component <-> TrueComponent zero mismatch", f, l); 740 253 return FALSE; 741 254 } 742 255 if (! (c1 == 0 || ccc1 != 0)) 743 256 { 744 dReportError("Component <-> ShiftedComponent zero mismatch \n", f, l);257 dReportError("Component <-> ShiftedComponent zero mismatch", f, l); 745 258 return FALSE; 746 259 } 747 ec1 = p->exp .l[currRing->typ[1].data.syzcomp.place];260 ec1 = p->exp[currRing->typ[1].data.syzcomp.place]; 748 261 if (ec1 != ccc1) 749 262 { … … 754 267 if (currRing->order[0] == ringorder_s) 755 268 { 756 unsigned long syzindex = p->exp .l[currRing->typ[0].data.syz.place];269 unsigned long syzindex = p->exp[currRing->typ[0].data.syz.place]; 757 270 pSetm(p); 758 if (p->exp .l[currRing->typ[0].data.syz.place] != syzindex)759 { 760 dReportError("Syzindex wrong: Was %dl but should be %d in %s:%d \n",761 syzindex, p->exp .l[currRing->typ[0].data.syz.place], f, l);271 if (p->exp[currRing->typ[0].data.syz.place] != syzindex) 272 { 273 dReportError("Syzindex wrong: Was %dl but should be %d in %s:%d", 274 syzindex, p->exp[currRing->typ[0].data.syz.place], f, l); 762 275 } 763 276 } 764 277 old=p; 765 278 pIter(p); 766 if (pC omp(old,p)!=1)279 if (pCmp(old,p)!=1) 767 280 { 768 281 dReportError("wrong order ("); 769 282 wrp(old); 770 Print(") in %s:%d (pComp=%d)\n",f,l,pC omp(old,p));283 Print(") in %s:%d (pComp=%d)\n",f,l,pCmp(old,p)); 771 284 return FALSE; 772 285 } … … 795 308 #endif // PDEBUG 796 309 797 static unsigned long GetBitFields(Exponent_t e,798 unsigned int s, unsigned int n)310 static inline unsigned long GetBitFields(Exponent_t e, 311 unsigned int s, unsigned int n) 799 312 { 800 313 unsigned int i = 0, ev = 0; … … 826 339 // exp1 / exp2 ==> (ev1 & ~ev2) == 0, i.e., 827 340 // if (ev1 & ~ev2) then exp1 does not divide exp2 828 unsigned long p GetShortExpVector(poly p)341 unsigned long p_GetShortExpVector(poly p, ring r) 829 342 { 830 343 assume(p != NULL); 831 344 if (p == NULL) return 0; 832 345 unsigned long ev = 0; // short exponent vector 833 unsigned int n = BIT_SIZEOF_LONG / pVariables; // number of bits per exp346 unsigned int n = BIT_SIZEOF_LONG / r->N; // number of bits per exp 834 347 unsigned int m1; // highest bit which is filled with (n+1) 835 348 unsigned int i = 0, j=1; … … 837 350 if (n == 0) 838 351 { 839 for (; j<=(unsigned long) pVariables; j++)840 { 841 if (p GetExp(p,j) > 0) i++;352 for (; j<=(unsigned long) r->N; j++) 353 { 354 if (p_GetExp(p,j,r) > 0) i++; 842 355 if (i == BIT_SIZEOF_LONG) break; 843 356 } … … 847 360 else 848 361 { 849 m1 = (n+1)*(BIT_SIZEOF_LONG - n* pVariables);362 m1 = (n+1)*(BIT_SIZEOF_LONG - n*r->N); 850 363 } 851 364 … … 853 366 while (i<m1) 854 367 { 855 ev |= GetBitFields(p GetExp(p, j), i, n);368 ev |= GetBitFields(p_GetExp(p, j,r), i, n); 856 369 i += n; 857 370 j++; … … 861 374 while (i<BIT_SIZEOF_LONG) 862 375 { 863 ev |= GetBitFields(p GetExp(p, j), i, n);376 ev |= GetBitFields(p_GetExp(p, j,r), i, n); 864 377 i += n; 865 378 j++; … … 873 386 static int pDivisibleBy_ShortFalse = 1; 874 387 static int pDivisibleBy_Null = 1; 875 BOOLEAN pDBShortDivisibleBy(poly p1, unsigned long sev_1, 876 poly p2, unsigned long not_sev_2, 877 char* f, int l) 878 { 879 if (sev_1 != 0 && pGetShortExpVector(p1) != sev_1) 880 { 881 dReportError("sev1 is %o but should be %o in %s:%d\n", sev_1, 882 pGetShortExpVector(p1), f, l); 883 assume(0); 884 } 885 if (~ pGetShortExpVector(p2) != not_sev_2) 886 { 887 dReportError("not_sev2 is %o but should be %o in %s:%d\n", not_sev_2, 888 ~ pGetShortExpVector(p2), f, l); 889 assume(0); 388 BOOLEAN pDebugShortDivisibleBy(poly p1, unsigned long sev_1, ring r_1, 389 poly p2, unsigned long not_sev_2, ring r_2) 390 { 391 if (sev_1 != 0 && pGetShortExpVector(p1, r_1) != sev_1) 392 { 393 dReportError("sev1 is %o but should be %o", sev_1, 394 pGetShortExpVector(p1, r_1)); 395 } 396 if (~ pGetShortExpVector(p2, r_2) != not_sev_2) 397 { 398 dReportError("not_sev2 is %o but should be %o", not_sev_2, 399 ~ pGetShortExpVector(p2, r_2)); 890 400 } 891 401 if (sev_1 == 0) pDivisibleBy_Null++; 892 402 pDivisibleBy_number++; 893 BOOLEAN ret = pDivisibleBy(p1, p2);403 BOOLEAN ret = _p_DivisibleBy1(p1, r1, p2, r2); 894 404 if (! ret) pDivisibleBy_FALSE++; 895 405 if (sev_1 & not_sev_2) … … 898 408 if (ret) 899 409 { 900 dReportError("p1 divides p2, but sev's are wrong in %s:%d\n", f, l);410 dReportError("p1 divides p2, but sev's are wrong"); 901 411 assume(0); 902 412 } … … 916 426 #endif 917 427 918 #ifdef HAVE_SHIFTED_EXPONENTS919 428 int rComp0_Func(poly p1,poly p2) 920 429 { … … 922 431 for(i=0; i<=currRing->pCompHighIndex;i++) 923 432 { 924 if (p1->exp .l[i] != p2->exp.l[i])925 { 926 if (p1->exp .l[i] > p2->exp.l[i])433 if (p1->exp[i] != p2->exp[i]) 434 { 435 if (p1->exp[i] > p2->exp[i]) 927 436 return currRing->ordsgn[i]; 928 437 else … … 939 448 for(i=0; i<=currRing->pCompHighIndex;i++) 940 449 { 941 if (p1->exp .l[i] != p2->exp.l[i])942 { 943 if (p1->exp .l[i] > p2->exp.l[i])450 if (p1->exp[i] != p2->exp[i]) 451 { 452 if (p1->exp[i] > p2->exp[i]) 944 453 return currRing->ordsgn[i]; 945 454 else … … 950 459 } 951 460 #endif 952 #endif 461 953 462 #endif // POLYS_IMPL_CC
Note: See TracChangeset
for help on using the changeset viewer.