Changeset 61944d0 in git


Ignore:
Timestamp:
Feb 26, 2009, 10:01:52 AM (15 years ago)
Author:
Christian Eder
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
60933487e53ddb20e0e5d7d5ccc137ac53893f37
Parents:
7a8ca6fdf98e2078621ae6ac00ff9481cab3def8
Message:
solved problems in reduction() in topReduction() considering both criteria and computation of new polynomials


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

Legend:

Unmodified
Added
Removed
  • kernel/f5gb.cc

    r7a8ca6 r61944d0  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5gb.cc,v 1.33 2009-02-23 14:28:38 ederc Exp $ */
     4/* $Id: f5gb.cc,v 1.34 2009-02-26 09:01:52 ederc Exp $ */
    55/*
    66* ABSTRACT: f5gb interface
     
    7373    //Print("%p\n",gPrev->getFirst());
    7474    //pWrite(gPrev->getFirst()->getPoly());
     75    poly tempNF =   kNF(gbPrev,currQuotient,f_i);
     76    f_i         =   tempNF;
    7577    gPrev->insert(ONE,i,f_i);
    7678    // tag the first element in gPrev of the current index for findReductor()
     
    183185        u2 = pDivide(lcm, pHead(temp->getPoly()));
    184186        pSetCoeff(u2,nOne);
    185         //Print("IN CRITPAIRS\n");
    186         //pWrite(u1);
    187         //Print("1st ELEMENT: ");
    188         //pWrite(newElement->getPoly());
    189         //Print("2nd ELEMENT: ");
    190         //pWrite(temp->getPoly());
     187        //if(gPrev->getLast()->getIndex()==5) {
     188        //    Print("IN CRITPAIRS\n");
     189        //    pWrite(u1);
     190        //    Print("1st ELEMENT: ");
     191        //    pWrite(newElement->getPoly());
     192        //    Print("2nd ELEMENT: ");
     193        //    pWrite(temp->getPoly());
     194        //}
    191195        // testing both new labels by the F5 Criterion
    192196        if(!criterion1(gPrev,u1,newElement,lTag) && !criterion1(gPrev,u2,temp,lTag) &&
     
    215219    }
    216220    // for debugging
    217     if(NULL != critPairs) {
    218         //critPairs->print();
     221    if(NULL != critPairs && gPrev->getLast()->getIndex() == 4) {
     222        //critPairs->print();
     223        //sleep(5);
    219224    }
    220225}
     
    315320          && l->getIndex() == testNode->getRuleIndex()) {
    316321        //pWrite(testNode->getRuleTerm());
    317                 if(pLmDivisibleBy(testNode->getRuleTerm(),u1)) {
     322                //pWrite(testNode->getRuleTerm());
     323        //pWrite(t);
     324        //pWrite(l->getTerm());
     325        //pWrite(u1);
     326        //Print("%d\n",testNode->getRuleIndex());
     327        if(pLmDivisibleBy(testNode->getRuleTerm(),u1)) {
    318328            //Print("Criterion 2 NOT passed!\n");
    319329            pDelete(&u1);
     
    443453                        //Print("%d\n",rules->getFirst()->getRuleIndex());
    444454                        //Print("%p\n",sPolyList->getFirst());
    445                         sPolyList->insertSP(ppMult_qq(temp->getT1(),temp->getLp1Term()),temp->getLp1Index(),sp,rules->getFirst()->getRule());
     455                        sPolyList->insertByLabel(ppMult_qq(temp->getT1(),temp->getLp1Term()),temp->getLp1Index(),sp,rules->getFirst()->getRule());
    446456                    }
    447457                    // data is saved in sPolyList or zero => delete sp
     
    477487        //Print("%p\n",sPolyList->getFirst());
    478488        }
    479         //sPolyList->print();
     489        //if(gPrev->getLast()->getIndex() == 5) {
     490            //sPolyList->print();
     491            //sleep(5);
     492        //}
     493       
    480494        // temp is the first element in the sPolyList which should be reduced
    481495        // due to earlier sorting this is the element of minimal degree AND
     
    507521            // with label index = current label index: this is done such that there
    508522            // is no label corruption during the reduction process
    509             topReduction(temp,sPolyList,gPrev,rules,lTag,rTag);
     523            topReduction(temp,sPolyList,gPrev,rules,lTag,rTag,gbPrev);
    510524       
    511525        }
     
    536550=====================================================================================
    537551*/
    538 void topReduction(LNode* l, LList* sPolyList, LList* gPrev, RList* rules, LTagList* lTag, RTagList* rTag) {
     552void topReduction(LNode* l, LList* sPolyList, LList* gPrev, RList* rules, LTagList* lTag, RTagList* rTag, ideal gbPrev) {
    539553    //Print("##########################################In topREDUCTION!########################################\n");
    540554    // try l as long as there are reductors found by findReductor()
    541555    do {
    542556        LNode* tempRed  =   new LNode();
     557        Print("TESTED POLYNOMIAL IN THE FOLLOWING: ");
     558        pWrite(l->getPoly());
    543559        tempRed  =   findReductor(l,gPrev,rules,lTag,rTag);
    544560        //Print("--------------------------------HIER DEBUG 2----------------------------------\n");
     
    547563            // if label of reductor is greater than the label of l we have to built a new element
    548564            // and add it to sPolyList
     565            Print("REDUCTOR POLYNOMIAL: ");
     566            pWrite(tempRed->getPoly());
     567            Print("TERM: ");
     568            pWrite(tempRed->getTerm());
    549569            if(pLmCmp(tempRed->getTerm(),l->getTerm()) == 1) {
    550                 poly temp   =   pSub(tempRed->getPoly(),l->getPoly());
     570                // needed sinc pSub destroys the arguments!
     571                poly temp_poly_l    =   pInit();
     572                temp_poly_l         =   pCopy(l->getPoly());
     573                //Print("POLYNOMIAL L: ");
     574                //pWrite(l->getPoly());
     575                //pWrite(temp_poly_l);
     576                poly temp           =   pSub(tempRed->getPoly(),temp_poly_l);
     577                //Print("POLYNOMIAL L: ");
     578                //pWrite(l->getPoly());
     579                //pWrite(temp_poly_l);
     580                //Print("AFTER REDUCTION STEP: ");
     581                //pWrite(temp);
     582                //sleep(20);
    551583                //pWrite(temp);
    552584                if(NULL != temp) {
    553585                    pNorm(temp);
    554586                    tempRed->setPoly(temp);
     587                    //pWrite(tempRed->getPoly());
    555588                    // for debugging
    556589                    //pWrite(tempRed->getPoly());
     
    577610            // after subtraction
    578611            else {
    579                 poly temp   =   pSub(l->getPoly(),tempRed->getPoly());
     612                poly temp_poly_l    =   pInit();
     613                temp_poly_l         =   pCopy(l->getPoly());
     614                poly temp   =   pSub(temp_poly_l,tempRed->getPoly());
     615                //Print("AFTER REDUCTION STEP: ");
    580616                //pWrite(temp);
    581617                if(NULL != temp) {
    582618                    pNorm(temp);
    583                     l->setPoly(temp);
     619                    poly tempNF =   kNF(gbPrev,currQuotient,temp); 
     620                    pNorm(tempNF);
     621                    l->setPoly(tempNF);
    584622                    l->setGPrevRedCheck(NULL);
    585623                }
     
    596634        else {
    597635            if(NULL != l->getPoly()) {
    598                 //Print("ADDED TO GPREV IN TOPREDUCTION: ");
    599                 //pWrite(l->getPoly());
    600                 //pWrite(l->getTerm());
    601                 //Print("INDEX: %d\n", l->getIndex());
    602                 //sleep(10);
     636                pNorm(l->getPoly());
     637                Print("----------------------------------ADDED TO GPREV IN TOPREDUCTION:-------------------------------------- ");
     638                pWrite(l->getPoly());
     639                pWrite(l->getTerm());
     640                Print("INDEX: %d\n\n\n", l->getIndex());
     641               
    603642                gPrev->insert(l->getLPoly());
    604643                //Print("GPREV: \n");
     
    646685        // does the head of the element of gPrev divides the head of
    647686        // the to be reduced element?
     687        //Print("-------------FOUND REDUCTORS----------------------\n");
     688        //Print("\n");
     689        //pWrite(temp->getPoly());
     690        //pWrite(temp->getTerm());
    648691        if(pLmDivisibleByNoComp(temp->getPoly(),t)) {
    649692            // get all the information needed for the following tests
     
    651694            u   =   pDivide(t,pHead(temp->getPoly()));
    652695            pSetCoeff(u,nOne);
     696            //pWrite(u);
     697            //Print("\n");
    653698            red =   ppMult_qq(u,temp->getPoly());
    654699            pNorm(red);
    655             u   =   ppMult_qq(u,temp->getTerm());
    656             pSetCoeff(u,nOne);
     700            //u   =   ppMult_qq(u,temp->getTerm());
     701            //pSetCoeff(u,nOne);
    657702            // check if both have the same label
    658703            if(pLmCmp(u,l->getTerm()) != 0) {
     
    711756        }
    712757    }
     758    id              =   kInterRed(id);
     759    qsortDegree(&id->m[0],&id->m[IDELEMS(id)-1]);
    713760    LList* gPrev    =   new LList(ONE, i, id->m[0]);
     761    //idShow(id);
    714762    //Print("%p\n",id->m[0]);
    715763    //pWrite(id->m[0]);
     
    774822    //    temp    =   temp->getNext();
    775823    // }
     824    delete(gPrev);
    776825    return(gbPrev);
    777826
  • kernel/f5gb.h

    r7a8ca6 r61944d0  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5gb.h,v 1.28 2009-02-19 14:52:34 ederc Exp $ */
     4/* $Id: f5gb.h,v 1.29 2009-02-26 09:01:52 ederc Exp $ */
    55/*
    66* ABSTRACT: f5gb interface
     
    1919======================================================
    2020*/
    21 void qsort_degree(poly* left, poly* right);
     21void qsortDegree(poly* left, poly* right);
    2222
    2323/*
     
    8888=====================================================================================
    8989*/
    90 void topReduction(LNode* l, LList* sPolyList, LList* gPrev, RList* rules, LTagList* lTag, RTagList* rTag);
     90void topReduction(LNode* l, LList* sPolyList, LList* gPrev, RList* rules, LTagList* lTag, RTagList* rTag, ideal gbPrev);
    9191
    9292/*
  • kernel/f5lists.cc

    r7a8ca6 r61944d0  
    106106    }
    107107    else {
    108         if(0 == pLmCmp(t,this->getTerm()) || -1 == pLmCmp(t,this->getTerm())) {
     108        if(-1 == pLmCmp(t,this->getTerm())) {
    109109            LNode* newElement   =   new LNode(t, i, p, r, this);
    110110            return newElement;
     
    113113            LNode* temp = this;
    114114            while(NULL != temp->next && NULL != temp->next->data) {
    115                 if( 0 == pLmCmp(t,temp->next->getTerm()) || -1 == pLmCmp(t,temp->next->getTerm())) {
     115                if(-1 == pLmCmp(t,temp->next->getTerm())) {
    116116                    LNode* newElement   =   new LNode(t, i, p, r, temp->next);
    117117                    temp->next          =   newElement;
     
    188188}
    189189
     190void LNode::setNext(LNode* l) {
     191    next    =   l;
     192}
     193
    190194// test if for any list element the polynomial part of the data is equal to *p
    191195bool LNode::polyTest(poly* p) {
     
    213217        Print("Index: %d\n",temp->getIndex());
    214218        Print("Term: ");
    215         //pWrite(temp->getTerm());
     219        pWrite(temp->getTerm());
    216220        Print("Poly: ");
    217         //pWrite(temp->getPoly());
     221        pWrite(temp->getPoly());
    218222        Print("\n");
    219223        temp = temp->next;
     
    312316
    313317void LList::setFirst(LNode* l) {
     318    LNode* temp =   first;
     319    temp->setNext(NULL);
    314320    first       =   l;
    315321    length--;
  • kernel/f5lists.h

    r7a8ca6 r61944d0  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5lists.h,v 1.11 2009-02-19 14:52:34 ederc Exp $ */
     4/* $Id: f5lists.h,v 1.12 2009-02-26 09:01:52 ederc Exp $ */
    55/*
    66* ABSTRACT: list interface
     
    7979        void    setIndex(int i);
    8080        void    setGPrevRedCheck(LNode* l);
     81        void    setNext(LNode* l);
    8182        // test if for any list element the polynomial part of the data is equal to *p
    8283        bool    polyTest(poly* p);
Note: See TracChangeset for help on using the changeset viewer.