source: git/kernel/f5lists.h @ 0fb5d0c

fieker-DuValspielwiese
Last change on this file since 0fb5d0c was 599326, checked in by Kai Krüger <krueger@…>, 14 years ago
Anne, Kai, Frank: - changes to #include "..." statements to allow cleaner build structure - affected directories: omalloc, kernel, Singular - not yet done: IntergerProgramming git-svn-id: file:///usr/local/Singular/svn/trunk@13032 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 10.4 KB
RevLine 
[d72b11]1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
[341696]4/* $Id$ */
[d72b11]5/*
6* ABSTRACT: list interface
7*/
[599326]8#include <kernel/f5data.h>
[ae5177]9#ifndef F5LISTS_HEADER
10#define F5LISTS_HEADER
[d72b11]11
[ae5177]12#ifdef HAVE_F5
[d72b11]13/*
[a0350e9]14============================
15============================
16classes for lists used in F5
17============================
18============================
[d72b11]19*/
[ab76b4]20class PNode;
21class PList;
[d72b11]22class LNode;
23class LList;
[66e7b5]24class LTagNode;
25class LTagList;
[a0350e9]26class CNode;
[0179d5]27class CListOld;
[cce6ed3]28class RList;
29class RNode;
[66e7b5]30class RTagNode;
31class RTagList;
32
[d72b11]33
[ab76b4]34/**
35 * class PNode of nodes of polynomials
36 */
37class PNode {
38  private: 
39    poly   data;
40    PNode*  next;
41  public:
42    PNode(poly p, PNode* n);
43    poly getPoly();
44    PNode* getNext();
45    PNode* insert(poly p);
46};
47
48/**
49 * class PList of lists of PNodes
50 */
51class PList {
52  private:
53    PNode* first;
54  public:
55    PList();
56    void insert(poly p);
57    bool check(poly p);
58    void print();
59}; 
60   
[d72b11]61/*
62=======================================
[a05c71]63class LNode (nodes for lists of LPolyOlds)
[d72b11]64=======================================
65*/
66class LNode {
67    private:
[a05c71]68        LPolyOld*  data;
[87beab7]69        LNode*  next;
[d72b11]70    public:
[71f00c5]71        // generating new list elements from the labeled / classical polynomial view
[9bb97e]72                LNode();
[a05c71]73                LNode(LPolyOld* lp);
74                LNode(LPolyOld* lp, LNode* l);
75                LNode(poly t, int i, poly p, RuleOld* r=NULL);
76                LNode(poly t, int i, poly p, RuleOld* r, LNode* l);
[71f00c5]77                LNode(LNode* ln);
78                ~LNode();
[338842d]79        void    deleteAll();
[d51339]80        // insert new elements to the list at the end from the labeled / classical polynomial view
81        // needed for gPrev
[a05c71]82        LNode*  insert(LPolyOld* lp);
83        LNode*  insert(poly t, int i, poly p, RuleOld* r);
84        LNode*  insertByDeg(LPolyOld* lp);
[d51339]85        // insert new elements to the list in front from the labeled / classical polynomial view
86        // needed for sPolyList
[a05c71]87        LNode*  insertSP(LPolyOld* lp);
88        LNode*  insertSP(poly t, int i, poly p, RuleOld* r);
[cce6ed3]89        // insert new elements to the list with resp. to increasing labels
90        // only used for the S-polys to be reduced (TopReduction building new S-polys with higher label)
[a05c71]91        LNode*  insertByLabel(poly t, int i, poly p, RuleOld* r);
[e90881]92        LNode*  insertByLabel(LNode* l);
[f16a76d]93        LNode*  insertFirst(LNode* l);
[cce6ed3]94        // deletes the first elements of the list with the same degree
[d51339]95        // get next & prev from current LNode
[71f00c5]96        LNode*  getNext();
[d51339]97        LNode*  getPrev();
[0179d5]98        // only used for the S-polys, which are already sorted by increasing degree by CListOld
[cce6ed3]99        LNode*  deleteByDeg();
[a05c71]100        // get the LPolyOld* out of LNode*
101        LPolyOld*  getLPolyOld();
102        // get the data from the LPolyOld saved in LNode
[66e7b5]103        poly    getPoly();
104        poly    getTerm();
[9bb97e]105        int     getIndex(); 
[a05c71]106        RuleOld*   getRuleOld();
[e90881]107        bool    getDel();
[a05c71]108        // set the data from the LPolyOld saved in LNode
[9bb97e]109        void    setPoly(poly p);
110        void    setTerm(poly t);
111        void    setIndex(int i);
[61944d0]112        void    setNext(LNode* l);
[a05c71]113        void    setRuleOld(RuleOld* r);
[e90881]114        void    setDel(bool d);
[71f00c5]115        // test if for any list element the polynomial part of the data is equal to *p
116        bool    polyTest(poly* p);
[cce6ed3]117        LNode*  getNext(LNode* l);
[d51339]118        void    print();
[e90881]119        int     count(LNode* l);
[d72b11]120};
121
122
123/*
124============================
[a05c71]125class LList(lists of LPolyOlds)
[d72b11]126============================
127*/
128class LList {
129    private:
130        LNode*  first;
[416ea2]131        LNode*  last;
[9bb97e]132        int     length;
[d72b11]133    public:
[9bb97e]134                LList();
[a05c71]135                LList(LPolyOld* lp);
136                LList(poly t,int i,poly p, RuleOld* r = NULL);
[71f00c5]137                ~LList();
[d51339]138        // insertion at the end of the list
139        // needed for gPrev
[a05c71]140        void    insert(LPolyOld* lp);
141        void    insert(poly t,int i, poly p, RuleOld* r = NULL);
142        void    insertByDeg(LPolyOld* lp);
[667a9c]143        // insertion in front of the list
[d51339]144        // needed for sPolyList
[a05c71]145        void    insertSP(LPolyOld* lp);
146        void    insertSP(poly t,int i, poly p, RuleOld* r = NULL);
147        void    insertByLabel(poly t, int i, poly p, RuleOld* r = NULL);
[87beab7]148        void    insertByLabel(LNode* l);
[f16a76d]149        void    insertFirst(LNode* l);
[cce6ed3]150        void    deleteByDeg();
[71f00c5]151        bool    polyTest(poly* p);
[416ea2]152        LNode*  getFirst();
153        LNode*  getLast();
[9bb97e]154        int     getLength();
[fcb8022]155        void    setFirst(LNode* l);
[d51339]156        void    print();
[e90881]157        int     count(LNode* l);
[fcb8022]158};
159
160
[d72b11]161
162/*
[66e7b5]163==============================================
[a05c71]164class LtagNode (nodes for lists of LPolyOld tags)
[66e7b5]165==============================================
[d72b11]166*/
[66e7b5]167class LTagNode {
[a0350e9]168    private:
169        LNode*      data;
[66e7b5]170        LTagNode*   next;
[a0350e9]171    public:
[87beab7]172        LTagNode();
[66e7b5]173        LTagNode(LNode* l);
174        LTagNode(LNode* l, LTagNode* n);
175        ~LTagNode();
176        // declaration with first as parameter due to sorting of LTagList
177        LTagNode*   insert(LNode* l);
[a0350e9]178        LNode*      getLNode();
[d51339]179        LTagNode*   getNext();
[66e7b5]180        LNode*      get(int i, int length);
[a0350e9]181};
[d72b11]182
183
184/*
[66e7b5]185=========================================================================
[a05c71]186class LTagList(lists of LPolyOld tags, i.e. first elements of a given index)
[66e7b5]187=========================================================================
[d72b11]188*/
[66e7b5]189class LTagList {
[a0350e9]190    private:
[66e7b5]191        LTagNode*   first;
[d51339]192        LNode*      firstCurrentIdx;
[66e7b5]193        int         length;
[a0350e9]194    public:
[87beab7]195                LTagList();
[66e7b5]196                LTagList(LNode* l);
197                ~LTagList();
198        // declaration with first as parameter in LTagNode due to sorting of LTagList
199        void    insert(LNode* l);
[d51339]200        void    setFirstCurrentIdx(LNode* l);
[66e7b5]201        LNode*  get(int idx);
[87beab7]202        LNode*  getFirst();
[d51339]203        LNode*  getFirstCurrentIdx();
[87beab7]204};
205
206LNode*  getGPrevRedCheck();
207LNode*  getcompletedRedCheck();
208
209
210/*
211======================================================================================
212class TopRed(return values of subalgorithm TopRed in f5gb.cc), i.e. the first elements
213             of the lists LList* completed & LList* sPolyList
214======================================================================================
215*/
216class TopRed {
217    private:
218        LList*  _completed;
219        LList*  _toDo;
220    public:
221                TopRed();
222                TopRed(LList* c, LList* t);
223        LList*  getCompleted();
224        LList*  getToDo();
[a0350e9]225};
[d72b11]226
227
228/*
229=======================================
[0179d5]230class CNode (nodes for lists of CPairOlds)
[d72b11]231=======================================
232*/
233class CNode {
234    private:
[0179d5]235        CPairOld* data;
[d72b11]236        CNode* next;
237    public:
[66e7b5]238                CNode();
[0179d5]239                CNode(CPairOld* c);
240                CNode(CPairOld* c, CNode* n);
[a0350e9]241                ~CNode(); 
[0179d5]242        CNode*  insert(CPairOld* c); 
[ab76b4]243        CNode*  insertWithoutSort(CPairOld* cp); 
[cce6ed3]244        CNode*  getMinDeg();
[0179d5]245        CPairOld*  getData();
[9bb97e]246        CNode*  getNext();
[a05c71]247        LPolyOld*  getAdLp1();
248        LPolyOld*  getAdLp2();
[66e7b5]249        poly    getLp1Poly();
250        poly    getLp2Poly();
251        poly    getLp1Term();
252        poly    getLp2Term();
[9bb97e]253        poly    getT1(); 
254        poly*   getAdT1(); 
[66e7b5]255        poly    getT2(); 
[9bb97e]256        poly*   getAdT2(); 
[66e7b5]257        int     getLp1Index();
258        int     getLp2Index();
[418bd6]259        bool    getDel();
[a05c71]260        RuleOld*   getTestedRuleOld();
[66e7b5]261        void    print();
[d72b11]262};
263
264
265/*
[cce6ed3]266============================
[0179d5]267class CListOld(lists of CPairOlds)
[cce6ed3]268============================
[d72b11]269*/
[0179d5]270class CListOld {
[d72b11]271    private:
272        CNode*  first;
273    public:
[0179d5]274                // for initialization of CListOlds, last element alwas has data=NULL and next=NULL
275                CListOld(); 
276                CListOld(CPairOld* c); 
277                ~CListOld(); 
[9bb97e]278        CNode*  getFirst();
[0179d5]279        void    insert(CPairOld* c);
[ab76b4]280        void    insertWithoutSort(CPairOld* c);
[cce6ed3]281        CNode*  getMinDeg();
[66e7b5]282        void    print();
[cce6ed3]283};
284
285
286/*
287======================================
[a05c71]288class RNode (nodes for lists of RuleOlds)
[cce6ed3]289======================================
290*/
291class RNode {
292    private:
[a05c71]293        RuleOld*   data;
[cce6ed3]294        RNode*  next;
295    public:
[66e7b5]296                RNode();
[a05c71]297                RNode(RuleOld* r);
[cce6ed3]298                ~RNode();
[a05c71]299        RNode*  insert(RuleOld* r);
[87beab7]300        RNode*  insert(int i, poly t);
[a05c71]301        RNode*  insertOrdered(RuleOld* r);
[66e7b5]302        RNode*  getNext();
[a05c71]303        RuleOld*   getRuleOld();
304        int     getRuleOldIndex();
305        poly    getRuleOldTerm();
[6b0aa2]306        void    print();
[cce6ed3]307};
308
309/*
310============================
[a05c71]311class RList (lists of RuleOlds)
[cce6ed3]312============================
313*/
314class RList {
315    private:
316        RNode*  first;
[66e7b5]317        // last alway has data=NULL and next=NULL, for initialization purposes used
318        RNode*  last;
[cce6ed3]319    public:
[66e7b5]320                RList();
[a05c71]321                RList(RuleOld* r);
[cce6ed3]322                ~RList();
[a05c71]323        void    insert(RuleOld* r);
[87beab7]324        void    insert(int i, poly t);
[a05c71]325        void    insertOrdered(RuleOld* r);
[66e7b5]326        RNode*  getFirst();
[a05c71]327        RuleOld*   getRuleOld();
[6b0aa2]328        void    print();
[66e7b5]329};
330
331
332
333/*
334=============================================
[a05c71]335class RtagNode (nodes for lists of RuleOld tags)
[66e7b5]336=============================================
337*/
338class RTagNode {
339    private:
340        RNode*      data;
341        RTagNode*   next;
342    public:
[a41f3aa]343                    RTagNode();
344                    RTagNode(RNode* r);
345                    RTagNode(RNode* r, RTagNode* n);
346                    ~RTagNode();
[66e7b5]347        // declaration with first as parameter due to sorting of LTagList
348        RTagNode*   insert(RNode* r);
349        RNode*      getRNode();
[9cb4078]350        RTagNode*   getNext();
[66e7b5]351        RNode*      get(int idx, int length);
[fcb8022]352        void        set(RNode*);
[87beab7]353        void        print();
[66e7b5]354};
355
356
357/*
358========================================================================
[a05c71]359class RTagList(lists of RuleOld tags, i.e. first elements of a given index)
[66e7b5]360========================================================================
361*/
362class RTagList {
363    private:
364        RTagNode*   first;
365        int         length;
366    public:
[a41f3aa]367                RTagList();
[66e7b5]368                RTagList(RNode* r);
369                ~RTagList();
370        // declaration with first as parameter in LTagNode due to sorting of LTagList
371        void    insert(RNode* r);
[8978fd]372        RNode*  getFirst();
[66e7b5]373        RNode*  get(int idx);
[fcb8022]374        void    setFirst(RNode* r);
[87beab7]375        void    print();
376        int     getLength();
[d72b11]377};
378#endif
379#endif
Note: See TracBrowser for help on using the repository browser.