source: git/kernel/f5data.h @ e90881

spielwiese
Last change on this file since e90881 was e90881, checked in by Christian Eder, 15 years ago
implemented deletion of known useless polynomials before the interreduction of gprev takes place git-svn-id: file:///usr/local/Singular/svn/trunk@11596 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 5.3 KB
Line 
1//! \file f5data.cc
2/****************************************
3*  Computer Algebra System SINGULAR     *
4****************************************/
5/* $Id: f5data.h,v 1.10 2009-03-29 17:17:09 ederc Exp $ */
6/*
7* ABSTRACT: labeled polynomial interface
8*/
9#ifndef F5DATA_HEADER
10#define F5DATA_HEADER
11#ifdef HAVE_F5
12/*!
13=========================================================
14=========================================================
15classes for labeled polynomials/pairs/S-polynomials in F5
16=========================================================
17=========================================================
18*/
19class LPoly;
20class CPair;
21class Rule;
22
23
24/*!
25============================
26class of labeled polynomials
27============================
28*/
29class LPoly {
30    private:
31        poly    term;           //term of signature
32        int     index;          //index of signature
33        poly    polynomial;     //standard polynomial data
34        Rule*   _rule;
35        bool    del;
36    public:
37        inline          LPoly(poly t, int i, poly p, Rule* r=NULL);
38        inline  void    setPoly(poly p);
39        inline  poly    getPoly();
40        inline  void    setTerm(poly t);
41        inline  poly    getTerm();
42        inline  void    setIndex(int i);
43        inline  int     getIndex();
44        inline  void    setRule(Rule* r);
45        inline  Rule*   getRule();
46        inline  void    setDel(bool d);
47        inline  bool    getDel();
48        inline  void    set(poly t, int i, poly p, Rule* r);
49        inline  LPoly*  get();
50};
51
52LPoly::LPoly(poly t,int i,poly p, Rule* r) {
53    set(t,i,p,r);
54    del =   0;
55}
56
57void LPoly::setPoly(poly p)  {
58    //poly _p     =   pInit();
59    //_p          =   pCopy(p);
60    polynomial = p;
61}
62
63void LPoly::setTerm(poly t) {
64    //poly _t     =   pInit();
65    //_t          =   pCopy(t);
66    term = t;
67}
68
69void LPoly::setIndex(int i) {
70    index = i;
71}
72
73void LPoly::setRule(Rule* r) {
74    _rule   =   r;
75}
76
77void LPoly::setDel(bool d) {
78    del =   d;
79}
80
81poly LPoly::getPoly() {
82    return polynomial;
83}
84
85poly LPoly::getTerm() {
86    return term;
87}
88
89int LPoly::getIndex() {
90    return index;
91}
92
93Rule* LPoly::getRule() {
94    return _rule;
95}
96
97bool LPoly::getDel() {
98    return del;
99}
100
101void LPoly::set(poly t, int i, poly p, Rule* r) {
102    this->setTerm(t);
103    this->setIndex(i);
104    this->setPoly(p);
105    this->setRule(r);
106}
107
108LPoly* LPoly::get() {
109    return this;
110}
111
112
113/*!
114===================================
115structure of labeled critical pairs
116===================================
117*/
118class CPair {
119    private:
120        long    deg;            // total degree of the critical pair
121        poly    t1;             // first term for label
122        LPoly*  lp1;            // first labeled poly
123        poly    t2;             // second term for label
124        LPoly*  lp2;            // second labeled poly
125        Rule*   testedRule;     // already tested by rules up to lastRuleTested
126    public:
127        inline          CPair(long degree, poly term1, LPoly* lpoly1, poly term2, LPoly* lpoly2, Rule* r = NULL);
128        inline  long    getDeg();
129        inline  poly    getT1();
130        inline  poly*   getAdT1();
131        inline  LPoly*  getAdLp1();
132        inline  poly    getLp1Poly();
133        inline  poly    getLp1Term();
134        inline  int     getLp1Index();
135        inline  poly    getT2();
136        inline  poly*   getAdT2();
137        inline  LPoly*  getAdLp2();
138        inline  poly    getLp2Poly();
139        inline  poly    getLp2Term();
140        inline  int     getLp2Index();
141        inline  Rule*   getTestedRule();
142        inline  void    setTestedRule(Rule* r);
143};
144
145CPair::CPair(long degree, poly term1, LPoly* lpoly1, poly term2, LPoly* lpoly2, Rule* r) {
146   deg              =   degree;
147   t1               =   term1;
148   lp1              =   lpoly1;
149   t2               =   term2;
150   lp2              =   lpoly2;
151   testedRule       =   r;
152}
153
154long CPair::getDeg() {
155    return deg;
156}
157
158poly CPair::getT1() {
159    return t1;
160}
161
162poly* CPair::getAdT1() {
163    return &t1;
164}
165
166poly* CPair::getAdT2() {
167    return &t2;
168}
169
170poly CPair::getT2() {
171    return t2;
172}
173
174LPoly* CPair::getAdLp1() {
175    return lp1;
176}
177
178LPoly* CPair::getAdLp2() {
179    return lp2;
180}
181
182poly CPair::getLp1Poly() {
183    return lp1->getPoly();
184}
185
186poly CPair::getLp2Poly() {
187    return lp2->getPoly();
188}
189
190poly CPair::getLp1Term() {
191    return lp1->getTerm();
192}
193
194poly CPair::getLp2Term() {
195    return lp2->getTerm();
196}
197
198int CPair::getLp1Index() {
199    return lp1->getIndex();
200}
201
202int CPair::getLp2Index() {
203    return lp2->getIndex();
204}
205
206Rule* CPair::getTestedRule() {
207    return testedRule;
208}
209
210void CPair::setTestedRule(Rule* r) {
211    testedRule      =   r;
212}
213
214
215/*!
216========================================================
217structure of rules(i.e. already computed / known labels)
218========================================================
219*/
220class Rule {
221    private:
222        int     index;      // index of the labeled polynomial the rule comes from
223        poly    term;       // term of the labeled polynomial the rule comes from
224    public:
225        inline          Rule(int i, poly term);
226        inline          ~Rule();
227        inline  int     getIndex();
228        inline  poly    getTerm();
229};
230
231Rule::Rule(int i, poly t) {
232    index   =   i;
233    term    =   t;
234}
235
236Rule::~Rule() {
237    //pDelete(&term);
238}
239
240int Rule::getIndex() {
241    return index;
242}
243
244poly Rule::getTerm() {
245    return term;
246}
247#endif
248#endif
Note: See TracBrowser for help on using the repository browser.