Changeset a9c298 in git for kernel/f5gb.cc


Ignore:
Timestamp:
Nov 20, 2013, 4:54:25 PM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
0de0509972719531e2a4b51ec9fd0e44a66fd2fd
Parents:
e4014563a82388c4b39dfa37db24cbe159b24a35
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2013-11-20 16:54:25+01:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2013-11-20 16:54:42+01:00
Message:
format stuff
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/f5gb.cc

    re40145 ra9c298  
    4747/*
    4848====================================================================
    49 sorting ideals by decreasing total degree "left" and "right" are the 
     49sorting ideals by decreasing total degree "left" and "right" are the
    5050pointer of the first and last polynomial in the considered ideal
    5151====================================================================
     
    5959            while(pTotaldegree(*ptr1, currRing) < pTotaldegree(p2, currRing)) {
    6060                    ptr1++;
    61             } 
     61            }
    6262            while(pTotaldegree(*ptr2, currRing) > pTotaldegree(p2,currRing)) {
    6363                    ptr2--;
     
    111111                    return true;
    112112                }
    113             }   
     113            }
    114114        }
    115115    }
     
    119119/*
    120120==================================================
    121 computes incrementally gbs of subsets of the input 
     121computes incrementally gbs of subsets of the input
    122122gb{f_m} -> gb{f_m,f_(m-1)} -> gb{f_m,...,f_1}
    123123==================================================
    124124*/
    125125LList* F5inc(int i, poly f_i, LList* gPrev, LList* reducers, ideal gbPrev, poly ONE, LTagList* lTag, RList* rules, RTagList* rTag, int plus, int termination) {
    126     //Print("in f5inc\n");           
     126    //Print("in f5inc\n");
    127127    //pWrite(rules->getFirst()->getRuleTerm());
    128128    int iterationstep = i;
     
    140140    //Print("2nd gPrev: ");
    141141    //pWrite(gPrev->getFirst()->getNext()->getPoly());
    142     //pWrite(gPrev->getFirst()->getNext()->getPoly());   
     142    //pWrite(gPrev->getFirst()->getNext()->getPoly());
    143143    CListOld* critPairs        =   new CListOld();
    144     CNode* critPairsMinDeg  =   new CNode();   
     144    CNode* critPairsMinDeg  =   new CNode();
    145145    PList* rejectedGBList = new PList();
    146146    // computation of critical pairs with checking of criterion 1 and criterion 2 and saving them
     
    154154    static LList* reducedLPolys     =   new LList();
    155155    // while there are critical pairs to be further checked and deleted/computed
    156     while(NULL != critPairs->getFirst()) { 
     156    while(NULL != critPairs->getFirst()) {
    157157        // critPairs->getMinDeg() deletes the first elements of minimal degree from
    158158        // critPairs, thus the while loop is not infinite.
    159         // adds all to be reduced S-polynomials in the list sPolyList and adds 
     159        // adds all to be reduced S-polynomials in the list sPolyList and adds
    160160        // the corresponding rules to the list rules
    161         // NOTE: inside there is a second check of criterion 2 if new rules are 
     161        // NOTE: inside there is a second check of criterion 2 if new rules are
    162162        // added
    163163        //int timer4  =   initTimer();
     
    180180            //Print("number of useful pairs:  %d\n",numberUsefulPairs);
    181181            //Print("number of useless pairs: %d\n\n",numberUselessPairs);
    182           //Print("Degree of following reduction: %d\n",critPairsMinDeg->getData()->getDeg()); 
    183         long degreecheck = critPairsMinDeg->getData()->getDeg(); 
    184        
     182          //Print("Degree of following reduction: %d\n",critPairsMinDeg->getData()->getDeg());
     183        long degreecheck = critPairsMinDeg->getData()->getDeg();
     184
    185185          computeSPols(critPairsMinDeg,rTag,rules,sPolyList, rejectedGBList);
    186186        //}
     
    216216        //  return gPrev;
    217217        //}
    218         //Print("ARRIS DEG: %ld\n",arrideg); 
     218        //Print("ARRIS DEG: %ld\n",arrideg);
    219219        // Arris idea stated by John in an email
    220220        //if(arrisCheck(critPairs->getFirst(),gPrev->getFirst(),arrideg)) {
     
    222222        //  return gPrev;
    223223        //}
    224        
    225        
    226         //bool aha = checkDGB(gPrev); 
    227        
     224
     225
     226        //bool aha = checkDGB(gPrev);
     227
    228228
    229229        //timer3      =  getTimer();
    230230        //reductionTime = reductionTime + timer3;
    231         //Print("REDUCTION TIMER: %d\n",timer3); 
     231        //Print("REDUCTION TIMER: %d\n",timer3);
    232232        // DEBUG STUFF FOR GPREV
    233233        //temp    =   gPrev->getFirst();
     
    242242        //}
    243243        //sleep(5);
    244    
     244
    245245    }
    246246    //Print("REDUCTION DONE\n");
     
    333333            ppMult_qq(u2,temp2->getPoly()));
    334334        pNorm(sp);
    335      
     335
    336336        poly reducer  = pOne();
    337337        //reducer       = gb->m[0];
    338338        int i         = 0;
    339339        pWrite(pHead(sp));
    340        
     340
    341341        while(i<IDELEMS(gb)) {
    342342          reducer = gb->m[i];
     
    356356          }
    357357        }
    358        
     358
    359359        pWrite(pHead(sp));
    360360      }
     
    371371 * Checks all remaining critical pairs, i.e. those of higher degree,
    372372 * by the two Buchberger criteria.
    373  * return value: 0, if all remaining critical pairs are deleted by 
     373 * return value: 0, if all remaining critical pairs are deleted by
    374374 *                  Buchberger's criteria
    375375 *               1, otherwise
     
    377377bool arrisCheck(CNode* first, LNode* firstGCurr, long arrideg) {
    378378  CNode* temp = first;
    379  
     379
    380380  //product criterion check
    381381  while(NULL != temp) {
     
    422422}
    423423
    424  
    425  
     424
     425
    426426/*
    427427================================================================
    428428computes a list of critical pairs for the next reduction process
    429 the first element is always "useful" thus the critical pair 
    430 computed is either "useful" or "useless" depending on the second 
     429the first element is always "useful" thus the critical pair
     430computed is either "useful" or "useless" depending on the second
    431431element which generates the critical pair.
    432432first element in gPrev is always the newest element which must
     
    466466        u2 = pDivide(lcm,pHead(temp->getPoly()));
    467467        pSetCoeff(u2,nOne);
    468         int degree = pDeg(ppMult_qq(u2,pHead(temp->getPoly()))); 
     468        int degree = pDeg(ppMult_qq(u2,pHead(temp->getPoly())));
    469469        // testing both new labels by the F5 Criterion
    470470        if(!temp->getDel()) {
     
    473473          }
    474474          if(!criterion2(gPrev->getFirst()->getIndex(), u2, temp, rules, rTag)
    475             && !criterion2(gPrev->getFirst()->getIndex(), u1, newElement, rules, rTag) 
     475            && !criterion2(gPrev->getFirst()->getIndex(), u1, newElement, rules, rTag)
    476476            && !criterion1(gPrev,u1,newElement,lTag) && !criterion1(gPrev,u2,temp,lTag)) {
    477477              // if they pass the test, add them to CListOld critPairs, having the LPolyOld with greater
    478478              // label as first element in the CPairOld
    479               if(newElement->getIndex() == temp->getIndex() && 
     479              if(newElement->getIndex() == temp->getIndex() &&
    480480              -1 == pLmCmp(ppMult_qq(u1, newElement->getTerm()),ppMult_qq(u2, temp->getTerm()))) {
    481                   CPairOld* cp   =   new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2, 
    482                                   temp->getLPolyOld(), u1, newElement->getLPolyOld(), 0 , testedRuleOld);                   
     481                  CPairOld* cp   =   new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2,
     482                                  temp->getLPolyOld(), u1, newElement->getLPolyOld(), 0 , testedRuleOld);
    483483                  critPairs->insert(cp);
    484484                  // counting the number of useful pairs
     
    486486              }
    487487              else {
    488                   CPairOld* cp   =   new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1, 
    489                                   newElement->getLPolyOld(), u2, temp->getLPolyOld(), 0, testedRuleOld);                   
     488                  CPairOld* cp   =   new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1,
     489                                  newElement->getLPolyOld(), u2, temp->getLPolyOld(), 0, testedRuleOld);
    490490                  critPairs->insert(cp);
    491491                  // counting the number of useful pairs
     
    511511          //if(rejectedGBList->check(lcm)) { // if there is equality of lcms then we need the F5 critical pair
    512512            if(!criterion2(gPrev->getFirst()->getIndex(), u2, temp, rules, rTag)
    513               && !criterion2(gPrev->getFirst()->getIndex(), u1, newElement, rules, rTag) 
     513              && !criterion2(gPrev->getFirst()->getIndex(), u1, newElement, rules, rTag)
    514514              && !criterion1(gPrev,u1,newElement,lTag) && !criterion1(gPrev,u2,temp,lTag)) {
    515515                // if they pass the test, add them to CListOld critPairs, having the LPolyOld with greater
    516516                // label as first element in the CPairOld
    517                 if(newElement->getIndex() == temp->getIndex() && 
     517                if(newElement->getIndex() == temp->getIndex() &&
    518518                -1 == pLmCmp(ppMult_qq(u1, newElement->getTerm()),ppMult_qq(u2, temp->getTerm()))) {
    519                     CPairOld* cp   =   new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2, 
    520                                     temp->getLPolyOld(), u1, newElement->getLPolyOld(), 1 , testedRuleOld);                   
     519                    CPairOld* cp   =   new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2,
     520                                    temp->getLPolyOld(), u1, newElement->getLPolyOld(), 1 , testedRuleOld);
    521521                    critPairs->insert(cp);
    522522                    numberUselessPairs++;
    523523                }
    524524                else {
    525                     CPairOld* cp   =   new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1, 
    526                                     newElement->getLPolyOld(), u2, temp->getLPolyOld(), 1, testedRuleOld);                   
     525                    CPairOld* cp   =   new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1,
     526                                    newElement->getLPolyOld(), u2, temp->getLPolyOld(), 1, testedRuleOld);
    527527                    critPairs->insert(cp);
    528528                    numberUselessPairs++;
     
    540540================================================================
    541541computes a list of critical pairs for the next reduction process
    542 the first element is always "useless" thus the critical pair 
     542the first element is always "useless" thus the critical pair
    543543computed is "useless".
    544544first element in gPrev is always the newest element which must
     
    577577        //if(rejectedGBList->check(lcm)) { // if there is equality of lcms then we need the F5 critical pair
    578578          if(!criterion2(gPrev->getFirst()->getIndex(), u2, temp, rules, rTag)
    579             && !criterion2(gPrev->getFirst()->getIndex(), u1, newElement, rules, rTag) 
     579            && !criterion2(gPrev->getFirst()->getIndex(), u1, newElement, rules, rTag)
    580580            && !criterion1(gPrev,u1,newElement,lTag) && !criterion1(gPrev,u2,temp,lTag)) {
    581581              // if they pass the test, add them to CListOld critPairs, having the LPolyOld with greater
    582582              // label as first element in the CPairOld
    583               if(newElement->getIndex() == temp->getIndex() && 
     583              if(newElement->getIndex() == temp->getIndex() &&
    584584              -1 == pLmCmp(ppMult_qq(u1, newElement->getTerm()),ppMult_qq(u2, temp->getTerm()))) {
    585                   CPairOld* cp   =   new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2, 
    586                                   temp->getLPolyOld(), u1, newElement->getLPolyOld(), 1 , testedRuleOld);                   
     585                  CPairOld* cp   =   new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2,
     586                                  temp->getLPolyOld(), u1, newElement->getLPolyOld(), 1 , testedRuleOld);
    587587                  critPairs->insert(cp);
    588588                  numberUselessPairs++;
    589589              }
    590590              else {
    591                   CPairOld* cp   =   new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1, 
    592                                   newElement->getLPolyOld(), u2, temp->getLPolyOld(), 1, testedRuleOld);                   
     591                  CPairOld* cp   =   new CPairOld(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1,
     592                                  newElement->getLPolyOld(), u2, temp->getLPolyOld(), 1, testedRuleOld);
    593593                  critPairs->insert(cp);
    594594                  numberUselessPairs++;
    595595              }
    596596          }
    597         //} 
     597        //}
    598598        temp    =   temp->getNext();
    599599    }
     
    609609inline bool criterion1(LList* gPrev, poly t, LNode* l, LTagList* lTag) {
    610610    // starts at the first element in gPrev with index = (index of l)-1, these tags are saved in lTag
    611         int idx =   l->getIndex();
     611    int idx =   l->getIndex();
    612612    int i;
    613613    if(idx == 1) {
     
    670670inline bool criterion2(int idx, poly t, LNode* l, RList* rules, RTagList* rTag) {
    671671    //Print("------------------------------IN CRITERION 2/1-----------------------------------------\n");
    672     /* 
     672    /*
    673673    Print("RULES: \n");
    674674        RNode* tempR    =   rules->getFirst();
     
    694694        return false;
    695695    }
    696    
     696
    697697    RNode* testNode; // =   new RNode();
    698698    testNode    =   rules->getFirst();
     
    706706        }
    707707    }
    708    
     708
    709709     else {
    710710
     
    713713        }
    714714        else {
    715        //Print("HIER\n"); 
     715       //Print("HIER\n");
    716716            //Print("DEBUG\n");
    717717        //Print("L INDEX: %d\n",l->getIndex());
     
    731731    */
    732732    //testNode    =   rules->getFirst();
    733         // save the monom t1*label_term(l) as it is tested various times in the following
     733    // save the monom t1*label_term(l) as it is tested various times in the following
    734734    poly u1 = ppMult_qq(t,l->getTerm());
    735735    // first element added to rTag was NULL, check for this
     
    738738    //Print("TESTNODE: %p\n",testNode);
    739739    //pWrite(testNode->getRuleTerm());
    740     if(NULL != testNode ) {   
     740    if(NULL != testNode ) {
    741741        //pWrite(testNode->getRuleTerm());
    742742    }
     
    750750        }
    751751    }
    752     while(NULL != testNode && testNode->getRuleOld() != l->getRuleOld() 
     752    while(NULL != testNode && testNode->getRuleOld() != l->getRuleOld()
    753753          && l->getIndex() == testNode->getRuleOldIndex()) {
    754754        //Print("%p\n",testNode);
     
    765765            return true;
    766766        }
    767                 testNode    =   testNode->getNext();
     767        testNode    =   testNode->getNext();
    768768    }
    769769    //delete testNode;
     
    798798    */
    799799// start at the previously added element to gPrev, as all other elements will have the same index for sure
    800         RNode* testNode =   rules->getFirst();
     800        RNode* testNode =   rules->getFirst();
    801801    // save the monom t1*label_term(l) as it is tested various times in the following
    802802    poly u1 = ppMult_qq(t,l->getTerm());
    803         // first element added to rTag was NULL, check for this
    804         while(NULL != testNode && testNode->getRuleOld() != testedRuleOld) {
     803        // first element added to rTag was NULL, check for this
     804        while(NULL != testNode && testNode->getRuleOld() != testedRuleOld) {
    805805        //pWrite(testNode->getRuleTerm());
    806806        if(pLmDivisibleByNoComp(testNode->getRuleOldTerm(),u1)) {
     
    811811            return true;
    812812        }
    813                 testNode    =   testNode->getNext();
     813                testNode    =   testNode->getNext();
    814814    }
    815815    pDelete(&u1);
     
    837837==================================
    838838*/
    839 void computeSPols(CNode* first, RTagList* rTag, RList* rules, LList* sPolyList, PList* rejectedGBList) { 
     839void computeSPols(CNode* first, RTagList* rTag, RList* rules, LList* sPolyList, PList* rejectedGBList) {
    840840    CNode* temp         =   first;
    841841    //Print("\nDegree:  %d\n",temp->getData()->getDeg());
     
    850850    CListOld* f5pairs = new CListOld();
    851851    poly sp     =   pInit();
    852     number sign =   nInit(-1);   
     852    number sign =   nInit(-1);
    853853    //Print("###############################IN SPOLS##############################\n");
    854854    //first->print();
     
    898898            }
    899899            rejectedGBList->insert(pHead(ppMult_qq(temp->getT1(),temp->getLp1Poly())));
    900             //Print("rejected!\n"); 
     900            //Print("rejected!\n");
    901901
    902902            //Print("CRITERION 2 in SPOLS 2nd generator\n");
    903903          }
    904904        }
    905         else { 
     905        else {
    906906          sp      =   ksOldSpolyRedNew(ppMult_qq(temp->getT1(),temp->getLp1Poly()),
    907907              ppMult_qq(temp->getT2(),temp->getLp2Poly()));
     
    925925        }
    926926      }
    927       /*     
     927      /*
    928928      if(temp->getDel() == 0 && criterion2(temp->getT1(),temp->getAdLp1(),rules,temp->getTestedRuleOld())) {
    929         //Print("rejected!\n"); 
     929        //Print("rejected!\n");
    930930        rejectedGBList->insert(pHead(ppMult_qq(temp->getT1(),temp->getLp1Poly())));
    931931      }
    932      
    933        
     932
     933
    934934      if(temp->getDel() == 1 && !criterion2(temp->getT1(),temp->getAdLp1(),rules,temp->getTestedRuleOld())) {
    935         if(highestDegree < pDeg(ppMult_qq(temp->getT1(),temp->getLp1Poly()))) { 
     935        if(highestDegree < pDeg(ppMult_qq(temp->getT1(),temp->getLp1Poly()))) {
    936936          highestDegree   = pDeg(ppMult_qq(temp->getT1(),temp->getLp1Poly()));
    937         }   
     937        }
    938938        if(temp->getLp2Index() == temp->getLp1Index()) {
    939939          if(!criterion2(temp->getT2(),temp->getAdLp2(),rules,temp->getTestedRuleOld())) {
     
    956956
    957957              f5rules->insert(rules->getFirst()->getRuleOld());
    958               f5pairs->insertWithoutSort(temp->getData());       
     958              f5pairs->insertWithoutSort(temp->getData());
    959959              ///////////////////////////////////////
    960960
     
    963963          }
    964964        }
    965         else { 
     965        else {
    966966          sp      =   ksOldSpolyRedNew(ppMult_qq(temp->getT1(),temp->getLp1Poly()),
    967967              ppMult_qq(temp->getT2(),temp->getLp2Poly()));
     
    983983
    984984            f5rules->insert(rules->getFirst()->getRuleOld());
    985             f5pairs->insertWithoutSort(temp->getData());       
     985            f5pairs->insertWithoutSort(temp->getData());
    986986            ///////////////////////////////////////
    987987            //sPolyList->insertByLabel(ppMult_qq(temp->getT1(),temp->getLp1Term()),temp->getLp1Index(),sp,rules->getFirst()->getRuleOld());
     
    10041004
    10051005      }
    1006      
    1007       /* 
     1006
     1007      /*
    10081008      temp = f5pairs->getFirst();
    10091009      RNode* tempRule = f5rules->getFirst();
     
    10261026          numberRejectedF5CriticalPairs++;
    10271027              howmany++;
    1028           if(numberRejectedF5CriticalPairs < -1) { // || 
     1028          if(numberRejectedF5CriticalPairs < -1) { // ||
    10291029          }
    10301030          else {
     
    10501050            //if(temp->getLp1Index() < 7) {
    10511051              sPolyList->insertByLabel(ppMult_qq(temp->getT1(),temp->getLp1Term()),temp->getLp1Index(),sp,tempRule->getRuleOld());
    1052            
     1052
    10531053            //}
    10541054          //numberOfSpolys++;
    10551055          }
    1056         //pSetExp(tempRule->getRuleOld()->getTerm(),1,1000); 
     1056        //pSetExp(tempRule->getRuleOld()->getTerm(),1,1000);
    10571057        }
    10581058        temp      = temp->getNext();
     
    10601060
    10611061      }
    1062       */ 
    1063       // these critical pairs can be deleted now as they are either useless for further computations or 
     1062      */
     1063      // these critical pairs can be deleted now as they are either useless for further computations or
    10641064      // already saved as an S-polynomial to be reduced in the following
    1065       delete first;   
     1065      delete first;
    10661066//Print("NUMBER SPOLYS: %d\n", numberOfSpolys);
    10671067//Print("SPOLY LIST: \n");
     
    10821082========================================================================
    10831083*/
    1084 void reduction(LList* sPolyList, CListOld* critPairs, LList* gPrev, RList* rules, LTagList* lTag, RTagList* rTag, 
    1085                  ideal gbPrev, PList* rejectedGBList, int plus) { 
     1084void reduction(LList* sPolyList, CListOld* critPairs, LList* gPrev, RList* rules, LTagList* lTag, RTagList* rTag,
     1085                 ideal gbPrev, PList* rejectedGBList, int plus) {
    10861086    //Print("##########################################In REDUCTION!########################################\n");
    10871087    // check if sPolyList has any elements
     
    10901090    while(NULL != temp) {
    10911091        // temp is the first element in the sPolyList which should be reduced
    1092         // due to earlier sorting this is the element of minimal degree AND 
     1092        // due to earlier sorting this is the element of minimal degree AND
    10931093        // minimal label
    10941094        // delete the above first element from sPolyList, temp will be either reduced to
     
    11031103            temp->setPoly(tempNF);
    11041104            // try further reductions of temp with polynomials in gPrev
    1105             // with label index = current label index: this is done such that there 
     1105            // with label index = current label index: this is done such that there
    11061106            // is no label corruption during the reduction process
    11071107            //Print("lower label reduction:  ");
    11081108            //pWrite(tempNF);
    11091109            topReduction(temp,sPolyList,gPrev,critPairs,rules,lTag,rTag,gbPrev, rejectedGBList,plus);
    1110        
     1110
    11111111        }
    11121112        else {
     
    11211121    //sPolyList->print();
    11221122    //delete sPolyList;
    1123 }   
     1123}
    11241124
    11251125/*
     
    11281128========================================================================
    11291129*/
    1130 void newReduction(LList* sPolyList, CListOld* critPairs, LList* gPrev, LList* reducers, RList* rules, LTagList* lTag, RTagList* rTag, 
    1131                  ideal gbPrev, int termination, PList* rejectedGBList, int plus) { 
     1130void newReduction(LList* sPolyList, CListOld* critPairs, LList* gPrev, LList* reducers, RList* rules, LTagList* lTag, RTagList* rTag,
     1131                 ideal gbPrev, int termination, PList* rejectedGBList, int plus) {
    11321132    //Print("##########################################In REDUCTION!########################################\n");
    11331133    // check if sPolyList has any elements
     
    11391139        numberOfReductions++;
    11401140        // temp is the first element in the sPolyList which should be reduced
    1141         // due to earlier sorting this is the element of minimal degree AND 
     1141        // due to earlier sorting this is the element of minimal degree AND
    11421142        // minimal label
    11431143        // delete the above first element from sPolyList, temp will be either reduced to
     
    11591159            //pWrite(tempNF);
    11601160            // try further reductions of temp with polynomials in gPrev
    1161             // with label index = current label index: this is done such that there 
     1161            // with label index = current label index: this is done such that there
    11621162            // is no label corruption during the reduction process
    1163             findReducers(temp,sPolyList,gbPrev,gPrev,reducers,critPairs,rules,lTag,rTag, termination, rejectedGBList,plus); 
     1163            findReducers(temp,sPolyList,gbPrev,gPrev,reducers,critPairs,rules,lTag,rTag, termination, rejectedGBList,plus);
    11641164        //}
    11651165        //else {
     
    11801180    //delete sPolyList;
    11811181    //Print("REDUCTION FERTIG\n");
    1182 }     
     1182}
    11831183
    11841184
    11851185/*!
    11861186 * ================================================================================
    1187  * searches for reducers of temp similar to the symbolic preprocessing of F4  and 
     1187 * searches for reducers of temp similar to the symbolic preprocessing of F4  and
    11881188 * divides them into a "good" and "bad" part:
    1189  * 
     1189 *
    11901190 * the "good" ones are the reducers which do not corrupt the label of temp, with
    11911191 * these the normal form of temp is computed
    11921192 *
    1193  * the "bad" ones are the reducers which corrupt the label of temp, they are tested 
     1193 * the "bad" ones are the reducers which corrupt the label of temp, they are tested
    11941194 * later on for possible new rules and S-polynomials to be added to the algorithm
    11951195 * ================================================================================
     
    12591259                                        break;
    12601260                                    }
    1261                              }   
    1262                    
     1261                             }
     1262
    12631263                    }
    12641264                    else {
     
    12671267                                      //pWrite(u);
    12681268                                      //pWrite(tempRed->getTerm());
    1269                                       //pWrite(pHead(tempRed->getPoly())); 
     1269                                      //pWrite(pHead(tempRed->getPoly()));
    12701270                                      addToG  = 0;
    12711271                        }
     
    13121312                                        }
    13131313                                    }
    1314                                 }   
     1314                                }
    13151315                            }
    13161316                            else {
    13171317                              //Print("CRIT 1  ");
    1318                                    
     1318
    13191319                                      if(pLmCmp(ppMult_qq(u,tempRed->getTerm()),l->getTerm()) == 1 ) {
    13201320                                      //Print("NOT ALLOWED REDUCER, CRIT 1:\n");
     
    13691369                            break;
    13701370                        }
    1371                      
     1371
    13721372                    }
    13731373                }
     
    13811381                //Print("TEMPREDPOLY:  ");
    13821382                //pWrite(tempRed->getPoly());
    1383               //pWrite(tempPoly); 
     1383              //pWrite(tempPoly);
    13841384              if(pLmDivisibleByNoComp(tempRed->getPoly(),tempPoly)) {
    13851385                    //Print("A\n");
     
    14121412                                        break;
    14131413                                    }
    1414                              }   
    1415                    
     1414                             }
     1415
    14161416                    }
    14171417                    else {
     
    14201420                                      //pWrite(u);
    14211421                                      //pWrite(tempRed->getTerm());
    1422                                       //pWrite(pHead(tempRed->getPoly())); 
     1422                                      //pWrite(pHead(tempRed->getPoly()));
    14231423                                      //addToG  = 0;
    14241424                        }
     
    14651465                                        }
    14661466                                    }
    1467                                 }   
     1467                                }
    14681468                            }
    14691469                            else {
    14701470                              //Print("CRIT 1  ");
    1471                                    
     1471
    14721472                                      if(pLmCmp(ppMult_qq(u,tempRed->getTerm()),l->getTerm()) == 1 ) {
    14731473                                      //Print("NOT ALLOWED REDUCER, CRIT 1:\n");
     
    14981498                        }
    14991499                    }
    1500                    
     1500
    15011501                }
    15021502                tempRed =   tempRed->getNext();
     
    15151515               // end for top-reduction only
    15161516               tempPoly    =   kBucketGetLm(bucket);
    1517                
     1517
    15181518            }
    15191519        }
     
    15251525            Print("\nELEMENT ADDED TO GPREV: ");
    15261526            pNorm(redPoly);
    1527               if(highestDegree < pDeg(redPoly)) { 
     1527              if(highestDegree < pDeg(redPoly)) {
    15281528                  highestDegree   = pDeg(redPoly);
    1529               }   
     1529              }
    15301530            pWrite(pHead(redPoly));
    15311531            //pWrite(l->getTerm());
     
    15671567            }
    15681568        }
    1569    
     1569
    15701570    // if there are "bad" reducers than try to compute new S-polynomials and rules
    1571    
     1571
    15721572    if(NULL != bad->getFirst()) {
    15731573        //Print("BAD STUFF LIST:\n");
     
    16081608                                //tempRed->getLPoly()->setRule(rules->getFirst()->getRule());
    16091609                                tempBadNew->setDel(1);
    1610                            
     1610
    16111611                                sPolyList->insertByLabel(tempBadNew);
    16121612                                //Print("BAD SPOLYLIST: \n");
     
    16251625        //Print("HIER AUCH\n");
    16261626        //Print("SPOLYLIST IN BAD: \n");
    1627         //sPolyList->print(); 
     1627        //sPolyList->print();
    16281628    //Print("END FIND REDUCERS\n");
    16291629}
     
    17131713            // if label of reductor is greater than the label of l we have to built a new element
    17141714            // and add it to sPolyList
    1715            
     1715
    17161716            if(pLmCmp(tempRed->getTerm(),l->getTerm()) == 1) {
    17171717                // needed sinc pSub destroys the arguments!
     
    17431743                }
    17441744            }
    1745            
    1746             // label of reductor is smaller than the label of l, subtract reductor from l and delete the 
    1747             // gPrevRedCheck pointer added to l during findReductor() as the head term of l changes 
    1748             // after subtraction 
     1745
     1746            // label of reductor is smaller than the label of l, subtract reductor from l and delete the
     1747            // gPrevRedCheck pointer added to l during findReductor() as the head term of l changes
     1748            // after subtraction
    17491749            else {
    1750                
     1750
    17511751                //poly temp_poly_l    =   pInit();
    17521752                //temp_poly_l         =   pCopy(l->getPoly());
     
    17601760                    pNorm(temp);
    17611761                    //pWrite(temp);
    1762                     poly tempNF =   kNF(gbPrev,currQuotient,temp); 
     1762                    poly tempNF =   kNF(gbPrev,currQuotient,temp);
    17631763                    pNorm(tempNF);
    17641764                    if(NULL == tempNF) {
     
    17691769                    }
    17701770                    l->setPoly(tempNF);
    1771                    
     1771
    17721772                    gPrevRedCheck   =   lTag->getFirstCurrentIdx();
    17731773                }
     
    17781778                    break;
    17791779                }
    1780             }   
     1780            }
    17811781        }
    17821782        else {
     
    18161816    poly t      =   pHead(l->getPoly());
    18171817    // if l was already checked use the information in gPrevRedCheck such
    1818     // that we can start searching for new reducers from this point and 
     1818    // that we can start searching for new reducers from this point and
    18191819    // not from the first element of gPrev with the current index
    18201820    temp    =   gPrevRedCheck;
     
    18671867        temp = temp->getNext();
    18681868    }
    1869    
     1869
    18701870//    delete temp;
    18711871 return NULL;
     
    18811881*/
    18821882ideal F5main(ideal id, ring r, int opt, int plus, int termination) {
    1883   switch(opt) { 
     1883  switch(opt) {
    18841884    case 0:
    18851885      Print("\nComputations are done by the standard F5 Algorithm");
     
    18951895      return id;
    18961896  }
    1897  
     1897
    18981898    int timer   =   initTimer();
    18991899    startTimer();
     
    19041904    poly pOne   =   pOne();
    19051905    number nOne =   nInit(1);
    1906     // tag the first element of index i-1 for criterion 1 
     1906    // tag the first element of index i-1 for criterion 1
    19071907    //Print("LTAG BEGINNING: %p\n",lTag);
    1908    
     1908
    19091909    // DEBUGGING STUFF START
    19101910    //Print("NUMBER: %d\n",r->N);
    1911     /* 
     1911    /*
    19121912    int* ev = new int[r->N +1];
    19131913    for(i=0;i<IDELEMS(id);i++) {
     
    19231923    */
    19241924    /*DEBUGGING STUFF END */
    1925    
    1926     // first element in rTag is first element of rules which is NULL RNode, 
     1925
     1926    // first element in rTag is first element of rules which is NULL RNode,
    19271927    // this must be done due to possible later improvements
    19281928    RList* rules    =   new RList();
     
    19331933    i = 1;
    19341934    /*for(j=0; j<IDELEMS(id); j++) {
    1935         if(NULL != id->m[j]) { 
     1935        if(NULL != id->m[j]) {
    19361936            if(pComparePolys(id->m[j],ONE)) {
    19371937                Print("One Polynomial in Input => Computations stopped\n");
     
    19391939                idNew->m[0] = ONE;
    19401940                return(idNew);
    1941             }   
    1942         }
    1943     }*/ 
    1944     ideal idNew     =   kInterRed(id); 
     1941            }
     1942        }
     1943    }*/
     1944    ideal idNew     =   kInterRed(id);
    19451945    id              =   idNew;
    19461946    //qsortDegree(&id->m[0],&id->m[IDELEMS(id)-1]);
     
    19481948    LList* gPrev    =   new LList(ONE, i, id->m[0]);
    19491949    LList* reducers =   new LList();
    1950     //idShow(id); 
     1950    //idShow(id);
    19511951    //Print("%p\n",id->m[0]);
    19521952    //pWrite(id->m[0]);
     
    19681968        LNode* gPrevTag =   gPrev->getLast();
    19691969        //Print("Last POlynomial in GPREV: ");
    1970         //Print("%p\n",gPrevTag);   
     1970        //Print("%p\n",gPrevTag);
    19711971        //pWrite(gPrevTag->getPoly());
    19721972        Print("Iteration: %d\n\n",i);
     
    19751975        //Print("%d\n",gPrev->getLength());
    19761976        //Print("____________________________________ITERATION STEP DONE________________________________________\n");
    1977        
     1977
    19781978        // DEBUGGING STUFF
    19791979        LNode* temp    =   gPrev->getFirst();
    1980    
     1980
    19811981
    19821982        /////////////////////////////////////////////////////////////////////////////////
    1983         //                                                                             // 
     1983        //                                                                             //
    19841984        // one needs to choose one of the following 3 implementations of the algorithm //
    1985         // F5,F5R or F5C                                                               // 
     1985        // F5,F5R or F5C                                                               //
    19861986        //                                                                             //
    1987         /////////////////////////////////////////////////////////////////////////////////                                                                           
    1988        
    1989        
    1990         //   
     1987        /////////////////////////////////////////////////////////////////////////////////
     1988
     1989
     1990        //
    19911991        // standard "F5"
    19921992        //
    1993         if(0 == opt) { 
     1993        if(0 == opt) {
    19941994          if(gPrev->getLength() > gbLength) {
    19951995            if(i < IDELEMS(id)) {
     
    20222022        gbLength    =   gPrev->getLength();
    20232023        }
    2024        
    2025 
    2026         // 
     2024
     2025
     2026        //
    20272027        //  "F5R"
    20282028        //
     
    20602060        gbLength    =   gPrev->getLength();
    20612061        }
    2062        
    2063 
    2064         // 
     2062
     2063
     2064        //
    20652065        // "F5C"
    20662066        //
    2067         if(2 == opt) { 
     2067        if(2 == opt) {
    20682068        if(gPrev->getLength() > gbLength) {
    20692069            if(i < IDELEMS(id)) {
     
    21032103                }
    21042104            }
    2105             gbLength    =   gPrev->getLength(); 
    2106         } 
     2105            gbLength    =   gPrev->getLength();
     2106        }
    21072107        }
    21082108
     
    21122112    //Print("\n\nADDING TIME IN REDUCTION: %d\n\n",reductionTime);
    21132113    Print("\n\nNumber of zero-reductions:           %d\n",reductionsToZero);
    2114     Print("Number of rules:                     %d\n",numberOfRules); 
    2115     Print("Number of rejected F5-critical pairs:%d\n",numberRejectedF5CriticalPairs); 
    2116     Print("Number of reductions:                %d\n",numberOfReductions); 
    2117     Print("Elements not added to G:             %d\n",notInG); 
     2114    Print("Number of rules:                     %d\n",numberOfRules);
     2115    Print("Number of rejected F5-critical pairs:%d\n",numberRejectedF5CriticalPairs);
     2116    Print("Number of reductions:                %d\n",numberOfReductions);
     2117    Print("Elements not added to G:             %d\n",notInG);
    21182118    Print("Highest Degree during computations:  %d\n",highestDegree);
    21192119    Print("Degree d_0 in F5+:                   %d\n",highestDegreeGBCriticalPair);
     
    21342134    highestDegree                 =   0;
    21352135    highestDegreeGBCriticalPair   =   0;
    2136     reductionTime                 =   0; 
     2136    reductionTime                 =   0;
    21372137    spolsTime                     =   0;
    21382138    numberUselessPairs            =   0;
Note: See TracChangeset for help on using the changeset viewer.