Changeset 71f00c5 in git


Ignore:
Timestamp:
Dec 27, 2008, 2:50:06 PM (14 years ago)
Author:
Christian Eder
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
Children:
4a0a4b8836ea17f984b15b03caab5ab09f76ada1
Parents:
db0c26499ac93c779f02182a98792ec615793f61
Message:
lists updated


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

Legend:

Unmodified
Added
Removed
  • kernel/f5gb.cc

    rdb0c264 r71f00c5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5gb.cc,v 1.14 2008-12-26 13:49:29 ederc Exp $ */
     4/* $Id: f5gb.cc,v 1.15 2008-12-27 13:50:05 ederc Exp $ */
    55/*
    66* ABSTRACT: f5gb interface
     
    2727
    2828/*
    29 =======================
    30 static/global variables
    31 =======================
    32 */
    33 static poly ONE = one_poly();
    34 
    35 
    36 /*
    3729================================================
    3830computation of ONE polynomial as global variable
     
    4436    return one;
    4537}
     38
     39
    4640
    4741/*
     
    8680==================================================
    8781*/
    88  
    89 LList* F5inc(long i, poly* f_i, LList* g_prev) {
     82LList* F5inc(long* i, poly* f_i, LList* g_prev) {
     83    poly one = pInit();
     84    pSetCoeff(one, nInit(1));
     85    static poly ONE = one;
     86    //poly ONE = pOne();
    9087    LList* g_curr       =   g_prev;
    9188    LNode* prev_last    =   g_prev->getLast(); //tags the end of g_prev->only 1 list for g_prev & g_curr
    92     g_curr->append(&ONE,&i,f_i);
     89    g_curr->append(&ONE,i,f_i);
    9390   
    9491    return g_curr;
    95 
    96 
    97 
    98 
    9992}
    10093
     
    10598*/
    10699ideal F5main(ideal id, ring r) {
     100   
     101    static poly ONE = pOne();
    107102    long i,j;
    108     LPoly* lp = new LPoly;
     103
    109104    // definition of one-polynomial as global constant ONE
    110105    //poly one = pInit();
     
    130125    //lp->setTerm(&ONE);
    131126    //lp->setPoly(&id->m[0]);
    132     //lp->set(ONE,1,ONE);   
    133     /* if(generate_input_list(lp,iTmp,ONE)) {
    134             Print("One Polynomial in Input => Computations stopped");
    135             iTmp = idInit(1,0);
    136             iTmp->m[0] = ONE;
    137             return(iTmp);
    138     }
    139     */
     127    LPoly* lp = new LPoly(&ONE,&i,&ONE);   
     128   
    140129    // only for debugging
    141     long k = 1;
    142     LList* g_prev = new LList(lp);
    143     //LList* g_curr = new LList;
    144     //LNode* current = new LNode;
    145     g_prev->append(&ONE,&k,&id->m[2]);
     130    long k = 2;
     131    LList* g_prev = new LList(&ONE,&k,&id->m[2]);
     132    LNode* current;
     133    LPoly* lp2  = new LPoly(&ONE,&k,&ONE);   
     134    //LList* g_curr = new LList(lp);
     135    k = 134;
     136    g_prev->append(&ONE,&k,&id->m[3]);
     137    g_prev->append(&ONE,&k,&id->m[3]);
     138    g_prev->append(lp2);
     139    g_prev->append(lp2);
     140    g_prev->append(lp);
     141    g_prev->append(&ONE,&k,&id->m[1]);
     142    g_prev->append(&ONE,&k,&id->m[3]);
     143    g_prev->append(lp2);
    146144    i = g_prev->getLength();
    147145    Print("%ld\n\n",i);
    148     LPoly* current = g_prev->getFirst()->getLPoly();
    149     if(pComparePolys(current->getPoly(), id->m[0])) {
    150         Print("Yes!\n");
     146    current = g_prev->getFirst();
     147    while(NULL != current) {
     148    Print("Index: %ld\n",*(current->getLPoly()->getIndex()));
     149    Print("Pointer comparison: %p , %p\n\n",g_prev->getFirst(),current);
     150    current = current->getNext();
    151151    }
    152     //current = g_prev->getFirst();
    153     //current++;
    154     //Print("Term: %ld\n\n",current->get()->getTerm);
    155     /*for(i=2; i<IDELEMS(id); i++) {
    156         g_curr = F5inc(i,g_prev);
    157         if(g_curr->poly_test(ONE)) {
    158             Print("One Polynomial in Input => Computations stopped\n");
    159             ideal id_new = idInit(1,1);
    160             id_new->m[0] = ONE;
    161             return(id_new);               
    162         }
    163     }
    164     */       
     152    //for(i=2; i<IDELEMS(id); i++) {
     153        //g_curr = F5inc(&i,&id->m[i],g_prev);
     154        //if(g_curr->polyTest(&ONE)) {
     155        //    Print("One Polynomial in Input => Computations stopped\n");
     156         //   ideal id_new = idInit(1,1);
     157        //    id_new->m[0] = ONE;
     158        //    return(id_new);               
     159        //}
     160    //}
    165161    return(id);
    166162
     
    168164}
    169165
    170 
    171166#endif
  • kernel/f5gb.h

    rdb0c264 r71f00c5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5gb.h,v 1.13 2008-12-26 13:49:57 ederc Exp $ */
     4/* $Id: f5gb.h,v 1.14 2008-12-27 13:50:05 ederc Exp $ */
    55/*
    66* ABSTRACT: f5gb interface
     
    5555ideal F5main(ideal i, ring r);
    5656
    57 
    5857#endif
    5958#endif
    60 
  • kernel/lists.h

    rdb0c264 r71f00c5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: lists.h,v 1.1 2008-12-26 13:51:10 ederc Exp $ */
     4/* $Id: lists.h,v 1.2 2008-12-27 13:50:05 ederc Exp $ */
    55/*
    66* ABSTRACT: list interface
     
    4141        LNode* next;
    4242    public:
    43         LNode(LPoly* lp, LNode* n) {
    44             data = lp;
    45             next = n;
    46         }
    47         LNode(poly* t, long* i, poly* p, LNode* n) {
    48             data->set(t,i,p);
    49             next = n;
    50         }
    51         ~LNode() {
    52             delete next;
    53             delete data;   
    54         }
    55         LNode* append(LPoly* lp) {
    56             LNode* new_element = new LNode(lp,NULL);
    57             next = new_element;
    58             return new_element;
    59         }
    60         LNode* append(poly* t, long* i, poly* p) {
    61             LNode* new_element = new LNode(t,i,p,NULL);
    62             next = new_element;
    63             return new_element;
    64         }
    65         LPoly* getLPoly() const {
    66             return data;
    67         }
     43        // generating new list elements from the labeled / classical polynomial view
     44                LNode(LPoly* lp);
     45                LNode(poly* t, long* i, poly* p);
     46                LNode(LNode* ln);
     47                ~LNode();
     48        // append new elements to the list from the labeled / classical polynomial view
     49        LNode*  append(LPoly* lp);
     50        LNode*  append(poly* t, long* i, poly* p);
     51        // get next from current LNode
     52        LNode*  getNext();
     53       
     54        // get the LPoly* out of LNode*
     55        LPoly*  getLPoly();
     56        // get the address of the polynomial part of LPoly* of LNode*
     57        poly*   getPoly();
     58        // test if for any list element the polynomial part of the data is equal to *p
     59        bool    polyTest(poly* p);
     60        LNode*  operator++();
    6861};
    6962
     
    8073        long    length;
    8174    public:
    82         LList(LPoly* lp) {
    83             first = new LNode(lp,NULL);
    84             last = first;
    85             length = 1;
    86         }
    87         ~LList() {
    88             delete first;
    89         }
    90         void append(LPoly* lp) {
    91             last = last->append(lp);
    92             length++;
    93         }
    94         void append(poly* t,long* i, poly* p) {
    95             last = last->append(t,i,p);
    96             length++;
    97         }
    98         long getLength() const {
    99             return length;
    100         }
    101         LNode* getFirst() const {
    102             return first;
    103         }
    104         LNode* getLast() const {
    105             return last;
    106         }
     75                LList(LPoly* lp);
     76                LList(poly* t,long* i,poly* p);
     77                ~LList();
     78        void    append(LPoly* lp);
     79        void    append(poly* t,long* i, poly* p);
     80        bool    polyTest(poly* p);
     81        long    getLength() const;
     82        LNode*  getFirst();
     83        LNode*  getLast();
    10784};
    10885
     
    188165        }
    189166};
    190 
    191 
    192 
    193 
    194167#endif
    195168#endif
    196  
  • kernel/lpolynomial.cc

    rdb0c264 r71f00c5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: lpolynomial.cc,v 1.3 2008-12-26 13:51:50 ederc Exp $ */
     4/* $Id: lpolynomial.cc,v 1.4 2008-12-27 13:50:06 ederc Exp $ */
    55/*
    66* ABSTRACT: lpolynomial definition
     
    3030================================================================
    3131*/
    32 void LPoly::setPoly(poly* p)
    33 {
     32LPoly::LPoly(poly* t,long* i,poly* p) {
     33    set(t,i,p);
     34}
     35void LPoly::setPoly(poly* p)  {
    3436    polynomial = *p;
    3537}
     
    4850}
    4951
    50 poly LPoly::getPoly() const {
    51     return polynomial;
     52poly* LPoly::getPoly() {
     53    return &polynomial;
    5254}
    5355
    54 poly LPoly::getTerm() const {
    55     return term;
     56poly* LPoly::getTerm() {
     57    return &term;
    5658}
    5759
    58 long LPoly::getIndex() const {
    59     return index;
     60long* LPoly::getIndex() {
     61    return &index;
    6062}
    6163
     
    7072}
    7173
    72 /*
    73 =====================================================
    74 comparing two labeled polynomials by their signatures
    75 =====================================================
    76 */
    77 int LPoly::compare(const LPoly& lp) const {
    78     if(index > lp.index) {
    79         return 1;
    80     }
    81     if(index < lp.index) {
    82         return -1;
    83     }
    84     return 0;
    85 }
    86 
    8774LPoly* LPoly::get() {
    8875    return this;
  • kernel/lpolynomial.h

    rdb0c264 r71f00c5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: lpolynomial.h,v 1.3 2008-12-26 13:52:15 ederc Exp $ */
     4/* $Id: lpolynomial.h,v 1.4 2008-12-27 13:50:06 ederc Exp $ */
    55/*
    66* ABSTRACT: labeled polynomial interface
     
    1717=============================
    1818*/
    19 class LPoly
    20 {
    21         private:
    22                 poly    term; //term of signature
    23                 long    index; //index of signature
    24                 poly    polynomial; //standard polynomial data
    25                 bool    del; //for deletion in TopReduction Subalgorithm
    26         public:
    27                 void    setPoly(poly* p);
    28                 poly    getPoly() const;
    29                 void    setTerm(poly* t);
    30                 poly    getTerm() const;
    31                 void    setIndex(long* i);
    32                 long    getIndex() const;
    33                 void    setDel(bool b);
    34                 bool    getDel() const;
    35                 int     compare(const LPoly& lp) const;
    36                 void    set(poly* t, long* i, poly* p);
    37                 LPoly*  get();
     19class LPoly {
     20    private:
     21        poly    term; //term of signature
     22        long    index; //index of signature
     23        poly    polynomial; //standard polynomial data
     24        bool    del; //for deletion in TopReduction Subalgorithm
     25    public:
     26                LPoly(poly*t,long* i,poly* p);
     27        void    setPoly(poly* p);
     28        poly*   getPoly();
     29        void    setTerm(poly* t);
     30        poly*   getTerm();
     31        void    setIndex(long* i);
     32        long*   getIndex();
     33        void    setDel(bool b);
     34        bool    getDel() const;
     35        void    set(poly* t, long* i, poly* p);
     36        LPoly*  get();
    3837};
    3938
     
    4443===============================
    4544*/
    46 struct CPair
    47 {
    48         LPoly*  cp1;   // first  component
    49         LPoly*  cp2;   // second component
     45struct CPair {
     46    LPoly*  cp1;   // first  component
     47    LPoly*  cp2;   // second component
    5048};
    5149
Note: See TracChangeset for help on using the changeset viewer.