Changeset bb02ea in git


Ignore:
Timestamp:
Apr 5, 2009, 9:49:18 AM (15 years ago)
Author:
Christian Eder
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
bb9471e2e1af065ffce285ee2e4d142ab2d974b0
Parents:
9660f5c48cc33240ba1f644718ebd3f554c48fff
Message:
changed reduction, first step to optimize topReduction() for SINGULAR


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

Legend:

Unmodified
Added
Removed
  • kernel/f5gb.cc

    r9660f5 rbb02ea  
    6464}
    6565
    66 
     66/**
     67==========================================================================
     68compare monomials, i.e. divisibility tests for criterion 1 and criterion 2
     69==========================================================================
     70*/
     71bool compareMonomials(int* m1, int** m2, int numberOfRules) {
     72    int i,j;
     73    int k   =   sizeof(m1) / sizeof(int);
     74    for(i=0; i<numberOfRules; i++) {
     75        for(j=1; j<=k; j++) {
     76            if(m1[j]>m2[i][j]) {
     77                return true;
     78            }
     79        }
     80    }
     81    return false;
     82}
    6783
    6884/*
     
    183199    */
    184200    //gPrev->print();
    185     Print("COMPLETE REDUCTION TIME UNTIL NOW: %d\n",reductionTime);
    186     Print("COMPLETE SPOLS TIME UNTIL NOW:     %d\n",spolsTime);
     201    //Print("COMPLETE REDUCTION TIME UNTIL NOW: %d\n",reductionTime);
     202    //Print("COMPLETE SPOLS TIME UNTIL NOW:     %d\n",spolsTime);
    187203    return gPrev;
    188204}
     
    529545                    if(!criterion2(temp->getT2(),temp->getAdLp2(),rules,temp->getTestedRule())) {
    530546                        // computation of S-polynomial
    531                         sp      =   pSub(ppMult_qq(temp->getT1(),temp->getLp1Poly()),
     547                        sp      =   ksOldSpolyRedNew(ppMult_qq(temp->getT1(),temp->getLp1Poly()),
    532548                                         ppMult_qq(temp->getT2(),temp->getLp2Poly()));
    533549                        //Print("BEGIN SPOLY1\n====================\n");
     
    564580                else { // temp->getLp2Index() < temp->getLp1Index()
    565581                    // computation of S-polynomial
    566                     sp      =   pSub(ppMult_qq(temp->getT1(),temp->getLp1Poly()),
     582                    sp      =   ksOldSpolyRedNew(ppMult_qq(temp->getT1(),temp->getLp1Poly()),
    567583                                     ppMult_qq(temp->getT2(),temp->getLp2Poly()));
    568584                    //Print("BEGIN SPOLY2\n====================\n");
     
    665681    poly pOne               =   pOne();
    666682    do {
    667         int timer5  =   initTimer();
    668         startTimer();
    669         tempRed  =   findReductor(l,gPrevRedCheck,gPrev,rules,lTag,rTag);
    670         timer5  =   getTimer();
    671         reductionTime   =   reductionTime   +   timer5;
     683        //int timer5  =   initTimer();
     684        //startTimer();
     685        tempRed  =   findReductor(l,sPolyList,gPrevRedCheck,gPrev,rules,lTag,rTag);
     686        //timer5  =   getTimer();
     687        //reductionTime   =   reductionTime   +   timer5;
    672688        // if a reductor for l is found and saved in tempRed
    673689        if(NULL != tempRed) {
     
    680696                //Print("VORHER: ");
    681697                //pWrite(tempRed->getPoly());
    682                 poly temp           =   pMinus_mm_Mult_qq(tempRed->getPoly(),pOne,l->getPoly());
    683                 //poly temp   =   ksOldSpolyRedNew(l->getPoly(),tempRed->getPoly());
     698                //poly temp           =   pMinus_mm_Mult_qq(tempRed->getPoly(),pOne,l->getPoly());
     699                poly temp   =   ksOldSpolyRedNew(l->getPoly(),tempRed->getPoly());
    684700                //Print("NACHHER: ");
    685701                //pWrite(tempRed->getPoly());
     
    709725                //poly temp_poly_l    =   pInit();
    710726                //temp_poly_l         =   pCopy(l->getPoly());
    711                 poly temp   =   pMinus_mm_Mult_qq(tempRed->getPoly(),pOne,l->getPoly());
    712                 //poly temp   =   ksOldSpolyRedNew(l->getPoly(),tempRed->getPoly());
     727                //poly temp   =   pMinus_mm_Mult_qq(tempRed->getPoly(),pOne,l->getPoly());
     728                poly temp   =   ksOldSpolyRedNew(l->getPoly(),tempRed->getPoly());
    713729                if(NULL != temp) {
    714730                    pNorm(temp);
     
    750766=====================================================================
    751767*/
    752 LNode* findReductor(LNode* l, LNode* gPrevRedCheck, LList* gPrev, RList* rules, LTagList* lTag,RTagList* rTag) {
     768LNode* findReductor(LNode* l, LList* sPolyList, LNode* gPrevRedCheck, LList* gPrev, RList* rules, LTagList* lTag,RTagList* rTag) {
    753769    // allociation of memory for the possible reductor
     770    //Print("LPOLY:  ");
     771    //pWrite(l->getPoly());
    754772    poly u      =   pOne();
    755773    poly red;
     
    775793            pNorm(red);
    776794            // check if both have the same label
    777             if(pLmCmp(u,l->getTerm()) != 0) {
     795            if(pLmCmp(ppMult_qq(u,temp->getTerm()),l->getTerm()) == -1) {
    778796                // passing criterion2 ?
    779797                if(!criterion2(gPrev->getFirst()->getIndex(), u,temp,rules,rTag)) {
     
    786804                }
    787805            }
    788         }
     806            if(pLmCmp(ppMult_qq(u,temp->getTerm()),l->getTerm()) == 1) {
     807                // passing criterion2 ?
     808                if(!criterion2(gPrev->getFirst()->getIndex(), u,temp,rules,rTag)) {
     809                    // passing criterion1 ?
     810                    if(!criterion1(gPrev,u,temp,lTag)) {
     811                        poly tempSpoly  =   ksOldSpolyRedNew(red,l->getPoly());
     812                        rules->insert(temp->getIndex(),ppMult_qq(u,temp->getTerm()));
     813                        gPrevRedCheck   =   temp->getNext();
     814                        if(NULL != tempSpoly) {
     815                            pNorm(tempSpoly);
     816                            sPolyList->insertByLabel(ppMult_qq(u,temp->getTerm()),temp->getIndex(),tempSpoly,rules->getFirst()->getRule());
     817                    //Print("NEW ONE: ");
     818                    //pWrite(tempSpoly);
     819                    //Print("HIER\n");
     820                            //sPolyList->print();
     821                            //sleep(5);
     822                        }
     823                    }
     824                }
     825            }
     826        }
     827        //Print("AUCH HIER\n");
    789828        temp = temp->getNext();
    790829    }
     
    915954            // interreduction stuff
    916955            if(i<IDELEMS(id)) {
    917                 int timer2  =   initTimer();
    918                 startTimer();
     956                //int timer2  =   initTimer();
     957                //startTimer();
    919958                ideal tempId    =   kInterRed(gbPrev);
    920959               
    921960                //idShow(tempId);
    922961                gbPrev          =   tempId;
    923                 timer2  =   getTimer();
    924                 Print("Timer INTERREDUCTION: %d\n",timer2);
     962                //timer2  =   getTimer();
     963                //Print("Timer INTERREDUCTION: %d\n",timer2);
    925964                //idShow(gbPrev);
    926965                //qsortDegree(&gbPrev->m[0],&gbPrev->m[IDELEMS(gbPrev)-1]);
  • kernel/f5gb.h

    r9660f5 rbb02ea  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5gb.h,v 1.34 2009-04-02 12:59:59 ederc Exp $ */
     4/* $Id: f5gb.h,v 1.35 2009-04-05 07:49:18 ederc Exp $ */
    55/*
    66* ABSTRACT: f5gb interface
     
    2020*/
    2121void qsortDegree(poly* left, poly* right);
     22
     23/**
     24==========================================================================
     25compare monomials, i.e. divisibility tests for criterion 1 and criterion 2
     26==========================================================================
     27*/
     28bool compareMonomials(int* m1, int** m2, int numberOfRules);
    2229
    2330/*
     
    95102=====================================================================
    96103*/
    97 inline LNode* findReductor(LNode* l, LNode* gPrevRedCheck, LList* gPrev, RList* rules, LTagList* lTag,RTagList* rTag);
     104inline LNode* findReductor(LNode* l, LList* sPolyList, LNode* gPrevRedCheck, LList* gPrev, RList* rules, LTagList* lTag,RTagList* rTag);
    98105
    99106/*
Note: See TracChangeset for help on using the changeset viewer.