Changeset c9193a in git


Ignore:
Timestamp:
Feb 28, 2009, 10:14:06 PM (14 years ago)
Author:
Christian Eder
Branches:
(u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
Children:
5887d78d81d30fb2177cf296ce90d01565c6ae3b
Parents:
1863d8a8be27be6f1d1a24187172fe5ab71c385f
Message:
fixed bug: zero reduction after top reduction


git-svn-id: file:///usr/local/Singular/svn/trunk@11501 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/f5gb.cc

    r1863d8 rc9193a  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5gb.cc,v 1.35 2009-02-27 22:22:30 ederc Exp $ */
     4/* $Id: f5gb.cc,v 1.36 2009-02-28 21:14:06 ederc Exp $ */
    55/*
    66* ABSTRACT: f5gb interface
     
    194194        //}
    195195        // testing both new labels by the F5 Criterion
     196        if(!criterion1(gPrev,u1,newElement,lTag) && !criterion1(gPrev,u2,temp,lTag)) {
     197        //&& !criterion2(u1, newElement, rules, rTag) && !criterion2(u2, temp, rules, rTag)) {
     198            // if they pass the test, add them to CList critPairs, having the LPoly with greater
     199            // label as first element in the CPair
     200            if(newElement->getIndex() == temp->getIndex() &&
     201            -1 == pLmCmp(ppMult_qq(u1, newElement->getTerm()),ppMult_qq(u2, temp->getTerm()))) {
     202                //Print("zweites groesser\n");
     203                CPair* cp   =   new CPair(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2,
     204                                temp->getLPoly(), u1, newElement->getLPoly(), testedRule);                   
     205                critPairs->insert(cp);
     206            }
     207            else {
     208                //Print("erstes groesser\n");
     209                CPair* cp   =   new CPair(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1,
     210                                newElement->getLPoly(), u2, temp->getLPoly(), testedRule);                   
     211                critPairs->insert(cp);
     212            }
     213        }
     214        else {
     215        }
     216       
     217        //Print("\n\n");
     218        temp    =   temp->getNext();
     219    }
     220    // for debugging
     221    //if(NULL != critPairs) {
     222        //critPairs->print();
     223        //sleep(5);
     224    //}
     225}
     226
     227
     228
     229
     230/*
     231================================================================
     232computes a list of critical pairs for the next reduction process
     233first element in gPrev is always the newest element which must
     234build critical pairs with all other elements in gPrev
     235this is a special version for reduction() in which the first
     236generator of the critical pair is not tested by criterion2()
     237as there are no rules added until then to test for
     238================================================================
     239*/
     240void criticalPairRed(LList* gPrev, CList* critPairs, LTagList* lTag, RTagList* rTag, RList* rules) {
     241    // initialization for usage in pLcm()
     242    number nOne         =   nInit(1);
     243    LNode* newElement   =   gPrev->getLast();
     244    LNode* temp         =   gPrev->getFirst();
     245    poly u1             =   pOne();
     246    poly u2             =   pOne();
     247    poly lcm            =   pOne();
     248    poly t              =   pHead(newElement->getPoly());
     249    Rule* testedRule    =   rules->getFirst()->getRule();
     250    // computation of critical pairs
     251    while( gPrev->getLast() != temp) {
     252        //pWrite( *(gPrev->getFirst()->getPoly()) );
     253       // pWrite( *(l->getPoly()) );
     254        pLcm(newElement->getPoly(), temp->getPoly(), lcm);
     255        pSetCoeff(lcm,nOne);
     256        // computing factors u2 for new labels
     257        u1 = pDivide(lcm,t);
     258        pSetCoeff(u1,nOne);
     259        u2 = pDivide(lcm, pHead(temp->getPoly()));
     260        pSetCoeff(u2,nOne);
     261        //if(gPrev->getLast()->getIndex()==5) {
     262            //Print("IN CRITPAIRS\n");
     263        //    pWrite(u1);
     264        //    Print("1st ELEMENT: ");
     265        //    pWrite(newElement->getPoly());
     266        //    Print("2nd ELEMENT: ");
     267        //    pWrite(temp->getPoly());
     268        //}
     269        // testing both new labels by the F5 Criterion
    196270        if(!criterion1(gPrev,u1,newElement,lTag) && !criterion1(gPrev,u2,temp,lTag) &&
    197            !criterion2(u1, newElement, rules, rTag) && !criterion2(u2, temp, rules, rTag)) {
     271           !criterion2(u2, temp, rules, rTag)) {
    198272            // if they pass the test, add them to CList critPairs, having the LPoly with greater
    199273            // label as first element in the CPair
     
    514588        //idShow(gbPrev);
    515589        poly tempNF = kNF(gbPrev,currQuotient,temp->getPoly());
    516         pNorm(tempNF);
    517590        //Print("LENGTH: %d\n",sPolyList->getLength());
    518591        //pWrite(tempNF);
    519592        //pWrite(temp->getPoly());
    520593        if(NULL != tempNF) {
     594            pNorm(tempNF);
    521595            // write the reduced polynomial in temp
    522596            temp->setPoly(tempNF);
     
    530604            //CList* newCritPairs = new CList;
    531605            //Print("##################IN CRITPAIRS IN REDUCTION#####################\n");
    532             criticalPair(gPrev,critPairs,lTag,rTag,rules);
     606            criticalPairRed(gPrev,critPairs,lTag,rTag,rules);
    533607            //Print("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++H I E R++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
    534608        }
     
    561635        //Print("TESTED POLYNOMIAL IN THE FOLLOWING: ");
    562636        //pWrite(l->getPoly());
     637        //Print("HIER\n");
    563638        tempRed  =   findReductor(l,gPrev,rules,lTag,rTag);
    564639        //Print("--------------------------------HIER DEBUG 2----------------------------------\n");
     
    628703                    poly tempNF =   kNF(gbPrev,currQuotient,temp); 
    629704                    pNorm(tempNF);
     705                    //pWrite(tempNF);
     706                    if(NULL == tempNF) {
     707                        reductionsToZero++;
     708                        pDelete(&tempNF);
     709                        l->setPoly(NULL);
     710                        break;
     711                    }
    630712                    l->setPoly(tempNF);
     713                   
     714                    //pWrite(l->getPoly());
    631715                    l->setGPrevRedCheck(NULL);
    632716                }
     
    683767    if(NULL != l->getGPrevRedCheck()) {
    684768        temp    =   l->getGPrevRedCheck()->getNext();
    685     }
     769    } 
    686770    // no reductors were searched for l before, thus start at the first
    687771    // element of gPrev with the current index, tagged by lTag
     
    694778        // does the head of the element of gPrev divides the head of
    695779        // the to be reduced element?
    696         Print("-------------FOUND REDUCTORS----------------------\n");
    697         Print("\n");
    698         pWrite(temp->getPoly());
    699         pWrite(temp->getTerm());
    700         pWrite(t);
    701         Print("HALLO\n");
     780        //Print("-------------FOUND REDUCTORS----------------------\n");
     781        //Print("\n");
     782        //pWrite(temp->getPoly());
     783        //pWrite(temp->getTerm());
     784        //pWrite(t);
     785        //pWrite(l->getPoly());
     786        //Print("HALLO\n");
    702787        if(pLmDivisibleByNoComp(temp->getPoly(),t)) {
    703         Print("HALLO\n");
     788        //Print("HALLO\n");
    704789            // get all the information needed for the following tests
    705790            // of the criteria
    706791            u   =   pDivide(t,pHead(temp->getPoly()));
    707792            pSetCoeff(u,nOne);
    708             pWrite(u);
    709             Print("\n");
     793            //Print("HIER FINDRED\n");
     794            //pWrite(u);
     795            //Print("\n");
    710796            red =   ppMult_qq(u,temp->getPoly());
    711797            pNorm(red);
     
    713799            //pSetCoeff(u,nOne);
    714800            // check if both have the same label
    715         Print("HALLO\n");
     801        //Print("HALLO\n");
    716802            if(pLmCmp(u,l->getTerm()) != 0) {
    717         Print("HALLO\n");
     803        //Print("HALLO\n");
    718804                // passing criterion2 ?
    719805                if(!criterion2(u,temp,rules,rTag)) {
     
    728814            }
    729815        }
    730         Print("%p\n",temp->getNext());
    731         pWrite(temp->getPoly());
    732         Print("HALLO\n");
     816        //Print("%p\n",temp->getNext());
     817        //pWrite(temp->getPoly());
     818        //Print("HALLO\n");
    733819        temp = temp->getNext();
    734820    }
     
    773859        }
    774860    }
    775     id              =   kInterRed(id);
     861    ideal idNew     =   kInterRed(id);
     862    idDelete(&id);
     863    id              =   idNew;
    776864    qsortDegree(&id->m[0],&id->m[IDELEMS(id)-1]);
    777865    LList* gPrev    =   new LList(ONE, i, id->m[0]);
  • kernel/f5gb.h

    r1863d8 rc9193a  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5gb.h,v 1.29 2009-02-26 09:01:52 ederc Exp $ */
     4/* $Id: f5gb.h,v 1.30 2009-02-28 21:14:06 ederc Exp $ */
    55/*
    66* ABSTRACT: f5gb interface
     
    4545*/
    4646void criticalPair(LList* gPrev, CList* critPairs, LTagList* lTag, RTagList* rTag, RList* rules);
     47
     48/*
     49================================================================
     50computes a list of critical pairs for the next reduction process
     51first element in gPrev is always the newest element which must
     52build critical pairs with all other elements in gPrev
     53this is a special version for reduction() in which the first
     54generator of the critical pair is not tested by criterion2()
     55as there are no rules added until then to test for
     56================================================================
     57*/
     58void criticalPairRed(LList* gPrev, CList* critPairs, LTagList* lTag, RTagList* rTag, RList* rules);
    4759
    4860/*
  • kernel/f5lists.cc

    r1863d8 rc9193a  
    9191LNode* LNode::insertSP(LPoly* lp) {
    9292    LNode* newElement   =   new LNode(lp, this);
    93     Print("INSERTED IN SPOLYLIST: ");
    94     pWrite(lp->getTerm());
     93    //Print("INSERTED IN SPOLYLIST: ");
     94    //pWrite(lp->getTerm());
    9595    return newElement;
    9696}
     
    9898LNode* LNode::insertSP(poly t, int i, poly p, Rule* r) {
    9999    LNode* newElement   =   new LNode(t, i, p, r, NULL, this);
    100      Print("INSERTED IN SPOLYLIST: ");
    101     pWrite(t);
     100     //Print("INSERTED IN SPOLYLIST: ");
     101  //pWrite(t);
    102102return newElement;
    103103}
     
    105105// only used for the S-polys to be reduced (TopReduction building new S-polys with higher label)
    106106LNode* LNode::insertByLabel(poly t, int i, poly p, Rule* r) {
    107     Print("ADDING SOLYS TO THE LIST\n");
    108     Print("new element: ");
    109     pWrite(t);
     107    //Print("ADDING SOLYS TO THE LIST\n");
     108    //Print("new element: ");
     109    //pWrite(t);
    110110       if(NULL == this || NULL == data) {
    111111        LNode* newElement   =   new LNode(t, i, p, r, NULL, this);
     
    113113    }
    114114    else {
    115          Print("tested element1: ");
    116     pWrite(this->getTerm());
     115         //Print("tested element1: ");
     116    //pWrite(this->getTerm());
    117117        if(-1 == pLmCmp(t,this->getTerm())) {
    118             Print("HIERDRIN\n");
     118            //Print("HIERDRIN\n");
    119119            LNode* newElement   =   new LNode(t, i, p, r, NULL, this);
    120             Print("%p\n",this);
    121             Print("%p\n",newElement->next);
     120            //Print("%p\n",this);
     121            //Print("%p\n",newElement->next);
    122122            return newElement;
    123123        }
     
    125125            LNode* temp = this;
    126126            while(NULL != temp->next && NULL != temp->next->data) {
    127                 Print("tested element: ");
    128                 pWrite(temp->getTerm());
     127                //Print("tested element: ");
     128                //pWrite(temp->getTerm());
    129129 if(-1 == pLmCmp(t,temp->next->getTerm())) {
    130130                    LNode* newElement   =   new LNode(t, i, p, r, NULL, temp->next);
Note: See TracChangeset for help on using the changeset viewer.