Changeset ed30c5 in git
- Timestamp:
- Nov 22, 2008, 9:48:23 PM (15 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 99d87535652761aa8ed969de6b6ab84ee03fea8a
- Parents:
- 3b5daf5c3b6d494f4399c4436450100041ce3dc0
- Location:
- kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/f5gb.cc
r3b5daf red30c5 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: f5gb.cc,v 1.1 1 2008-11-20 17:55:04ederc Exp $ */4 /* $Id: f5gb.cc,v 1.12 2008-11-22 20:48:23 ederc Exp $ */ 5 5 /* 6 6 * ABSTRACT: f5gb interface 7 7 */ 8 8 #include "mod2.h" 9 9 #include <list> 10 10 #ifdef HAVE_F5 11 11 #include "kutil.h" … … 23 23 #include "pInline1.h" 24 24 #include "f5gb.h" 25 #include "lpolynom .h"25 #include "lpolynomial.h" 26 26 27 28 // global variables29 const poly one = pInit();30 27 31 28 … … 68 65 * computes incrementally gbs of subsets of the input 69 66 * gb{f_m} -> gb{f_m,f_(m-1)} -> gb{f_m,...,f_1} 70 */67 71 68 lpoly *f5_inc(lpoly* lp, lpoly* g_prev) 72 69 { … … 89 86 * 90 87 * return lp; 91 */88 92 89 } 93 90 94 91 */ 95 92 // generating the list lp of ideal generators and test if 1 is in lp 96 bool generate_input_list(lpoly* lp, ideal id )93 bool generate_input_list(lpoly* lp, ideal id, poly ONE) 97 94 { 98 95 long j; … … 101 98 lp[j].setPoly(id->m[j]); 102 99 103 if(pComparePolys(lp[j].getPoly(), one)){100 if(pComparePolys(lp[j].getPoly(), ONE)){ 104 101 Print("1 in GB\n"); 105 102 return(1); … … 107 104 108 105 lp[j].setIndex(j+1); 109 lp[j].setTerm( one);106 lp[j].setTerm(ONE); 110 107 lp[j].setDel(false); 111 108 lp[j].setNext(&lp[j+1]); … … 126 123 * implementation 127 124 */ 128 ideal F5main(ideal i, ring r) 129 { 130 ideal iTmp, g_basis; 131 bool one_id; 132 long j,k; 133 pSetCoeff(one, nInit(1)); 134 pWrite(one); 135 lpoly *lp, *gb; 136 intvec* sort; 137 iTmp = idInit(IDELEMS(i),i->rank); 138 139 for(j=0; j<IDELEMS(i); j++) 140 { 141 if(NULL != i->m[j]) 142 { 143 iTmp->m[j] = i->m[j]; 144 } 145 ;} 146 147 iTmp = kInterRed(i,0); 148 qsort_degree(&iTmp->m[0],&iTmp->m[IDELEMS(iTmp)-1]); 149 idShow(iTmp); 150 151 // generating the list lp of ideal generators 152 lp = new lpoly[IDELEMS(iTmp)]; 153 154 one_id = generate_input_list(lp,iTmp); 155 156 157 // PROBLEM: muss signatur mitliefern, daher datentyp 158 // ideal nicht zu gebrauchen? 159 125 ideal F5main(ideal i, ring r) { 126 lpoly* lp; 127 long j; 160 128 161 // gb: Grobner Bases, pointer on the first element in the list, 162 // end of the list is marked by next = NULL 163 164 gb = new lpoly; 165 gb = &lp[IDELEMS(iTmp)-1]; 166 (*gb).setNext(NULL); 167 Print("last element in sequence = first element in gb:\n"); 168 pWrite((*gb).getPoly()); 169 Print("Next: %p\n", lp[IDELEMS(iTmp)-2].getNext()); 170 Print("Next: %p\n", lp[IDELEMS(iTmp)-1].getNext()); 171 172 for(j=IDELEMS(iTmp)-2; j>0; j--){ 173 //PROBLEM: muss dynamisch Speicher allozieren 174 gb = f5_inc(&lp[j], gb); 175 176 for(k=0; k< IDELEMS(iTmp); k++){ 177 178 if(pComparePolys(gb[k].getPoly(),one)){ 179 Print("1 in GB\n"); 180 return(iTmp); 181 } 182 183 } 184 185 129 // definition of one-polynomial as global constant ONE 130 poly one = pInit(); 131 pSetCoeff(one, nInit(1)); 132 static const poly ONE = one; 133 134 // 135 for(j=0; j<IDELEMS(i); j++) { 136 if(NULL != i->m[j]) { 137 if(pComparePolys(i->m[j],ONE)) { 138 Print("One Polynomial in Input => Computations stopped\n"); 139 return(i); 140 } 186 141 } 187 188 Print("Es klappt!\n"); 189 return(iTmp); 190 142 } 143 144 i = kInterRed(i,0); 145 qsort_degree(&i->m[0],&i->m[IDELEMS(i)-1]); 146 idShow(i); 147 148 /* if(generate_input_list(lp,iTmp,ONE)) { 149 Print("One Polynomial in Input => Computations stopped"); 150 iTmp = idInit(1,0); 151 iTmp->m[0] = ONE; 152 return(iTmp); 153 } 154 */ 155 Print("Es klappt!\nWIRKLICH!"); 156 return(i); 157 191 158 192 159 -
kernel/f5gb.h
r3b5daf red30c5 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: f5gb.h,v 1.1 0 2008-11-20 17:55:04ederc Exp $ */4 /* $Id: f5gb.h,v 1.11 2008-11-22 20:48:23 ederc Exp $ */ 5 5 /* 6 6 * ABSTRACT: f5gb interface … … 10 10 11 11 #ifdef HAVE_F5 12 #include "lpolynom .h"12 #include "lpolynomial.h" 13 13 14 14 15 15 // sort polynomials in ideal i by decreasing total degree 16 void qsort_degree(poly* left, poly* right);16 void qsort_degree(poly* left, poly* right); 17 17 18 18 19 19 // generating the list lp of ideal generators and 20 20 // test if 1 is in lp(return 1) or not(return 0) 21 bool generate_input_list(lpoly* lp, ideal id);21 bool generate_input_list(lpoly* lp, ideal id, poly one); 22 22 23 23 /* computes incrementally gbs of subsets of the input 24 24 gb{f_m} -> gb{f_m,f_(m-1)} -> gb{f_m,...,f_1} 25 25 */ 26 lpoly* f5_inc(lpoly* lp, lpoly* g_prev);26 // lpoly* f5_inc(lpoly* lp, lpoly* g_prev); 27 27 28 28
Note: See TracChangeset
for help on using the changeset viewer.