Changeset 601105 in git
- Timestamp:
- Nov 19, 2013, 6:39:47 PM (9 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '1d362c315e551a5b527ab0759f8839cf0e94f3a5')
- Children:
- 448b6571955b81192b53dc7300bb54a1984142e3
- Parents:
- 9d864add8f262ed66a3af97f514c37d01844334c
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/kstd1.cc
r9d864a r601105 364 364 int pass = 0; 365 365 long d,reddeg; 366 367 368 369 370 371 372 373 PrintS("The pair h : "); PrintLn(); PrintLn();374 PrintS("p1 = "); p_Write(h->p1,strat->tailRing); PrintLn();375 PrintS("p2 = "); p_Write(h->p2,strat->tailRing); PrintLn();376 PrintS("p = "); p_Write(h->p,strat->tailRing); PrintLn();377 378 PrintS("The actual reducer T is: ");379 380 381 382 383 384 385 PrintS("T[");printf("%i",iii);PrintS("] = ");p_Write(strat->T[iii].p,strat->tailRing);386 387 388 389 366 367 368 #if ADIDEBUG_NF 369 int iii; 370 PrintLn(); 371 PrintS("---------------------------- NEW REDRILOC COMPUTATION ----------------------------"); 372 PrintLn(); 373 PrintS(" The pair h : "); PrintLn(); PrintLn(); 374 PrintS(" p1 = "); p_Write(h->p1,strat->tailRing); PrintLn(); 375 PrintS(" p2 = "); p_Write(h->p2,strat->tailRing); PrintLn(); 376 PrintS(" p = "); p_Write(h->p,strat->tailRing); PrintLn(); 377 PrintLn(); 378 PrintS(" The actual reducer T is: "); 379 if(strat->tl<0) 380 {PrintS(" Empty.");PrintLn();} 381 else 382 for (iii=0;iii<=strat->tl;iii++) 383 { 384 PrintLn(); 385 PrintS(" T[");printf("%i",iii);PrintS("] = ");p_Write(strat->T[iii].p,strat->tailRing); 386 PrintLn(); 387 } 388 #endif /* ADIDEBUG_NF */ 389 390 390 d = h->GetpFDeg()+ h->ecart; 391 391 reddeg = strat->LazyDegree+d; 392 392 h->SetShortExpVector(); 393 393 #if ADIDEBUG_NF 394 395 PrintS(" 394 PrintLn(); 395 PrintS(" Searching for a poly in T that divides h (of ecart "); 396 396 printf("%i",h->ecart);PrintS(") ..."); 397 397 PrintLn(); … … 401 401 j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h); 402 402 #if ADIDEBUG_NF 403 404 405 406 407 PrintS("Found one: T[");printf("%i",j);408 409 410 411 PrintS("Try to find another with smaller ecart:");412 413 414 415 416 417 PrintS("No poly in T divides h.");418 419 420 403 if(j != -1) 404 { 405 ei = strat->T[j].ecart; 406 PrintLn(); 407 PrintS(" Found one: T[");printf("%i",j); 408 PrintS("] of ecart ");printf("%i",ei); 409 PrintS(": ");p_Write(strat->T[j].p,strat->tailRing); 410 PrintLn(); 411 PrintS(" Try to find another with smaller ecart:"); 412 PrintLn(); 413 } 414 else 415 { 416 PrintLn(); 417 PrintS(" No poly in T divides h."); 418 PrintLn(); 419 } 420 #endif 421 421 if (j < 0) 422 422 { … … 427 427 ei = strat->T[j].ecart; 428 428 ii = j; 429 430 431 429 #if ADIDEBUG_NF 430 iii=ii; 431 #endif 432 432 if (ei > h->ecart && ii < strat->tl) 433 433 { 434 434 li = strat->T[j].length; 435 435 // the polynomial to reduce with (up to the moment) is; 436 436 // pi with ecart ei and length li … … 462 462 } 463 463 } 464 465 464 465 466 466 #if ADIDEBUG_NF 467 467 if(iii == ii) 468 469 470 PrintS("None was found.");471 472 468 { 469 PrintLn(); 470 PrintS(" None was found."); 471 PrintLn(); 472 } 473 473 else 474 475 476 PrintS("A better one (ecart = ");printf("%i",ei);PrintS("): T[");477 478 479 474 { 475 PrintLn(); 476 PrintS(" A better one (ecart = ");printf("%i",ei);PrintS("): T["); 477 printf("%i] = ",ii);p_Write(strat->T[ii].p,strat->tailRing); 478 PrintLn(); 479 } 480 480 #endif 481 481 482 482 } 483 483 … … 514 514 #if ADIDEBUG_NF 515 515 PrintLn(); 516 PrintS("Partial Reduced h = ");p_Write(h->p,strat->tailRing);517 518 516 PrintS(" Partial Reduced h = ");p_Write(h->p,strat->tailRing); 517 PrintLn(); 518 #endif 519 519 strat->fromT=FALSE; 520 520 … … 1142 1142 while (i <= strat->tl) 1143 1143 { 1144 1144 p = strat->T[i]; 1145 1145 deleteHC(&p,strat, TRUE); 1146 1146 /*- tries to cancel a unit: -*/ … … 1195 1195 if (TEST_OPT_FINDET) 1196 1196 return; 1197 1197 1198 1198 #ifndef HAVE_RINGS 1199 1199 strat->red = redFirst; 1200 1200 strat->use_buckets = kMoraUseBucket(strat); 1201 1201 #else 1202 1203 1204 1205 1206 1207 #endif 1208 1202 if ( (!rField_is_Ring(currRing)) || (currRing->OrdSgn != -1)) 1203 { 1204 strat->red = redFirst; 1205 strat->use_buckets = kMoraUseBucket(strat); 1206 } 1207 #endif 1208 1209 1209 updateT(strat); 1210 1210 1211 1211 #ifndef HAVE_RINGS 1212 1212 strat->posInT = posInT2; 1213 1213 reorderT(strat); 1214 1214 #else 1215 1216 1217 1218 1219 1215 if ( (!rField_is_Ring(currRing)) || (currRing->OrdSgn != -1)) 1216 { 1217 strat->posInT = posInT2; 1218 reorderT(strat); 1219 } 1220 1220 #endif 1221 1221 } … … 1256 1256 if (TEST_OPT_FINDET) 1257 1257 return; 1258 1258 1259 1259 /*- cuts elements in L above noether and reorders L -*/ 1260 1260 updateLHC(strat); … … 1377 1377 { 1378 1378 if(currRing->OrdSgn == -1) 1379 1380 else1381 1379 {strat->red = redRiloc;} 1380 else 1381 {strat->red2 = redRing;} 1382 1382 } 1383 1383 #endif … … 1453 1453 strat->HCord = 32000;/*- very large -*/ 1454 1454 } 1455 1455 1456 1456 #ifdef HAVE_RINGS 1457 1458 1457 if (rField_is_Ring(currRing)) 1458 strat->red = redRiloc; 1459 1459 #endif 1460 1460 … … 1587 1587 else strat->noClearS=TRUE; 1588 1588 } 1589 1589 1590 1590 #if ADIDEBUG 1591 1592 1593 1594 1595 1596 1597 1598 1599 PrintS("The pair list L -- in loop ");1600 1601 1602 1603 1604 PrintS("L[");printf("%d",iii);Print("]: ");1605 1606 PrintS("");p_Write(strat->L[iii].p1,strat->tailRing);1607 PrintS("");p_Write(strat->L[iii].p2,strat->tailRing);1608 PrintS("");p_Write(strat->L[iii].p,strat->tailRing);1609 1610 1611 1612 1613 1614 1591 #ifdef KDEBUG 1592 1593 PrintLn(); 1594 PrintS("-------------------------------- LOOP ");printf("%d",loop_count); 1595 PrintS(" ---------------------------------------"); 1596 PrintLn(); 1597 //print the list L: (p1,p2,p) 1598 PrintLn(); 1599 PrintS(" The pair list L -- in loop "); 1600 printf("%d",loop_count);PrintS(" -- is: "); PrintLn(); 1601 for(int iii=0;iii<=strat->Ll;iii++) 1602 { 1603 PrintLn(); 1604 PrintS(" L[");printf("%d",iii);Print("]: "); 1605 PrintLn(); 1606 PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing); 1607 PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing); 1608 PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing); 1609 } 1610 PrintLn(); 1611 #endif 1612 #endif 1613 1614 1615 1615 strat->P = strat->L[strat->Ll];/*- picks the last element from the lazyset L -*/ 1616 1616 if (strat->Ll==0) strat->interpt=TRUE; 1617 1617 strat->Ll--; 1618 1618 1619 #if ADIDEBUG 1620 #ifdef KDEBUG 1621 PrintS("My new pair P = (p1,p2,p) is: "); PrintLn();1622 PrintS("p1 = "); p_Write(strat->P.p1,strat->tailRing);PrintLn();1623 PrintS("p2 = "); p_Write(strat->P.p2,strat->tailRing);PrintLn();1624 PrintS("p = "); p_Write(strat->P.p,strat->tailRing); PrintLn();1625 1626 PrintS("The old reducer list T -- at the beg of loop ");1627 1628 1629 1630 1631 1632 { 1633 1634 PrintS("T[");printf("%d",iii);PrintS("]:");1635 1636 1637 1638 1639 #endif /* ADIDEBUG */ 1640 1619 #if ADIDEBUG 1620 #ifdef KDEBUG 1621 PrintS(" My new pair P = (p1,p2,p) is: "); PrintLn(); 1622 PrintS(" p1 = "); p_Write(strat->P.p1,strat->tailRing);PrintLn(); 1623 PrintS(" p2 = "); p_Write(strat->P.p2,strat->tailRing);PrintLn(); 1624 PrintS(" p = "); p_Write(strat->P.p,strat->tailRing); PrintLn(); 1625 PrintLn(); 1626 PrintS(" The old reducer list T -- at the beg of loop "); 1627 printf("%d",loop_count);PrintS(" -- is :"); 1628 if(strat->tl<0) 1629 {PrintS(" Empty.");PrintLn();} 1630 else 1631 for(int iii=0;iii<=strat->tl;iii++) 1632 { 1633 PrintLn(); 1634 PrintS(" T[");printf("%d",iii);PrintS("]:"); 1635 p_Write(strat->T[iii].p,strat->T->tailRing); 1636 } 1637 PrintLn(); 1638 1639 #endif /* ADIDEBUG */ 1640 #endif 1641 1641 1642 1642 // create the real Spoly … … 1707 1707 if (rField_is_Ring(currRing)) 1708 1708 { 1709 1710 1709 superenterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl); 1710 1711 1711 #if ADIDEBUG 1712 1712 PrintLn(); 1713 PrintS(" The new pair list L -- after superenterpairs in loop "); 1714 printf("%d",loop_count);PrintS(" -- is: "); PrintLn(); 1715 for(int iii=0;iii<=strat->Ll;iii++) 1716 { 1717 PrintLn(); 1718 PrintS(" L[");printf("%d",iii);PrintS("]:");PrintLn(); 1719 PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing); 1720 PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing); 1721 PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing); 1722 } 1723 #endif 1724 } 1725 1713 PrintS(" The new pair list L -- after superenterpairs in loop "); 1714 printf("%d",loop_count);PrintS(" -- is: "); PrintLn(); 1715 for(int iii=0;iii<=strat->Ll;iii++) 1716 { 1717 PrintLn(); 1718 PrintS(" L[");printf("%d",iii);PrintS("]:");PrintLn(); 1719 PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing); 1720 PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing); 1721 PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing); 1722 } 1723 #endif 1724 } 1726 1725 else 1727 1726 #endif … … 1733 1732 1734 1733 // apply hilbert criterion 1735 if (hilb!=NULL) 1736 1737 1738 1739 1740 1741 1734 if (hilb!=NULL) 1735 { 1736 if (strat->homog==isHomog) 1737 khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat); 1738 else 1739 khCheckLocInhom(Q,w,hilb,hilbcount,strat); 1740 } 1742 1741 1743 1742 // clear strat->P 1744 1743 if (strat->P.lcm!=NULL) 1745 1744 #if defined(HAVE_RINGS) || defined(HAVE_RINGS_LOC) 1746 1745 pLmDelete(strat->P.lcm); 1747 1746 #else 1748 1747 pLmFree(strat->P.lcm); … … 1772 1771 } 1773 1772 assume(kTest_TS(strat)); 1774 1775 1776 1777 PrintS("The new reducer list T -- at the end of loop ");1778 1779 1780 1781 1782 PrintS("T[");printf("%d",iii);PrintS("]:");1783 1784 1785 1786 1787 1788 #endif /* ADIDEBUG */ 1773 1774 #if ADIDEBUG 1775 PrintLn(); 1776 PrintS(" The new reducer list T -- at the end of loop "); 1777 printf("%d",loop_count);PrintS(" -- is "); PrintLn(); 1778 for(int iii=0;iii<=strat->tl;iii++) 1779 { 1780 PrintLn(); 1781 PrintS(" T[");printf("%d",iii);PrintS("]:"); 1782 p_Write(strat->T[iii].p,strat->tailRing); 1783 } 1784 PrintLn(); 1785 1786 loop_count++; 1787 #endif /* ADIDEBUG */ 1789 1788 } 1790 1789 /*- complete reduction of the standard basis------------------------ -*/ … … 1907 1906 } 1908 1907 #ifdef KDEBUG 1909 // 1908 // kDebugPrint(strat); 1910 1909 #endif 1911 1910 /*- compute------------------------------------------- -*/ … … 2216 2215 { 2217 2216 if(currRing->OrdSgn == -1) 2218 2219 2220 2217 r=mora(F,Q,NULL,hilb,strat); 2218 else 2219 r=bba(F,Q,NULL,hilb,strat); 2221 2220 } 2222 2221 else … … 2379 2378 r=sba(F,Q,*w,hilb,strat); 2380 2379 else 2381 2380 r=sba(F,Q,NULL,hilb,strat); 2382 2381 } 2383 2382 } … … 3119 3118 idDelete(&FF); 3120 3119 null=idInit(1,1); 3121 if (need_retry) 3122 res1=kNF(null,Q,res,0,KSTD_NF_LAZY); 3123 else 3124 res1=kNF(null,Q,res); 3120 if (need_retry) 3121 res1=kNF(null,Q,res,0,KSTD_NF_LAZY); 3122 else 3123 res1=kNF(null,Q,res); 3125 3124 idDelete(&res); 3126 3125 res=res1; -
kernel/kstd2.cc
r9d864a r601105 1504 1504 // in sba we have (until now) two possibilities: 1505 1505 // 1. an incremental computation w.r.t. (C,monomial order) 1506 // 2. a (possibly non-incremental) computation w.r.t. the 1506 // 2. a (possibly non-incremental) computation w.r.t. the 1507 1507 // induced Schreyer order. 1508 1508 // The corresponding orders are computed in sbaRing(), depending … … 1517 1517 ideal F = F0; 1518 1518 ring sRing, currRingOld; 1519 currRingOld = currRing; 1519 currRingOld = currRing; 1520 1520 if (strat->incremental) 1521 1521 { … … 1627 1627 // 1. interreduction of the current standard basis 1628 1628 // 2. generation of new principal syzygy rules for syzCriterion 1629 f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax, 1629 f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax, 1630 1630 lrmax, reduc, Q, w, hilb ); 1631 1631 #endif 1632 // initialize new syzygy rules for the next iteration step 1632 // initialize new syzygy rules for the next iteration step 1633 1633 initSyzRules(strat); 1634 1634 } … … 1757 1757 // get the polynomial (canonicalize bucket, make sure P.p is set) 1758 1758 strat->P.GetP(strat->lmBin); 1759 1760 // sig-safe computations may lead to wrong FDeg computation, thus we need 1759 1760 // sig-safe computations may lead to wrong FDeg computation, thus we need 1761 1761 // to recompute it to make sure everything is alright 1762 1762 (strat->P).FDeg = (strat->P).pFDeg(); … … 1870 1870 // add LM(F->m[i]) to the signature to get a Schreyer order 1871 1871 // without changing the underlying polynomial ring at all 1872 p_ExpVectorAdd (strat->syz[i],strat->S[ps],currRing); 1872 p_ExpVectorAdd (strat->syz[i],strat->S[ps],currRing); 1873 1873 // since p_Add_q() destroys all input 1874 // data we need to recreate help 1874 // data we need to recreate help 1875 1875 // each time 1876 1876 // ---------------------------------------------------------- 1877 // in the Schreyer order we always know that the multiplied 1877 // in the Schreyer order we always know that the multiplied 1878 1878 // module monomial strat->P.sig gives the leading monomial of 1879 1879 // the corresponding principal syzygy 1880 1880 // => we do not need to compute the "real" syzygy completely 1881 1881 poly help = pCopy(strat->sig[ps]); 1882 p_ExpVectorAdd (help,strat->P.p,currRing); 1882 p_ExpVectorAdd (help,strat->P.p,currRing); 1883 1883 strat->syz[i] = p_Add_q(strat->syz[i],help,currRing); 1884 1884 //printf("%d. SYZ ",i+1); … … 1889 1889 } 1890 1890 } 1891 1892 1891 enterT(strat->P, strat); 1892 strat->T[strat->tl].is_sigsafe = FALSE; 1893 1893 #ifdef HAVE_RINGS 1894 1894 if (rField_is_Ring(currRing)) … … 2239 2239 * 3. strat->S and strat->T are completely new computed in these steps 2240 2240 ********************************************************************/ 2241 void f5c (kStrategy strat, int& olddeg, int& minimcnt, int& hilbeledeg, 2241 void f5c (kStrategy strat, int& olddeg, int& minimcnt, int& hilbeledeg, 2242 2242 int& hilbcount, int& srmax, int& lrmax, int& reduc, ideal Q, 2243 2243 intvec *w,intvec *hilb ) … … 2266 2266 if (currRing->OrdSgn==-1) 2267 2267 { 2268 cancelunit(&h); 2268 cancelunit(&h); 2269 2269 deleteHC(&h, strat); 2270 2270 } … … 2494 2494 strat->sig[cc] = strat->T[cc].sig; 2495 2495 strat->sevSig[cc] = strat->T[cc].sevSig; 2496 strat->T[cc].is_sigsafe = TRUE; 2496 strat->T[cc].is_sigsafe = TRUE; 2497 2497 cc++; 2498 2498 } -
kernel/kutil.cc
r9d864a r601105 340 340 ring r = L->tailRing; 341 341 poly p = L->GetLmTailRing(); 342 342 343 343 #ifdef HAVE_RINGS 344 if (rField_is_Ring(currRing) && (currRing->OrdSgn == -1)) 345 lc = p_GetCoeff(p,r);346 #endif 344 if (rField_is_Ring(currRing) && (currRing->OrdSgn == -1)) 345 lc = p_GetCoeff(p,r); 346 #endif 347 347 348 348 #ifdef HAVE_RINGS_LOC … … 358 358 // } 359 359 h = pNext(p); 360 360 361 361 loop 362 362 { … … 366 366 if (!inNF) 367 367 { 368 369 370 371 372 373 374 375 368 number eins; 369 #ifdef HAVE_RINGS 370 if (rField_is_Ring(currRing) && (currRing->OrdSgn == -1)) 371 eins = nCopy(lc); 372 else 373 #endif 374 eins=nInit(1); 375 if (L->p != NULL) pSetCoeff(L->p,eins); 376 376 else if (L->t_p != NULL) nDelete(&pGetCoeff(L->t_p)); 377 377 if (L->t_p != NULL) pSetCoeff0(L->t_p,eins); … … 387 387 if (L->p != NULL && pNext(L->p) != NULL) 388 388 pNext(L->p) = NULL; 389 389 390 390 return; 391 391 } … … 398 398 ///should check also if the lc is a zero divisor, if it divides all the others 399 399 if (rField_is_Ring(currRing) && currRing->OrdSgn == -1) 400 401 400 if(n_DivBy(p_GetCoeff(h,r->cf),lc,r->cf) == 0) 401 return; 402 402 #endif 403 403 if (i == r->N) break; // does divide, try next monom … … 1167 1167 Lp.lcm = pInit(); 1168 1168 pSetCoeff0(Lp.lcm, n_Lcm(pGetCoeff(p), pGetCoeff(strat->S[i]), currRing->cf)); 1169 1169 1170 1170 #if ADIDEBUG 1171 1171 PrintS("\nLp.lcm (lc) = ");pWrite(Lp.lcm); 1172 1172 #endif 1173 1173 1174 1174 // Lp.lcm == 0 1175 1175 if (nIsZero(pGetCoeff(Lp.lcm))) … … 1192 1192 // basic product criterion 1193 1193 pLcm(p,strat->S[i],Lp.lcm); 1194 1194 1195 1195 #if ADIDEBUG 1196 1196 PrintS("\nLp.lcm (lcm) = ");pWrite(Lp.lcm); 1197 1197 #endif 1198 1198 1199 1199 pSetm(Lp.lcm); 1200 1200 assume(!strat->sugarCrit); … … 2772 2772 #if ADIDEBUG 2773 2773 PrintS("\n initenterpairs: \n"); 2774 PrintS(" 2775 PrintS(" 2774 PrintS(" ");p_Write(h, strat->tailRing); 2775 PrintS(" ");p_Write(strat->S[j],strat->tailRing); 2776 2776 #endif 2777 2777 strat->enterOnePair(j,h,ecart,isFromQ,strat, atR); … … 3453 3453 // if (((unsigned long) pGetCoeff(h) % (unsigned long) pGetCoeff(strat->S[j]) != 0) && 3454 3454 // ((unsigned long) pGetCoeff(strat->S[j]) % (unsigned long) pGetCoeff(h) != 0)) 3455 if (( iCompH == pGetComp(strat->S[j]))3455 if (((iCompH == pGetComp(strat->S[j])) 3456 3456 || (0 == pGetComp(strat->S[j]))) 3457 && ((iCompH<=strat->syzComp)||(strat->syzComp==0))) 3457 3458 { 3458 3459 enterOneStrongPoly(j,h,ecart,isFromQ,strat, atR); … … 3588 3589 void superenterpairs (poly h,int k,int ecart,int pos,kStrategy strat, int atR) 3589 3590 { 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 PrintS("enterExtendedSpoly has not changed the list L.");3604 3605 3606 3607 3608 3609 PrintS("enterExtendedSpoly changed the list L: ");3610 PrintLn();3611 3612 3613 3614 PrintS("L[");printf("%d",iii);PrintS("]:");PrintLn();3615 PrintS("");p_Write(strat->L[iii].p1,strat->tailRing);3616 PrintS("");p_Write(strat->L[iii].p2,strat->tailRing);3617 PrintS("");p_Write(strat->L[iii].p,strat->tailRing);3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 PrintS("initenterpairs has not changed the list L.");3628 3629 3630 3631 3632 3633 PrintS("initenterpairs changed the list L: ");3634 PrintLn();3635 3636 3637 3638 PrintS("L[");printf("%d",iii);PrintS("]:");PrintLn();3639 PrintS("");p_Write(strat->L[iii].p1,strat->tailRing);3640 PrintS("");p_Write(strat->L[iii].p2,strat->tailRing);3641 PrintS("");p_Write(strat->L[iii].p,strat->tailRing);3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 PrintS("initenterstrongPairs has not changed the list L.");3652 3653 3654 3655 3656 3657 PrintS("initenterstrongPairs changed the list L: ");3658 PrintLn();3659 3660 3661 3662 PrintS("L[");printf("%d",iii);PrintS("]:");PrintLn();3663 PrintS("");p_Write(strat->L[iii].p1,strat->tailRing);3664 PrintS("");p_Write(strat->L[iii].p2,strat->tailRing);3665 PrintS("");p_Write(strat->L[iii].p,strat->tailRing);3666 3667 3668 3669 3670 3671 3672 3591 #if ADIDEBUG 3592 PrintLn(); 3593 PrintS("Enter superenterpairs"); 3594 PrintLn(); 3595 int iii = strat->Ll; 3596 #endif 3597 assume (rField_is_Ring(currRing)); 3598 // enter also zero divisor * poly, if this is non zero and of smaller degree 3599 if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat); 3600 #if ADIDEBUG 3601 if(iii==strat->Ll) 3602 { 3603 PrintLn(); 3604 PrintS(" enterExtendedSpoly has not changed the list L."); 3605 PrintLn(); 3606 } 3607 else 3608 { 3609 PrintLn(); 3610 PrintS(" enterExtendedSpoly changed the list L: "); 3611 PrintLn(); 3612 for(iii=0;iii<=strat->Ll;iii++) 3613 { 3614 PrintLn(); 3615 PrintS(" L[");printf("%d",iii);PrintS("]:");PrintLn(); 3616 PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing); 3617 PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing); 3618 PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing); 3619 } 3620 } 3621 iii = strat->Ll; 3622 #endif 3623 initenterpairs(h, k, ecart, 0, strat, atR); 3624 #if ADIDEBUG 3625 if(iii==strat->Ll) 3626 { 3627 PrintLn(); 3628 PrintS(" initenterpairs has not changed the list L."); 3629 PrintLn(); 3630 } 3631 else 3632 { 3633 PrintLn(); 3634 PrintS(" initenterpairs changed the list L: "); 3635 PrintLn(); 3636 for(iii=0;iii<=strat->Ll;iii++) 3637 { 3638 PrintLn(); 3639 PrintS(" L[");printf("%d",iii);PrintS("]:");PrintLn(); 3640 PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing); 3641 PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing); 3642 PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing); 3643 } 3644 } 3645 iii = strat->Ll; 3646 #endif 3647 initenterstrongPairs(h, k, ecart, 0, strat, atR); 3648 #if ADIDEBUG 3649 if(iii==strat->Ll) 3650 { 3651 PrintLn(); 3652 PrintS(" initenterstrongPairs has not changed the list L."); 3653 PrintLn(); 3654 } 3655 else 3656 { 3657 PrintLn(); 3658 PrintS(" initenterstrongPairs changed the list L: "); 3659 PrintLn(); 3660 for(iii=0;iii<=strat->Ll;iii++) 3661 { 3662 PrintLn(); 3663 PrintS(" L[");printf("%d",iii);PrintS("]:");PrintLn(); 3664 PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing); 3665 PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing); 3666 PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing); 3667 } 3668 } 3669 PrintLn(); 3670 PrintS("End of superenterpairs"); 3671 PrintLn(); 3672 #endif 3673 clearSbatch(h, k, pos, strat); 3673 3674 } 3674 3675 #endif … … 5780 5781 if (currRing->OrdSgn==-1) 5781 5782 { 5782 5783 5784 5785 5786 5787 5788 5783 /*#ifdef HAVE_RINGS 5784 if (rField_is_Ring(currRing)) 5785 { 5786 h.pCleardenom(); 5787 } 5788 else 5789 #endif*/ 5789 5790 cancelunit(&h); /*- tries to cancel a unit -*/ 5790 5791 deleteHC(&h, strat); … … 7255 7256 { 7256 7257 7257 //if the ordering is local, then hilb criterion 7258 //if the ordering is local, then hilb criterion 7258 7259 //can be used also if tzhe ideal is not homogenous 7259 7260 if((currRing->OrdSgn == -1) && (currRing->MixedOrder == 0 )) … … 7261 7262 { 7262 7263 if(rField_is_Ring(currRing)) 7263 7264 *hilb=NULL; 7264 7265 else 7265 7266 return; 7266 7267 } 7267 7268 #endif … … 8023 8024 /* #ifdef HAVE_RINGS 8024 8025 if (!rField_is_Ring(currRing)) 8025 #endif */ 8026 #endif */ 8026 8027 for (i=1; i<=(currRing->N); i++) 8027 8028 { … … 8129 8130 strat->overflow=FALSE; 8130 8131 ring new_tailRing = rModifyRing(currRing, 8131 8132 8132 // Hmmm .. the condition pFDeg == p_Deg 8133 // might be too strong 8133 8134 #ifdef HAVE_RINGS 8134 (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // TODO Oliver 8135 8136 8135 (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // TODO Oliver 8137 8136 #else 8138 8139 #endif 8140 8141 8142 8143 if (new_tailRing == currRing) return TRUE;8137 (strat->homog && currRing->pFDeg == p_Deg), // omit_degree 8138 #endif 8139 (strat->ak==0), // omit_comp if the input is an ideal 8140 expbound); // exp_limit 8141 8142 if (new_tailRing == currRing) return TRUE; 8144 8143 8145 8144 strat->pOrigFDeg_TailRing = new_tailRing->pFDeg; … … 8716 8715 PrintS("ecartWeights: "); 8717 8716 for (int i = rVar(currRing); i > 0; i--) 8718 8717 Print("%hd ", ecartWeights[i]); 8719 8718 PrintLn(); 8720 8719 assume( TEST_OPT_WEIGHTM ); -
libpolys/coeffs/coeffs.h
r9d864a r601105 77 77 78 78 /// Creation data needed for finite fields 79 typedef struct 79 typedef struct 80 80 { 81 81 int GFChar; … … 123 123 // general stuff 124 124 numberfunc cfMult, cfSub ,cfAdd ,cfDiv, cfIntDiv, cfIntMod, cfExactDiv; 125 125 126 126 /// init with an integer 127 127 number (*cfInit)(long i,const coeffs r); … … 129 129 /// init with a GMP integer 130 130 number (*cfInitMPZ)(mpz_t i, const coeffs r); 131 131 132 132 /// how complicated, (0) => 0, or positive 133 133 int (*cfSize)(number n, const coeffs r); 134 134 135 135 /// convertion to int, 0 if impossible 136 136 int (*cfInt)(number &n, const coeffs r); … … 138 138 /// Converts a non-negative number n into a GMP number, 0 if impossible 139 139 void (*cfMPZ)(mpz_t result, number &n, const coeffs r); 140 140 141 141 /// changes argument inline: a:= -a 142 142 /// return -a! (no copy is returned) … … 152 152 /// print a given number (long format) 153 153 void (*cfWriteLong)(number &a, const coeffs r); 154 154 155 155 /// print a given number in a shorter way, if possible 156 156 /// e.g. in K(a): a2 instead of a^2 157 157 void (*cfWriteShort)(number &a, const coeffs r); 158 158 159 159 const char * (*cfRead)(const char * s, number * a, const coeffs r); 160 160 void (*cfNormalize)(number &a, const coeffs r); 161 161 162 162 #ifdef HAVE_RINGS 163 163 int (*cfDivComp)(number a,number b,const coeffs r); … … 167 167 #endif 168 168 169 169 170 170 BOOLEAN (*cfGreater)(number a,number b, const coeffs r), 171 171 /// tests … … 211 211 /// create i^th parameter or NULL if not possible 212 212 number (*cfParameter)(const int i, const coeffs r); 213 213 214 214 /// function pointer behind n_ClearContent 215 215 nCoeffsEnumeratorFunc cfClearContent; … … 230 230 231 231 /// the 0 as constant, NULL by default 232 number nNULL; 232 number nNULL; 233 233 int char_flag; 234 234 int ref; … … 302 302 303 303 // BOOLEAN CanShortOut; //< if the elements can be printed in short format 304 // 304 // // this is set to FALSE if a parameter name has >2 chars 305 305 // BOOLEAN ShortOut; //< if the elements should print in short format 306 306 … … 314 314 unsigned short *m_nfPlus1Table; 315 315 int *m_nfMinPoly; 316 316 317 317 // --------------------------------------------------- 318 318 // for Zp: … … 608 608 #endif 609 609 { 610 assume(r != NULL); 610 assume(r != NULL); 611 611 #ifdef LDEBUG 612 assume(r->cfDBTest != NULL); 612 assume(r->cfDBTest != NULL); 613 613 return r->cfDBTest(n, filename, linenumber, r); 614 614 #else … … 640 640 static inline BOOLEAN nCoeff_is_Domain(const coeffs r) 641 641 { 642 assume(r != NULL); 642 assume(r != NULL); 643 643 #ifdef HAVE_RINGS 644 644 return (getCoeffType(r)==n_Z || ((getCoeffType(r)!=n_Z2m) && (getCoeffType(r)!=n_Zn) && (getCoeffType(r)!=n_Znm))); … … 679 679 680 680 static inline int n_ParDeg(number n, const coeffs r) 681 { 682 assume(r != NULL); assume(r->cfParDeg != NULL); return r->cfParDeg(n,r); 681 { 682 assume(r != NULL); assume(r->cfParDeg != NULL); return r->cfParDeg(n,r); 683 683 } 684 684 … … 697 697 assume((iParameter >= 1) || (iParameter <= n_NumberOfParameters(r))); 698 698 assume(r->cfParameter != NULL); 699 return r->cfParameter(iParameter, r); 700 } 701 699 return r->cfParameter(iParameter, r); 700 } 702 701 703 702 static inline number n_Init_bigint(number i, const coeffs dummy, 704 705 { 706 assume(dummy != NULL && dst != NULL); assume(dst->cfInit_bigint!=NULL); 703 const coeffs dst) 704 { 705 assume(dummy != NULL && dst != NULL); assume(dst->cfInit_bigint!=NULL); 707 706 return dst->cfInit_bigint(i, dummy, dst); 708 707 } … … 710 709 static inline number n_RePart(number i, const coeffs cf) 711 710 { 712 assume(cf != NULL); assume(cf->cfRePart!=NULL); 711 assume(cf != NULL); assume(cf->cfRePart!=NULL); 713 712 return cf->cfRePart(i,cf); 714 713 } 715 714 static inline number n_ImPart(number i, const coeffs cf) 716 715 { 717 assume(cf != NULL); assume(cf->cfImPart!=NULL); 716 assume(cf != NULL); assume(cf->cfImPart!=NULL); 718 717 return cf->cfImPart(i,cf); 719 718 } -
libpolys/coeffs/modulop.cc
r9d864a r601105 35 35 { 36 36 assume( getCoeffType(r) == ID ); 37 37 38 38 #if SIZEOF_LONG == 4 39 39 #define ULONG64 (unsigned long long)(unsigned long) … … 41 41 #define ULONG64 (unsigned long) 42 42 #endif 43 return (number) 43 return (number) 44 44 (unsigned long)((ULONG64 a)*(ULONG64 b) % (ULONG64 r->ch)); 45 45 } … … 56 56 { 57 57 assume( n_Test(k, r) ); 58 58 59 59 int h = (int)((long) k); 60 60 return ((int)h !=0) && (h <= (r->ch>>1)); … … 78 78 number c = npMultM(a,b, r); 79 79 assume( n_Test(c, r) ); 80 return c; 80 return c; 81 81 } 82 82 … … 92 92 assume( n_Test(c, r) ); 93 93 return c; 94 94 95 95 } 96 96 … … 102 102 { 103 103 assume( n_Test(n, r) ); 104 104 105 105 if ((long)n > (((long)r->ch) >>1)) return (int)((long)n -((long)r->ch)); 106 106 else return (int)((long)n); … … 111 111 assume( n_Test(a, r) ); 112 112 assume( n_Test(b, r) ); 113 113 114 114 number c = npAddM(a,b, r); 115 115 116 116 assume( n_Test(c, r) ); 117 117 118 118 return c; 119 119 } … … 123 123 assume( n_Test(a, r) ); 124 124 assume( n_Test(b, r) ); 125 125 126 126 number c = npSubM(a,b,r); 127 127 … … 134 134 { 135 135 assume( n_Test(a, r) ); 136 136 137 137 return 0 == (long)a; 138 138 } … … 141 141 { 142 142 assume( n_Test(a, r) ); 143 143 144 144 return 1 == (long)a; 145 145 } … … 148 148 { 149 149 assume( n_Test(a, r) ); 150 150 151 151 return ((r->npPminus1M == (long)a)&&((long)1!=(long)a)); 152 152 } … … 231 231 return (number)0; 232 232 number d; 233 233 234 234 #ifndef HAVE_DIV_MOD 235 235 if ((long)b==0) … … 238 238 return (number)0; 239 239 } 240 240 241 241 int s = r->npLogTable[(long)a] - r->npLogTable[(long)b]; 242 242 if (s < 0) … … 250 250 assume( n_Test(d, r) ); 251 251 return d; 252 252 253 253 } 254 254 number npInvers (number c, const coeffs r) 255 255 { 256 256 assume( n_Test(c, r) ); 257 257 258 258 if ((long)c==0) 259 259 { … … 262 262 } 263 263 number d = npInversM(c,r); 264 264 265 265 assume( n_Test(d, r) ); 266 266 return d; 267 267 268 268 } 269 269 … … 271 271 { 272 272 assume( n_Test(c, r) ); 273 273 274 274 if ((long)c==0) return c; 275 275 276 #if 0 277 number d = npNegM(c,r); 276 #if 0 277 number d = npNegM(c,r); 278 278 assume( n_Test(d, r) ); 279 279 return d; 280 280 #else 281 c = npNegM(c,r); 281 c = npNegM(c,r); 282 282 assume( n_Test(c, r) ); 283 283 return c; 284 #endif 284 #endif 285 285 } 286 286 … … 298 298 assume( n_Test(a, r) ); 299 299 assume( n_Test(b, r) ); 300 300 301 301 // return (long)a == (long)b; 302 302 303 303 return npEqualM(a,b,r); 304 304 } … … 307 307 { 308 308 assume( n_Test(a, r) ); 309 309 310 310 if ((long)a>(((long)r->ch) >>1)) StringAppend("-%d",(int)(((long)r->ch)-((long)a))); 311 311 else StringAppend("%d",(int)((long)a)); … … 436 436 437 437 assume( c > 0 ); 438 438 439 439 int i, w; 440 440 … … 507 507 r->convFactoryNSingN=npConvFactoryNSingN; 508 508 #endif 509 509 510 510 // the variables: 511 511 r->nNULL = (number)0; … … 539 539 % r->ch); 540 540 r->npLogTable[r->npExpTable[i]] = i; 541 if /*(i == r->ch - 1 ) ||*/ (/*(*/ r->npExpTable[i] == 1 /*)*/) 541 if /*(i == r->ch - 1 ) ||*/ (/*(*/ r->npExpTable[i] == 1 /*)*/) 542 542 break; 543 543 } … … 757 757 #else 758 758 /// TODO: use "long InvMod(long a, const coeffs R)"?! 759 759 760 760 long s; 761 761 762 long u, u0, u1, u2, q, r; // v0, v1, v2, 762 long u, u0, u1, u2, q, r; // v0, v1, v2, 763 763 764 764 u1=1; // v1=0; -
libpolys/coeffs/modulop.h
r9d864a r601105 11 11 // defines are in struct.h 12 12 // define if a*b is with mod instead of tables 13 //#define HAVE_MULT_MOD 13 //#define HAVE_MULT_MOD 14 14 // define if a/b is with mod instead of tables 15 //#define HAVE_DIV_MOD 15 //#define HAVE_DIV_MOD 16 16 // define if an if should be used 17 17 //#define HAVE_GENERIC_ADD … … 71 71 // double ab; 72 72 // long q, res; 73 // 73 // 74 74 // ab = ((double) ((int)a)) * ((double) ((int)b)); 75 75 // q = (long) (ab/((double) npPrimeM)); // q could be off by (+/-) 1 … … 83 83 static inline number npMultM(number a, number b, const coeffs r) 84 84 { 85 return (number) 85 return (number) 86 86 ((((unsigned long) a)*((unsigned long) b)) % ((unsigned long) r->ch)); 87 87 }
Note: See TracChangeset
for help on using the changeset viewer.