Changeset 9cb4078 in git


Ignore:
Timestamp:
Mar 4, 2009, 9:23:05 PM (15 years ago)
Author:
Christian Eder
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
fe880793d1fe5f78cc5038ae512e18c6cbaab42c
Parents:
fcef59fcd75c37051211c94b3423f0d319602d9d
Message:
implemented interreduction, still with lots of bugs => commented out


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

Legend:

Unmodified
Added
Removed
  • kernel/f5data.cc

    rfcef59 r9cb4078  
     1//! \file f5data.h
    12/****************************************
    23*  Computer Algebra System SINGULAR     *
    34****************************************/
    4 /* $Id: f5data.cc,v 1.8 2009-02-19 14:52:34 ederc Exp $ */
     5/* $Id: f5data.cc,v 1.9 2009-03-04 20:23:05 ederc Exp $ */
    56/*
    67* ABSTRACT: lpolynomial definition
     
    2627#include "f5lists.h"
    2728/*
    28 ================================================================
    29 all functions working on the class LPoly for labeled polynomials
    30 ================================================================
     29=====================
     30everything is inlined
     31=====================
    3132*/
    32 LPoly::LPoly(poly t,int i,poly p, Rule* r) {
    33     set(t,i,p,r);
    34 }
    35 
    36 void LPoly::setPoly(poly p)  {
    37     //poly _p     =   pInit();
    38     //_p          =   pCopy(p);
    39     polynomial = p;
    40 }
    41 
    42 void LPoly::setTerm(poly t) {
    43     //poly _t     =   pInit();
    44     //_t          =   pCopy(t);
    45     term = t;
    46 }
    47 
    48 void LPoly::setIndex(int i) {
    49     index = i;
    50 }
    51 
    52 void LPoly::setRule(Rule* r) {
    53     _rule   =   r;
    54 }
    55 
    56 poly LPoly::getPoly() {
    57     return polynomial;
    58 }
    59 
    60 poly LPoly::getTerm() {
    61     return term;
    62 }
    63 
    64 int LPoly::getIndex() {
    65     return index;
    66 }
    67 
    68 Rule* LPoly::getRule() {
    69     return _rule;
    70 }
    71 void LPoly::set(poly t, int i, poly p, Rule* r) {
    72     this->setTerm(t);
    73     this->setIndex(i);
    74     this->setPoly(p);
    75     this->setRule(r);
    76 }
    77 
    78 LPoly* LPoly::get() {
    79     return this;
    80 }
    81 
    82 /*
    83 ====================================
    84 functions working on the class CPair
    85 ====================================
    86 */
    87 CPair::CPair(long degree, poly term1, LPoly* lpoly1, poly term2, LPoly* lpoly2, Rule* r) {
    88    deg              =   degree;
    89    t1               =   term1;
    90    lp1              =   lpoly1;
    91    t2               =   term2;
    92    lp2              =   lpoly2;
    93    testedRule       =   r;
    94 }
    95 
    96 long CPair::getDeg() {
    97     return deg;
    98 }
    99 
    100 poly CPair::getT1() {
    101     return t1;
    102 }
    103 
    104 poly* CPair::getAdT1() {
    105     return &t1;
    106 }
    107 
    108 poly* CPair::getAdT2() {
    109     return &t2;
    110 }
    111 
    112 poly CPair::getT2() {
    113     return t2;
    114 }
    115 
    116 LPoly* CPair::getAdLp1() {
    117     return lp1;
    118 }
    119 
    120 LPoly* CPair::getAdLp2() {
    121     return lp2;
    122 }
    123 
    124 poly CPair::getLp1Poly() {
    125     return lp1->getPoly();
    126 }
    127 
    128 poly CPair::getLp2Poly() {
    129     return lp2->getPoly();
    130 }
    131 
    132 poly CPair::getLp1Term() {
    133     return lp1->getTerm();
    134 }
    135 
    136 poly CPair::getLp2Term() {
    137     return lp2->getTerm();
    138 }
    139 
    140 int CPair::getLp1Index() {
    141     return lp1->getIndex();
    142 }
    143 
    144 int CPair::getLp2Index() {
    145     return lp2->getIndex();
    146 }
    147 
    148 Rule* CPair::getTestedRule() {
    149     return testedRule;
    150 }
    151 
    152 void CPair::setTestedRule(Rule* r) {
    153     testedRule      =   r;
    154 }
    155 
    156 /*
    157 ===================================
    158 functions working on the class Rule
    159 ===================================
    160 */
    161 Rule::Rule(int i, poly t) {
    162     index   =   i;
    163     term    =   t;
    164 }
    165 
    166 int Rule::getIndex() {
    167     return index;
    168 }
    169 
    170 poly Rule::getTerm() {
    171     return term;
    172 }
    17333#endif
  • kernel/f5data.h

    rfcef59 r9cb4078  
     1//! \file f5data.cc
    12/****************************************
    23*  Computer Algebra System SINGULAR     *
    34****************************************/
    4 /* $Id: f5data.h,v 1.7 2009-02-19 14:52:34 ederc Exp $ */
     5/* $Id: f5data.h,v 1.8 2009-03-04 20:23:05 ederc Exp $ */
    56/*
    67* ABSTRACT: labeled polynomial interface
     
    910#define F5DATA_HEADER
    1011#ifdef HAVE_F5
    11 /*
     12/*!
    1213=========================================================
    1314=========================================================
     
    2122
    2223
    23 /*
     24/*!
    2425============================
    2526class of labeled polynomials
     
    3334        Rule*   _rule;
    3435    public:
    35                 LPoly(poly t, int i, poly p, Rule* r=NULL);
    36         void    setPoly(poly p);
    37         poly    getPoly();
    38         void    setTerm(poly t);
    39         poly    getTerm();
    40         void    setIndex(int i);
    41         int     getIndex();
    42         void    setRule(Rule* r);
    43         Rule*   getRule();
    44         void    set(poly t, int i, poly p, Rule* r);
    45         LPoly*  get();
     36        inline          LPoly(poly t, int i, poly p, Rule* r=NULL);
     37        inline  void    setPoly(poly p);
     38        inline  poly    getPoly();
     39        inline  void    setTerm(poly t);
     40        inline  poly    getTerm();
     41        inline  void    setIndex(int i);
     42        inline  int     getIndex();
     43        inline  void    setRule(Rule* r);
     44        inline  Rule*   getRule();
     45        inline  void    set(poly t, int i, poly p, Rule* r);
     46        inline  LPoly*  get();
    4647};
    4748
    48 /*
     49LPoly::LPoly(poly t,int i,poly p, Rule* r) {
     50    set(t,i,p,r);
     51}
     52
     53void LPoly::setPoly(poly p)  {
     54    //poly _p     =   pInit();
     55    //_p          =   pCopy(p);
     56    polynomial = p;
     57}
     58
     59void LPoly::setTerm(poly t) {
     60    //poly _t     =   pInit();
     61    //_t          =   pCopy(t);
     62    term = t;
     63}
     64
     65void LPoly::setIndex(int i) {
     66    index = i;
     67}
     68
     69void LPoly::setRule(Rule* r) {
     70    _rule   =   r;
     71}
     72
     73poly LPoly::getPoly() {
     74    return polynomial;
     75}
     76
     77poly LPoly::getTerm() {
     78    return term;
     79}
     80
     81int LPoly::getIndex() {
     82    return index;
     83}
     84
     85Rule* LPoly::getRule() {
     86    return _rule;
     87}
     88
     89void LPoly::set(poly t, int i, poly p, Rule* r) {
     90    this->setTerm(t);
     91    this->setIndex(i);
     92    this->setPoly(p);
     93    this->setRule(r);
     94}
     95
     96LPoly* LPoly::get() {
     97    return this;
     98}
     99
     100
     101/*!
    49102===================================
    50103structure of labeled critical pairs
     
    60113        Rule*   testedRule;     // already tested by rules up to lastRuleTested
    61114    public:
    62                 CPair(long degree, poly term1, LPoly* lpoly1, poly term2, LPoly* lpoly2, Rule* r = NULL);
    63         long    getDeg();
    64         poly    getT1();
    65         poly*   getAdT1();
    66         LPoly*  getAdLp1();
    67         poly    getLp1Poly();
    68         poly    getLp1Term();
    69         int     getLp1Index();
    70         poly    getT2();
    71         poly*   getAdT2();
    72         LPoly*  getAdLp2();
    73         poly    getLp2Poly();
    74         poly    getLp2Term();
    75         int     getLp2Index();
    76         Rule*   getTestedRule();
    77         void    setTestedRule(Rule* r);
     115        inline          CPair(long degree, poly term1, LPoly* lpoly1, poly term2, LPoly* lpoly2, Rule* r = NULL);
     116        inline  long    getDeg();
     117        inline  poly    getT1();
     118        inline  poly*   getAdT1();
     119        inline  LPoly*  getAdLp1();
     120        inline  poly    getLp1Poly();
     121        inline  poly    getLp1Term();
     122        inline  int     getLp1Index();
     123        inline  poly    getT2();
     124        inline  poly*   getAdT2();
     125        inline  LPoly*  getAdLp2();
     126        inline  poly    getLp2Poly();
     127        inline  poly    getLp2Term();
     128        inline  int     getLp2Index();
     129        inline  Rule*   getTestedRule();
     130        inline  void    setTestedRule(Rule* r);
    78131};
    79132
    80 
    81 /*
     133CPair::CPair(long degree, poly term1, LPoly* lpoly1, poly term2, LPoly* lpoly2, Rule* r) {
     134   deg              =   degree;
     135   t1               =   term1;
     136   lp1              =   lpoly1;
     137   t2               =   term2;
     138   lp2              =   lpoly2;
     139   testedRule       =   r;
     140}
     141
     142long CPair::getDeg() {
     143    return deg;
     144}
     145
     146poly CPair::getT1() {
     147    return t1;
     148}
     149
     150poly* CPair::getAdT1() {
     151    return &t1;
     152}
     153
     154poly* CPair::getAdT2() {
     155    return &t2;
     156}
     157
     158poly CPair::getT2() {
     159    return t2;
     160}
     161
     162LPoly* CPair::getAdLp1() {
     163    return lp1;
     164}
     165
     166LPoly* CPair::getAdLp2() {
     167    return lp2;
     168}
     169
     170poly CPair::getLp1Poly() {
     171    return lp1->getPoly();
     172}
     173
     174poly CPair::getLp2Poly() {
     175    return lp2->getPoly();
     176}
     177
     178poly CPair::getLp1Term() {
     179    return lp1->getTerm();
     180}
     181
     182poly CPair::getLp2Term() {
     183    return lp2->getTerm();
     184}
     185
     186int CPair::getLp1Index() {
     187    return lp1->getIndex();
     188}
     189
     190int CPair::getLp2Index() {
     191    return lp2->getIndex();
     192}
     193
     194Rule* CPair::getTestedRule() {
     195    return testedRule;
     196}
     197
     198void CPair::setTestedRule(Rule* r) {
     199    testedRule      =   r;
     200}
     201
     202
     203/*!
    82204========================================================
    83205structure of rules(i.e. already computed / known labels)
     
    89211        poly    term;       // term of the labeled polynomial the rule comes from
    90212    public:
    91                 Rule(int i, poly term);
    92         int     getIndex();
    93         poly    getTerm();
     213        inline          Rule(int i, poly term);
     214        inline  int     getIndex();
     215        inline  poly    getTerm();
    94216};
     217
     218Rule::Rule(int i, poly t) {
     219    index   =   i;
     220    term    =   t;
     221}
     222
     223int Rule::getIndex() {
     224    return index;
     225}
     226
     227poly Rule::getTerm() {
     228    return term;
     229}
    95230#endif
    96231#endif
  • kernel/f5gb.cc

    rfcef59 r9cb4078  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5gb.cc,v 1.37 2009-03-01 20:31:54 ederc Exp $ */
     4/* $Id: f5gb.cc,v 1.38 2009-03-04 20:23:04 ederc Exp $ */
    55/*
    66* ABSTRACT: f5gb interface
     
    7070*/
    7171LList* F5inc(int i, poly f_i, LList* gPrev, ideal gbPrev, poly ONE, LTagList* lTag, RList* rules, RTagList* rTag) {
     72    Print("in f5inc\n");           
     73    //pWrite(rules->getFirst()->getRuleTerm());
    7274    int j;
    7375    //Print("%p\n",gPrev->getFirst());
     
    139141    }
    140142    lTag->insert(lTag->getFirstCurrentIdx());
    141     //Print("LTAG LIST: \n");
    142     LNode* tempTag = lTag->getFirst();
    143143    //Print("INDEX: %d\n",tempTag->getIndex());
    144144    //pWrite(tempTag->getPoly());
     
    151151    //pWrite(gPrev->getFirst()->getNext()->getNext()->getPoly());
    152152    //delete sPolyList;
    153     //delete critPairs;
     153    critPairs->print();
     154    delete critPairs;
     155    Print("IN F5INC\n");
     156   
    154157    //gPrev->print();
    155158    return gPrev;
     
    165168================================================================
    166169*/
    167 void criticalPair(LList* gPrev, CList* critPairs, LTagList* lTag, RTagList* rTag, RList* rules) {
    168     // initialization for usage in pLcm()
    169     number nOne         =   nInit(1);
    170     LNode* newElement   =   gPrev->getLast();
    171     LNode* temp         =   gPrev->getFirst();
    172     poly u1             =   pOne();
    173     poly u2             =   pOne();
    174     poly lcm            =   pOne();
    175     poly t              =   pHead(newElement->getPoly());
    176     Rule* testedRule    =   rules->getFirst()->getRule();
    177     // computation of critical pairs
    178     while( gPrev->getLast() != temp) {
    179         //pWrite( *(gPrev->getFirst()->getPoly()) );
    180        // pWrite( *(l->getPoly()) );
    181         pLcm(newElement->getPoly(), temp->getPoly(), lcm);
    182         pSetCoeff(lcm,nOne);
    183         // computing factors u2 for new labels
    184         u1 = pDivide(lcm,t);
    185         pSetCoeff(u1,nOne);
    186         u2 = pDivide(lcm, pHead(temp->getPoly()));
    187         pSetCoeff(u2,nOne);
    188         //if(gPrev->getLast()->getIndex()==5) {
    189             //Print("IN CRITPAIRS\n");
    190         //    pWrite(u1);
    191         //    Print("1st ELEMENT: ");
    192         //    pWrite(newElement->getPoly());
    193         //    Print("2nd ELEMENT: ");
    194         //    pWrite(temp->getPoly());
    195         //}
    196         // testing both new labels by the F5 Criterion
    197         if(!criterion1(gPrev,u1,newElement,lTag) && !criterion1(gPrev,u2,temp,lTag)) {
    198         //&& !criterion2(u1, newElement, rules, rTag) && !criterion2(u2, temp, rules, rTag)) {
    199             // if they pass the test, add them to CList critPairs, having the LPoly with greater
    200             // label as first element in the CPair
    201             if(newElement->getIndex() == temp->getIndex() &&
    202             -1 == pLmCmp(ppMult_qq(u1, newElement->getTerm()),ppMult_qq(u2, temp->getTerm()))) {
    203                 //Print("zweites groesser\n");
    204                 CPair* cp   =   new CPair(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2,
    205                                 temp->getLPoly(), u1, newElement->getLPoly(), testedRule);                   
    206                 critPairs->insert(cp);
    207             }
    208             else {
    209                 //Print("erstes groesser\n");
    210                 CPair* cp   =   new CPair(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1,
    211                                 newElement->getLPoly(), u2, temp->getLPoly(), testedRule);                   
    212                 critPairs->insert(cp);
    213             }
    214         }
    215         else {
    216         }
    217        
    218         //Print("\n\n");
    219         temp    =   temp->getNext();
    220     }
    221     // for debugging
    222     //if(NULL != critPairs) {
    223         //critPairs->print();
    224         //sleep(5);
    225     //}
    226 }
    227 
    228 
    229 
    230 
    231 /*
    232 ================================================================
    233 computes a list of critical pairs for the next reduction process
    234 first element in gPrev is always the newest element which must
    235 build critical pairs with all other elements in gPrev
    236 this is a special version for reduction() in which the first
    237 generator of the critical pair is not tested by criterion2()
    238 as there are no rules added until then to test for
    239 ================================================================
    240 */
    241 void criticalPairRed(LList* gPrev, CList* critPairs, LTagList* lTag, RTagList* rTag, RList* rules) {
     170inline void criticalPair(LList* gPrev, CList* critPairs, LTagList* lTag, RTagList* rTag, RList* rules) {
    242171    // initialization for usage in pLcm()
    243172    number nOne         =   nInit(1);
     
    270199        // testing both new labels by the F5 Criterion
    271200        if(!criterion1(gPrev,u1,newElement,lTag) && !criterion1(gPrev,u2,temp,lTag) &&
    272            !criterion2(u2, temp, rules, rTag)) {
     201           !criterion2(u1, newElement, rules, rTag) && !criterion2(u2, temp, rules, rTag)) {
    273202            // if they pass the test, add them to CList critPairs, having the LPoly with greater
    274203            // label as first element in the CPair
     
    303232
    304233
     234
     235
     236
    305237/*
    306238========================================
     
    308240========================================
    309241*/
    310 bool criterion1(LList* gPrev, poly t, LNode* l, LTagList* lTag) {
     242inline bool criterion1(LList* gPrev, poly t, LNode* l, LTagList* lTag) {
    311243    // starts at the first element in gPrev with index = (index of l)-1, these tags are saved in lTag
    312244        int idx =   l->getIndex();
     
    345277=====================================
    346278*/
    347 bool criterion2(poly t, LNode* l, RList* rules, RTagList* rTag) {
     279inline bool criterion2(poly t, LNode* l, RList* rules, RTagList* rTag) {
    348280    //Print("------------------------------IN CRITERION 2-----------------------------------------\n");
    349281        //Print("RULES: \n");
    350282        RNode* tempR    =   rules->getFirst();
    351         while(NULL != tempR->getRule()) {
    352             //Print("ADDRESS OF RULE: %p\n",tempR->getRule());
    353             //pWrite(tempR->getRuleTerm());
    354             //Print("ADDRESS OF TERM: %p\n",tempR->getRuleTerm());
    355             //Print("%d\n\n",tempR->getRuleIndex());
    356             tempR   =   tempR->getNext();
    357         }
     283        //while(NULL != tempR->getRule()) {
     284        //    Print("ADDRESS OF RULE: %p\n",tempR->getRule());
     285        //    pWrite(tempR->getRuleTerm());
     286        //    Print("ADDRESS OF TERM: %p\n",tempR->getRuleTerm());
     287        //    Print("%d\n\n",tempR->getRuleIndex());
     288        //    tempR   =   tempR->getNext();
     289        //}
    358290        //Print("TESTED ELEMENT: ");
    359291        //pWrite(l->getPoly());
     
    420352=================================================================================================================
    421353*/
    422 bool criterion2(poly t, LPoly* l, RList* rules, Rule* testedRule) {
     354inline bool criterion2(poly t, LPoly* l, RList* rules, Rule* testedRule) {
    423355    //Print("------------------------------IN CRITERION 2-----------------------------------------\n");
    424356    //Print("LAST RULE TESTED: %p",testedRule);
     
    605537            //CList* newCritPairs = new CList;
    606538            //Print("##################IN CRITPAIRS IN REDUCTION#####################\n");
    607             criticalPairRed(gPrev,critPairs,lTag,rTag,rules);
     539            criticalPair(gPrev,critPairs,lTag,rTag,rules);
    608540            //Print("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++H I E R++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
    609541        }
     
    618550            //sleep(10);
    619551        }
     552       
    620553    }
    621554}   
     
    634567    do {
    635568        LNode* gPrevRedCheck    =   new LNode(lTag->getFirstCurrentIdx());
     569        //Print("gPrevCheckPOLY: ");
     570        //pWrite(gPrevRedCheck->getPoly());
    636571        LNode* tempRed          =   new LNode();
    637572        //Print("TESTED POLYNOMIAL IN THE FOLLOWING: ");
     
    689624        //Print("wieder hier2\n");
    690625                    rules->insert(tempRed->getIndex(),tempRed->getTerm());
     626                    pWrite(rules->getFirst()->getRuleTerm());
     627                    Print("DELETE TEMPRED\n");
    691628                    delete tempRed;
    692629                }
     
    780717        //pWrite(temp->getTerm());
    781718        //pWrite(t);
    782         //pWrite(l->getPoly());
    783719        //Print("HALLO\n");
    784720        if(pLmDivisibleByNoComp(temp->getPoly(),t)) {
     
    804740                    if(!criterion1(gPrev,u,temp,lTag)) {
    805741                            //Print("HIER DEBUG\n");
    806                             gPrevRedCheck   =   temp;
     742                            gPrevRedCheck   =   temp->getNext();
    807743                            LNode* redNode  =   new LNode(ppMult_qq(u,temp->getTerm()),temp->getIndex(),red,NULL,NULL);
    808744                            return redNode;
     
    833769*/
    834770ideal F5main(ideal id, ring r) {
    835     int i,j;
     771    int i,j,k,l;
    836772    int gbLength;
    837773    // 1 polynomial for defining initial labels & further tests
    838774    poly ONE = pOne();
     775    poly pOne   =   pOne();
     776    number nOne =   nInit(1);
    839777    // tag the first element of index i-1 for criterion 1
    840778    LTagList* lTag  =   new LTagList();
    841     //Print("LTAG BEGINNING: %p\n",lTag->getFirst());
     779    Print("LTAG BEGINNING: %p\n",lTag);
    842780   
    843781    // first element in rTag is first element of rules which is NULL RNode,
    844782    // this must be done due to possible later improvements
    845783    RList* rules    =   new RList();
     784    Print("RULES FIRST: %p\n",rules->getFirst());
    846785    RTagList* rTag  =   new RTagList(rules->getFirst());
    847786    i = 1;
     
    858797    ideal idNew     =   kInterRed(id);
    859798    id              =   idNew;
     799    qsortDegree(&id->m[0],&id->m[IDELEMS(id)-1]);
    860800    idShow(id);
    861     qsortDegree(&id->m[0],&id->m[IDELEMS(id)-1]);
    862801    LList* gPrev    =   new LList(ONE, i, id->m[0]);
    863802    //idShow(id);
     
    884823        //pWrite(gPrevTag->getPoly());
    885824        gPrev   =   F5inc(i, id->m[i-1], gPrev, gbPrev, ONE, lTag, rules, rTag);
     825       
    886826        // DEBUGGING STUFF
    887827        LNode* temp    =   gPrev->getFirst();
     
    889829        if(gPrev->getLength() > gbLength) {
    890830            ideal gbAdd =   idInit(gPrev->getLength()-gbLength,1);
    891         LNode*  temp    =   gPrevTag;
     831            LNode*  temp =   gPrevTag;
    892832        //Print("%p\n",gPrevTag);   
    893833        //Print("%p\n",gPrev->getLast());   
     
    895835        //Print("LENGTH OF GPREV LIST: %d\n",gPrev->getLength());
    896836        //Print("%d\n",gbLength);
    897         for(j=0;j<=gPrev->getLength()-gbLength-1;j++) {
    898             //Print("YES\n");
    899             temp        =   temp->getNext();
    900             gbAdd->m[j] =   temp->getPoly();
    901             //pWrite(temp->getPoly());
    902         }
    903         gbLength    =   gPrev->getLength();
    904         gbPrev  =   idAdd(gbPrev,gbAdd);
    905         }
    906         int anzahl  =   1;
     837        Print("%d\n",gPrev->getLength()-gbLength-1);
     838            for(j=0;j<=gPrev->getLength()-gbLength-1;j++) {
     839                Print("YES\n");
     840                temp        =   temp->getNext();
     841                if(temp) {
     842                    Print("%p\n",temp);
     843                    pWrite(temp->getPoly());
     844                    Print("%p\n",temp->getNext());
     845                }
     846                gbAdd->m[j] =   temp->getPoly();
     847                //pWrite(temp->getPoly());
     848            }
     849            Print("HIER AUCH\n");
     850            gbPrev          =   idAdd(gbPrev,gbAdd);
     851            // interreduction stuff
     852            /*
     853            if(i<IDELEMS(id)) {
     854                ideal tempId    =   kInterRed(gbPrev);
     855                gbPrev          =   tempId;
     856                qsortDegree(&gbPrev->m[0],&gbPrev->m[IDELEMS(gbPrev)-1]);
     857                delete gPrev;
     858                Print("RULES FIRST NOW1: %p\n",rules->getFirst());
     859                delete rules;
     860                Print("HIERLALA\n");
     861                LList* gPrev    =   new LList(pOne,1,gbPrev->m[0]);
     862                gPrev->insert(pOne,1,gbPrev->m[1]);
     863                poly tempPoly = pInit();
     864                pSetCoeff(tempPoly,nOne);
     865                pLcm(pHead(gbPrev->m[0]),pHead(gbPrev->m[1]),tempPoly);
     866                rules    =   new RList();
     867                rules->insert(2,tempPoly);
     868            pWrite(rules->getFirst()->getRuleTerm());
     869            Print("RULES FIRST NOW2: %p\n",rules->getFirst());
     870                for(k=2; k<IDELEMS(gbPrev); k++) {
     871                    gPrev->insert(pOne,k+1,gbPrev->m[k]);
     872                    for(l=0; l<k; l++) {
     873                        pLcm(pHead(gbPrev->m[k]),pHead(gbPrev->m[l]),tempPoly);
     874                        pSetCoeff(tempPoly,nOne);
     875                        rules->insert(k+1,tempPoly);
     876                    }
     877                }
     878            }
     879            */
     880            gbLength    =   gPrev->getLength();
     881
     882        }
     883        Print("%p\n",gPrev->getFirst());
     884        //gPrev->print();
     885        //int anzahl  =   1;
    907886        //while(NULL != temp) {
    908887        //    Print("%d. Element: ",anzahl);
     
    918897        //Print("JA\n");
    919898    }
     899        idShow(gbPrev);
    920900    Print("\n\nNumber of zero-reductions:  %d\n",reductionsToZero);
    921901    //LNode* temp    =   gPrev->getFirst();
     
    924904    //    temp    =   temp->getNext();
    925905    // }
    926     idShow(id);
    927906    //gPrev->print();
    928     //delete gPrev;
    929907    //delete lTag;
    930908    //delete rTag;
     909    //delete gPrev;
    931910    return(gbPrev);
    932911
  • kernel/f5gb.h

    rfcef59 r9cb4078  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5gb.h,v 1.31 2009-03-01 20:31:54 ederc Exp $ */
     4/* $Id: f5gb.h,v 1.32 2009-03-04 20:23:04 ederc Exp $ */
    55/*
    66* ABSTRACT: f5gb interface
     
    3535==================================================
    3636*/
    37 LList* F5inc(int i, poly f_i, LList* gPrev, ideal gbPrev, poly ONE, LTagList* lTag, RList* rules, RTagList* rTag);
     37inline LList* F5inc(int i, poly f_i, LList* gPrev, ideal gbPrev, poly ONE, LTagList* lTag, RList* rules, RTagList* rTag);
    3838
    3939/*
     
    4747
    4848/*
    49 ================================================================
    50 computes a list of critical pairs for the next reduction process
    51 first element in gPrev is always the newest element which must
    52 build critical pairs with all other elements in gPrev
    53 this is a special version for reduction() in which the first
    54 generator of the critical pair is not tested by criterion2()
    55 as there are no rules added until then to test for
    56 ================================================================
    57 */
    58 void criticalPairRed(LList* gPrev, CList* critPairs, LTagList* lTag, RTagList* rTag, RList* rules);
    59 
    60 /*
    6149========================================
    6250Criterion 1, i.e. Faugere's F5 Criterion
    6351========================================
    6452*/
    65 bool criterion1(LList* gPrev, poly t, LNode* l, LTagList* lTag);
     53inline bool criterion1(LList* gPrev, poly t, LNode* l, LTagList* lTag);
    6654
    6755/*
     
    7058=====================================
    7159*/
    72 bool criterion2(poly t, LNode* l, RList* rules, RTagList* rTag);
     60inline bool criterion2(poly t, LNode* l, RList* rules, RTagList* rTag);
    7361
    7462/*
     
    7765==========================================================================================================
    7866*/
    79 bool criterion2(poly t, LPoly* l, RList* rules, Rule* testedRule);
     67inline bool criterion2(poly t, LPoly* l, RList* rules, Rule* testedRule);
    8068
    8169/*
     
    8472==================================
    8573*/
    86 void computeSPols(CNode* first, RTagList* rTag, RList* rules, LList* sPolyList);
     74inline void computeSPols(CNode* first, RTagList* rTag, RList* rules, LList* sPolyList);
    8775
    8876/*
     
    9179========================================================================
    9280*/
    93 void reduction(LList* sPolyList, CList* critPairs, LList* gPrev, RList* rules, LTagList* lTag, RTagList* rTag,
     81inline void reduction(LList* sPolyList, CList* critPairs, LList* gPrev, RList* rules, LTagList* lTag, RTagList* rTag,
    9482                 ideal gbPrev);
    9583
     
    10088=====================================================================================
    10189*/
    102 void topReduction(LNode* l, LList* sPolyList, LList* gPrev, RList* rules, LTagList* lTag, RTagList* rTag, ideal gbPrev);
     90inline void topReduction(LNode* l, LList* sPolyList, LList* gPrev, RList* rules, LTagList* lTag, RTagList* rTag, ideal gbPrev);
    10391
    10492/*
     
    10795=====================================================================
    10896*/
    109 LNode* findReductor(LNode* l, LNode* gPrevRedCheck, LList* gPrev, RList* rules, LTagList* lTag,RTagList* rTag);
     97inline LNode* findReductor(LNode* l, LNode* gPrevRedCheck, LList* gPrev, RList* rules, LTagList* lTag,RTagList* rTag);
    11098
    11199/*
  • kernel/f5lists.cc

    rfcef59 r9cb4078  
    3030    next                =   NULL;
    3131}
    32  LNode::LNode(LPoly* lp) {
     32LNode::LNode(LPoly* lp) {
    3333    data                =   lp;
    3434    next                =   NULL;
     
    5353}
    5454
    55  LNode::LNode(LNode* ln) {
     55LNode::LNode(LNode* ln) {
    5656    data                =   ln->getLPoly();
    5757    next                =   ln->getNext();
     
    6060LNode::~LNode() {
    6161    //delete next;
     62    Print("DELETE LNODE\n");
    6263    delete data;   
    6364}
     
    7475// insert new elements to the list always at the end (labeled / classical polynomial view)
    7576// needed for list gPrev
    76 LNode* LNode::insert(LPoly* lp) {
     77inline LNode* LNode::insert(LPoly* lp) {
    7778    //Print("INSERTION: \n");
    7879    //Print("LAST GPREV: ");
    7980    //pWrite(this->getPoly());
    80 LNode* newElement   =   new LNode(lp, NULL);
     81    LNode* newElement   =   new LNode(lp, NULL);
    8182    this->next          =   newElement;
    8283    return newElement;
    8384}
    8485       
    85 LNode* LNode::insert(poly t, int i, poly p, Rule* r) {
     86inline LNode* LNode::insert(poly t, int i, poly p, Rule* r) {
    8687    LNode* newElement   =   new LNode(t, i, p, r, NULL);
    8788    this->next          =   newElement;
     
    9192// insert new elements to the list always in front (labeled / classical polynomial view)
    9293// needed for sPolyList
    93 LNode* LNode::insertSP(LPoly* lp) {
     94inline LNode* LNode::insertSP(LPoly* lp) {
    9495    LNode* newElement   =   new LNode(lp, this);
    9596    //Print("INSERTED IN SPOLYLIST: ");
     
    9899}
    99100       
    100 LNode* LNode::insertSP(poly t, int i, poly p, Rule* r) {
     101inline LNode* LNode::insertSP(poly t, int i, poly p, Rule* r) {
    101102    LNode* newElement   =   new LNode(t, i, p, r, this);
    102103     //Print("INSERTED IN SPOLYLIST: ");
     
    106107// insert new elemets to the list w.r.t. increasing labels
    107108// only used for the S-polys to be reduced (TopReduction building new S-polys with higher label)
    108 LNode* LNode::insertByLabel(poly t, int i, poly p, Rule* r) {
     109inline LNode* LNode::insertByLabel(poly t, int i, poly p, Rule* r) {
    109110    //Print("ADDING SOLYS TO THE LIST\n");
    110111    //Print("new element: ");
     
    264265        first   =   first->getNext();
    265266        delete  temp;
     267        Print("%p\n",first);
    266268    }
    267269}
     
    480482
    481483CNode::~CNode() {
    482     delete next;
    483484    delete data;
    484485}
     
    699700
    700701CList::~CList() {
    701     delete first;
     702    CNode* temp;
     703    while(first) {
     704        temp    =   first;
     705        first   =   first->getNext();
     706        delete  temp;
     707    }
    702708}
    703709
     
    740746
    741747RNode::~RNode() {
    742     delete  next;
     748    Print("DELETE RULE\n");
    743749    delete  data;
    744750}
     
    787793
    788794RList::~RList() {
    789     delete first;
    790 }
     795    RNode* temp;
     796    Print("%p\n",first);
     797    while(first->getRule()) {
     798        temp    =   first;
     799        first   =   first->getNext();
     800        Print("1 %p\n",first);
     801        if(first) {
     802            Print("2 %p\n",first->getNext());
     803            //Print("3 %p\n",first->getNext()->getRuleTerm());
     804        }
     805        delete  temp;
     806    }
     807    Print("FERTIG\n");
     808}
    791809
    792810void RList::insert(int i, poly t) {
     
    828846
    829847RTagNode::~RTagNode() {
    830     delete next;
    831848    delete data;   
    832849}
     
    842859RNode* RTagNode::getRNode() {
    843860    return this->data;
     861}
     862
     863RTagNode* RTagNode::getNext() {
     864    return next;
    844865}
    845866
     
    900921
    901922RTagList::~RTagList() {
    902     delete first;
     923    RTagNode* temp;
     924    while(first) {
     925        temp    =   first;
     926        first   =   first->getNext();
     927        delete  temp;
     928    }
    903929}
    904930
  • kernel/f5lists.h

    rfcef59 r9cb4078  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5lists.h,v 1.13 2009-03-01 20:31:55 ederc Exp $ */
     4/* $Id: f5lists.h,v 1.14 2009-03-04 20:23:05 ederc Exp $ */
    55/*
    66* ABSTRACT: list interface
     
    304304        RTagNode*   insert(RNode* r);
    305305        RNode*      getRNode();
     306        RTagNode*   getNext();
    306307        RNode*      get(int idx, int length);
    307308        void        set(RNode*);
Note: See TracChangeset for help on using the changeset viewer.