Changeset 7c81165 in git for kernel/f5lists.cc


Ignore:
Timestamp:
Mar 12, 2009, 10:43:53 AM (14 years ago)
Author:
Christian Eder
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
75e2e50e5ba0dbb6681ecbf8664330997a24b5e9
Parents:
47ca23dae2b0131537f61842055e75beb7836f77
Message:
updated list of critical pairs, thrown away some useless data


git-svn-id: file:///usr/local/Singular/svn/trunk@11555 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/f5lists.cc

    r47ca23 r7c81165  
    489489// working only with linked, but not doubly linked lists due to memory usage we have to check the
    490490// insertion around the first element separately from the insertion around all other elements in the list
    491 CNode* CNode::insert(CPair* c, CNode* last) {
    492     if(NULL == this->data) {
     491CNode* CNode::insert(CPair* c) {
     492    if(NULL == this) {
    493493        CNode* newElement   =   new CNode(c, this);
    494494        return newElement;
     
    511511                //Print("Insert Deg\n");
    512512                CNode* temp = this;
    513                 while(  NULL != temp->next->data ) {
     513                while(  NULL != temp->next) {
    514514                    if(temp->next->data->getDeg() == c->getDeg() ) {
    515515                        if(1 == pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),temp->next->data->getLp1Term()))) {
     
    528528                    }
    529529                }
    530                 CNode* newElement   =   new CNode(c, last);
     530                CNode* newElement   =   new CNode(c, NULL);
    531531                temp->next          =   newElement;
    532532                return this;
     
    535535        if( c->getDeg() > this->data->getDeg() ) { // greater degree than the first list element
    536536            CNode* temp =   this;
    537             while( NULL != temp->next->data ) {   
     537            while( NULL != temp->next ) {   
    538538                if( c->getDeg() < temp->next->data->getDeg() ) {
    539539                    CNode* newElement   =   new CNode(c, temp->next);
     
    549549                    else {
    550550                        temp = temp->next;
    551                         while(  NULL != temp->next->data ) {
     551                        while(  NULL != temp->next ) {
    552552                            if( temp->next->data->getDeg() == c->getDeg() ) {
    553553                                if(1 == pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),
     
    567567                            }
    568568                        }
    569                         CNode* newElement   =   new CNode(c, last);
     569                        CNode* newElement   =   new CNode(c, NULL);
    570570                        temp->next          =   newElement;
    571571                        return this;
     
    576576                }
    577577            }
    578             CNode* newElement   =   new CNode(c, last);
     578            CNode* newElement   =   new CNode(c, NULL);
    579579            temp->next          =   newElement;
    580580            return this;
     
    586586CNode* CNode::getMinDeg() {
    587587    CNode* temp = this;
    588     while( NULL != temp->data ) {
    589         while(NULL != temp->next->data && temp->next->data->getDeg() == this->data->getDeg()) {
     588    while(NULL != temp) {
     589        while(NULL != temp->next && temp->next->data->getDeg() == this->data->getDeg()) {
    590590            temp = temp->next;
    591591        }
     
    593593        // every CList should end with a (NULL,NULL) element for a similar behaviour
    594594        // using termination conditions throughout the algorithm
    595         temp->next          =   new CNode();
     595        temp->next          =   NULL;
    596596        return returnCNode;
    597597    }
     
    663663    CNode* temp = this;
    664664    Print("___________________List of critical pairs______________________:\n");
    665     while(NULL != temp->data) {
     665    while(NULL != temp) {
    666666        Print("LP1 Index: %d\n",temp->getLp1Index());
    667667        Print("T1: ");
     
    690690// for initialization of CLists, last element alwas has data=NULL and next=NULL
    691691CList::CList() {
    692     first   =   new CNode();
    693     last    =   first;
     692    first   =   NULL;
    694693}
    695694
    696695CList::CList(CPair* c) {
    697696    first   =   new CNode(c);
    698     last    =   first;
    699697}
    700698
    701699CList::~CList() {
    702700    CNode* temp;
    703     while(first) {
     701    while(NULL != first) {
    704702        temp    =   first;
    705703        first   =   first->getNext();
     
    711709// note: as all critical pairs have the same index here, the second sort is done on the terms of the labels
    712710void CList::insert(CPair* c) {
    713     first = first->insert(c, last);
     711    first = first->insert(c);
    714712}
    715713
Note: See TracChangeset for help on using the changeset viewer.