Changeset a41f3aa in git


Ignore:
Timestamp:
Feb 3, 2009, 9:55:43 PM (15 years ago)
Author:
Christian Eder
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
8978fd7ad0324e27b4bd0928f5d34e5455656098
Parents:
24d83d8a13d3531edee62ee0b18e34b0255301d7
Message:
criterion1() and criterion2() done, changed rules(added pointer on LPoly generating this rule)


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

Legend:

Unmodified
Added
Removed
  • kernel/f5data.cc

    r24d83d ra41f3aa  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5data.cc,v 1.1 2009-01-30 17:27:20 ederc Exp $ */
     4/* $Id: f5data.cc,v 1.2 2009-02-03 20:55:43 ederc Exp $ */
    55/*
    66* ABSTRACT: lpolynomial definition
     
    147147    return *term;
    148148}
     149
     150LPoly* Rule::getOrigin() {
     151    return origin;
     152}
    149153#endif
  • kernel/f5data.h

    r24d83d ra41f3aa  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5data.h,v 1.1 2009-01-30 17:27:20 ederc Exp $ */
     4/* $Id: f5data.h,v 1.2 2009-02-03 20:55:43 ederc Exp $ */
    55/*
    66* ABSTRACT: labeled polynomial interface
     
    4747
    4848/*
    49 ========================================================
    50 structure of rules(i.e. already computed / known labels)
    51 ========================================================
    52 */
    53 class Rule {
    54     private:
    55         int*     index;    // index of the labeled polynomial the rule comes from
    56         poly*    term;     // term of the labeled polynomial the rule comes from
    57     public:
    58                 Rule(int* i, poly* term);
    59         int     getIndex();
    60         poly    getTerm();
    61 };
    62 
    63 
    64 /*
    6549===================================
    6650structure of labeled critical pairs
     
    8973};
    9074
     75
     76/*
     77========================================================
     78structure of rules(i.e. already computed / known labels)
     79========================================================
     80*/
     81class Rule {
     82    private:
     83        int*    index;      // index of the labeled polynomial the rule comes from
     84        poly*   term;       // term of the labeled polynomial the rule comes from
     85        LPoly*  origin;     // pointer of the LPoly which generated this rule (needed in criterion2())
     86    public:
     87                Rule(int* i, poly* term);
     88        int     getIndex();
     89        poly    getTerm();
     90        LPoly*  getOrigin();
     91};
    9192#endif
    9293#endif
  • kernel/f5gb.cc

    r24d83d ra41f3aa  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5gb.cc,v 1.20 2009-01-30 17:25:04 ederc Exp $ */
     4/* $Id: f5gb.cc,v 1.21 2009-02-03 20:55:43 ederc Exp $ */
    55/*
    66* ABSTRACT: f5gb interface
     
    6767==================================================
    6868*/
    69 LList* F5inc(int* i, poly* f_i, LList* gPrev, poly* ONE, RList* rules, LTagList* lTag) {
     69LList* F5inc(int* i, poly* f_i, LList* gPrev, poly* ONE) {
     70    // tag the first element of index i-1 for criterion 1
     71    LTagList* lTag  =   new LTagList(gPrev->getFirst());
     72    // first element in rTag is NULL, this must be done due to possible later improvements
     73    RTagList* rTag  =   new RTagList();
    7074    gPrev->insert(ONE,i,f_i);
    7175    CList* critPairs    =   new CList();
    72     critPairs           =   criticalPair(gPrev, critPairs, rules, lTag);
     76    critPairs           =   criticalPair(gPrev, critPairs, lTag, rTag);
    7377   
    7478    return gPrev;
     
    8387================================================================
    8488*/
    85 CList* criticalPair(LList* gPrev, CList* critPairs, RList* rules, LTagList* lTag) {
     89CList* criticalPair(LList* gPrev, CList* critPairs, LTagList* lTag, RTagList* rTag) {
    8690    // initialization for usage in pLcm()
    8791    number nOne         =   nInit(1);
     
    105109        // testing both new labels by the F5 Criterion
    106110        if(!criterion1(u1, first, lTag) && !criterion1(u2, l, lTag) &&
    107            !criterion2(u1, first, rules) && !criterion2(u2, l, rules)) {
     111           !criterion2(u1, first, rTag) && !criterion2(u2, l, rTag)) {
    108112            Print("Criteria passed\n");
    109113            // if they pass the test, add them to CList critPairs, having the LPoly with greater
     
    141145*/
    142146bool criterion1(poly* t, LNode* l, LTagList* lTag) {
    143     // start at the previously added element to gPrev, as all other elements will have the same index for sure
     147    // starts at the first element in gPrev with index = (index of l)-1, these tags are saved in lTag
    144148    LNode* testNode =   lTag->get(l->getIndex());
    145149    // save the monom t1*label_term(l) as it is tested various times in the following
    146150    poly u1 = ppMult_qq(*t,l->getTerm());
    147151    while(NULL != testNode) {
    148         //while(NULL != testNode && testNode->getIndex() == l->getIndex()) {
    149         //    testNode = testNode->getNext();
    150         //}
    151         Print("%d\n", pLmDivisibleByNoComp(pHead(testNode->getPoly()),u1));
    152         if(NULL != testNode && pLmDivisibleByNoComp(pHead(testNode->getPoly()),u1)) {
     152        if(pLmDivisibleByNoComp(pHead(testNode->getPoly()),u1)) {
    153153            return true;
    154154        }
    155155        testNode    =   testNode->getNext();
    156        
    157     }
    158     // 25/01/2009: TO DO -> change return value, until now no element is added to CList!
     156    }
    159157    return false;
    160158}
     
    165163=====================================
    166164*/
    167 bool criterion2(poly* t, LNode* l, RList* rules) {
     165bool criterion2(poly* t, LNode* l, RTagList* rTag) {
    168166    // start at the previously added element to gPrev, as all other elements will have the same index for sure
    169     RNode* testNode =   rules->getFirst();
    170     while(NULL != testNode->getRule()) {
    171         while(NULL != testNode->getRule() && testNode->getRuleIndex() == l->getIndex()) {
    172             testNode = testNode->getNext();
    173         }
    174         if(NULL != testNode->getRule() &&
    175            pLmDivisibleByNoComp(ppMult_qq(*t,l->getTerm()),testNode->getRuleTerm())) {
     167    RNode* testNode =   rTag->get(l->getIndex());
     168    // save the monom t1*label_term(l) as it is tested various times in the following
     169    poly u1 = ppMult_qq(*t,l->getTerm());
     170    // first element added to rTag was NULL, check for this
     171    Print("Hier1\n");
     172    while(NULL != testNode && testNode->getRule()->getOrigin() != l->getLPoly()) {
     173        Print("Hier2\n");
     174        if(pLmDivisibleByNoComp(ppMult_qq(*t,l->getTerm()),testNode->getRuleTerm())) {
    176175            return true;
    177176        }
    178177        testNode    =   testNode->getNext();
    179        
    180     }
    181     // 25/01/2009: TO DO -> change return value, until now no element is added to CList!
    182    
     178    }
    183179    return false;
    184180}
     
    198194    i = 1;
    199195    LList* gPrev    =   new LList( &ONE, &i, &id->m[0]);
    200     LTagList* lTag  =   new LTagList(gPrev->getFirst());
    201196    poly* lcm = new poly;
    202197    // initialization for usage in pLcm()
     
    231226    pWrite(q);
    232227    for(i=2; i<=IDELEMS(id); i++) {
    233         gPrev   =   F5inc(&i, &id->m[i-1], gPrev, &ONE, rules, lTag);
    234         lTag->insert(gPrev->getFirst());
     228        gPrev   =   F5inc(&i, &id->m[i-1], gPrev, &ONE);
    235229        Print("JA\n");
    236230    }
  • kernel/f5gb.h

    r24d83d ra41f3aa  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5gb.h,v 1.19 2009-01-30 17:25:04 ederc Exp $ */
     4/* $Id: f5gb.h,v 1.20 2009-02-03 20:55:43 ederc Exp $ */
    55/*
    66* ABSTRACT: f5gb interface
     
    3535==================================================
    3636*/
    37 LList* F5inc(int* i, poly* f_i, LList* gPrev, poly* ONE, RList* rules, LTagList* lTag);
     37LList* F5inc(int* i, poly* f_i, LList* gPrev, poly* ONE);
    3838
    3939/*
     
    4444================================================================
    4545*/
    46 CList* criticalPair(LList* gPrev, CList* critPairs, RList* rules, LTagList* lTag);
     46CList* criticalPair(LList* gPrev, CList* critPairs, LTagList* lTag, RTagList* rTag);
    4747
    4848/*
     
    5858=====================================
    5959*/
    60 bool criterion2(poly* t, LNode* l, RList* rules);
     60bool criterion2(poly* t, LNode* l, RTagList* rTag);
    6161
    6262/*
  • kernel/f5lists.cc

    r24d83d ra41f3aa  
    557557*/
    558558
     559RTagNode::RTagNode() {
     560    data = NULL;
     561    next = NULL;
     562}
     563 
    559564RTagNode::RTagNode(RNode* r) {
    560565    data = r;
     
    588593//       the element on position length-idx+1 is the right one
    589594RNode* RTagNode::get(int idx, int length) {
    590     if(idx == 1) {
     595    if(idx==1 || idx==0) {
    591596        return NULL;
    592597    }
     
    594599        int j;
    595600        RTagNode* temp = this;
    596         for(j=1;j<=length-idx+1;j++) {
     601        for(j=1; j<=length-idx+1; j++) {
    597602            temp = temp->next;
    598603        }
     
    607612=======================================
    608613*/
     614
     615RTagList::RTagList() {
     616    RTagNode* first =   new RTagNode();
     617    length          =   0;
     618}
    609619
    610620RTagList::RTagList(RNode* r) {
  • kernel/f5lists.h

    r24d83d ra41f3aa  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5lists.h,v 1.3 2009-01-30 17:25:04 ederc Exp $ */
     4/* $Id: f5lists.h,v 1.4 2009-02-03 20:55:43 ederc Exp $ */
    55/*
    66* ABSTRACT: list interface
     
    231231        RTagNode*   next;
    232232    public:
    233         RTagNode(RNode* r);
    234         RTagNode(RNode* r, RTagNode* n);
    235         ~RTagNode();
     233                    RTagNode();
     234                    RTagNode(RNode* r);
     235                    RTagNode(RNode* r, RTagNode* n);
     236                    ~RTagNode();
    236237        // declaration with first as parameter due to sorting of LTagList
    237238        RTagNode*   insert(RNode* r);
     
    251252        int         length;
    252253    public:
     254                RTagList();
    253255                RTagList(RNode* r);
    254256                ~RTagList();
Note: See TracChangeset for help on using the changeset viewer.