Changeset 71f00c5 in git
- Timestamp:
- Dec 27, 2008, 2:50:06 PM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 4a0a4b8836ea17f984b15b03caab5ab09f76ada1
- Parents:
- db0c26499ac93c779f02182a98792ec615793f61
- Location:
- kernel
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/f5gb.cc
rdb0c264 r71f00c5 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: f5gb.cc,v 1.1 4 2008-12-26 13:49:29ederc Exp $ */4 /* $Id: f5gb.cc,v 1.15 2008-12-27 13:50:05 ederc Exp $ */ 5 5 /* 6 6 * ABSTRACT: f5gb interface … … 27 27 28 28 /* 29 =======================30 static/global variables31 =======================32 */33 static poly ONE = one_poly();34 35 36 /*37 29 ================================================ 38 30 computation of ONE polynomial as global variable … … 44 36 return one; 45 37 } 38 39 46 40 47 41 /* … … 86 80 ================================================== 87 81 */ 88 89 LList* F5inc(long i, poly* f_i, LList* g_prev) { 82 LList* 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(); 90 87 LList* g_curr = g_prev; 91 88 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); 93 90 94 91 return g_curr; 95 96 97 98 99 92 } 100 93 … … 105 98 */ 106 99 ideal F5main(ideal id, ring r) { 100 101 static poly ONE = pOne(); 107 102 long i,j; 108 LPoly* lp = new LPoly; 103 109 104 // definition of one-polynomial as global constant ONE 110 105 //poly one = pInit(); … … 130 125 //lp->setTerm(&ONE); 131 126 //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 140 129 // 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); 146 144 i = g_prev->getLength(); 147 145 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(); 151 151 } 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 //} 165 161 return(id); 166 162 … … 168 164 } 169 165 170 171 166 #endif -
kernel/f5gb.h
rdb0c264 r71f00c5 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: f5gb.h,v 1.1 3 2008-12-26 13:49:57ederc Exp $ */4 /* $Id: f5gb.h,v 1.14 2008-12-27 13:50:05 ederc Exp $ */ 5 5 /* 6 6 * ABSTRACT: f5gb interface … … 55 55 ideal F5main(ideal i, ring r); 56 56 57 58 57 #endif 59 58 #endif 60 -
kernel/lists.h
rdb0c264 r71f00c5 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: lists.h,v 1. 1 2008-12-26 13:51:10ederc Exp $ */4 /* $Id: lists.h,v 1.2 2008-12-27 13:50:05 ederc Exp $ */ 5 5 /* 6 6 * ABSTRACT: list interface … … 41 41 LNode* next; 42 42 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++(); 68 61 }; 69 62 … … 80 73 long length; 81 74 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(); 107 84 }; 108 85 … … 188 165 } 189 166 }; 190 191 192 193 194 167 #endif 195 168 #endif 196 -
kernel/lpolynomial.cc
rdb0c264 r71f00c5 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: lpolynomial.cc,v 1. 3 2008-12-26 13:51:50ederc Exp $ */4 /* $Id: lpolynomial.cc,v 1.4 2008-12-27 13:50:06 ederc Exp $ */ 5 5 /* 6 6 * ABSTRACT: lpolynomial definition … … 30 30 ================================================================ 31 31 */ 32 void LPoly::setPoly(poly* p) 33 { 32 LPoly::LPoly(poly* t,long* i,poly* p) { 33 set(t,i,p); 34 } 35 void LPoly::setPoly(poly* p) { 34 36 polynomial = *p; 35 37 } … … 48 50 } 49 51 50 poly LPoly::getPoly() const{51 return polynomial;52 poly* LPoly::getPoly() { 53 return &polynomial; 52 54 } 53 55 54 poly LPoly::getTerm() const{55 return term;56 poly* LPoly::getTerm() { 57 return &term; 56 58 } 57 59 58 long LPoly::getIndex() const{59 return index;60 long* LPoly::getIndex() { 61 return &index; 60 62 } 61 63 … … 70 72 } 71 73 72 /*73 =====================================================74 comparing two labeled polynomials by their signatures75 =====================================================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 87 74 LPoly* LPoly::get() { 88 75 return this; -
kernel/lpolynomial.h
rdb0c264 r71f00c5 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: lpolynomial.h,v 1. 3 2008-12-26 13:52:15ederc Exp $ */4 /* $Id: lpolynomial.h,v 1.4 2008-12-27 13:50:06 ederc Exp $ */ 5 5 /* 6 6 * ABSTRACT: labeled polynomial interface … … 17 17 ============================= 18 18 */ 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(); 19 class 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(); 38 37 }; 39 38 … … 44 43 =============================== 45 44 */ 46 struct CPair 47 { 48 LPoly* cp1; // first component 49 LPoly* cp2; // second component 45 struct CPair { 46 LPoly* cp1; // first component 47 LPoly* cp2; // second component 50 48 }; 51 49
Note: See TracChangeset
for help on using the changeset viewer.