Changeset 518fb78 in git
- Timestamp:
- May 12, 2005, 3:42:01 PM (19 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
- Children:
- 7c91e4020056a642ec07b90ee816bd1c0e948ecc
- Parents:
- accd6a78454959d4d30cfd2c78391dbc8490b47a
- Location:
- kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/tgb.cc
raccd6a r518fb78 5 5 * Computer Algebra System SINGULAR * 6 6 ****************************************/ 7 /* $Id: tgb.cc,v 1.2 2 2005-05-12 09:19:43bricken Exp $ */7 /* $Id: tgb.cc,v 1.23 2005-05-12 13:42:00 bricken Exp $ */ 8 8 /* 9 9 * ABSTRACT: slimgb and F4 implementation … … 389 389 } 390 390 391 #if 0 392 int find_best(red_object* r,int l, int u, int &w, calc_dat* c){ 393 394 int sz=u-l+1; 395 int n=sz/10+1; 396 int filled=0; 397 int* indizes=(int*) omalloc(n*sizeof(int)); 398 int* weight=(int*) omalloc(n*sizeof(int)); 399 int worst=-1; 400 int i; 401 for(i=l;i<=u;i++){ 402 int q=r[i].guess_quality(c); 403 if ((filled<n)||(q<worst)){ 404 if(filled<n){ 405 worst=si_max(q,worst); 406 indizes[filled]=i; 407 weight[filled]=q; 408 filled++; 409 } 410 } 411 else{ 412 int j; 413 for(j=0;j<filled;j++){ 414 if (worst==weight[j]){ 415 weight[j]=q; 416 indizes[j]=i; 417 } 418 } 419 worst=-1; 420 for(j=0;j<filled;j++){ 421 if (worst<weight[j]){ 422 worst=weight[j]; 423 } 424 } 425 } 426 } 427 assume(filled==n); 428 int pos=0; 429 430 for(i=0;i<filled;i++){ 431 r[indizes[i]].canonicalize(); 432 weight[i]=r[indizes[i]].guess_quality(c); 433 if(weight[i]<weight[pos]) pos=i; 434 } 435 w=weight[pos]; 436 pos=indizes[pos]; 437 438 omfree(indizes); 439 omfree(weight); 440 441 assume(w==r[pos].guess_quality(c)); 442 assume(l<=pos); 443 assume(u>=pos); 444 return pos; 445 446 } 447 448 #endif 391 449 392 void red_object::canonicalize(){ 450 393 kBucketCanonicalize(bucket); … … 1181 1124 1182 1125 1183 #if 01184 static poly redNF (poly h,kStrategy strat)1185 {1186 int j = 0;1187 int z = 3;1188 unsigned long not_sev;1189 1190 if (0 > strat->sl)1191 {1192 return h;1193 }1194 not_sev = ~ pGetShortExpVector(h);1195 loop1196 {1197 if (pLmShortDivisibleBy(strat->S[j], strat->sevS[j], h, not_sev))1198 {1199 //if (strat->interpt) test_int_std(strat->kIdeal);1200 /*- compute the s-polynomial -*/1201 #ifdef KDEBUG1202 if (TEST_OPT_DEBUG)1203 {1204 1205 PrintS("red:");1206 wrp(h);1207 PrintS(" with ");1208 wrp(strat->S[j]);1209 }1210 #endif1211 h = ksOldSpolyRed(strat->S[j],h,strat->kNoether);1212 #ifdef KDEBUG1213 if (TEST_OPT_DEBUG)1214 {1215 PrintS("\nto:");1216 wrp(h);1217 PrintLn();1218 }1219 #endif1220 if (h == NULL) return NULL;1221 z++;1222 if (z>=10)1223 {1224 z=0;1225 pNormalize(h);1226 }1227 /*- try to reduce the s-polynomial -*/1228 j = 0;1229 not_sev = ~ pGetShortExpVector(h);1230 }1231 else1232 {1233 if (j >= strat->sl) return h;1234 j++;1235 }1236 }1237 }1238 #else1239 1126 1240 1127 static poly redNF2 (poly h,calc_dat* c , int &len, number& m,int n) … … 1778 1665 } 1779 1666 } 1780 #endif 1667 1781 1668 #ifdef REDTAIL_S 1782 1669 -
kernel/tgb_obsolete.cc
raccd6a r518fb78 1 1 #include "tgb_internal.h" 2 int find_best(red_object* r,int l, int u, int &w, calc_dat* c){ 3 4 int sz=u-l+1; 5 int n=sz/10+1; 6 int filled=0; 7 int* indizes=(int*) omalloc(n*sizeof(int)); 8 int* weight=(int*) omalloc(n*sizeof(int)); 9 int worst=-1; 10 int i; 11 for(i=l;i<=u;i++){ 12 int q=r[i].guess_quality(c); 13 if ((filled<n)||(q<worst)){ 14 if(filled<n){ 15 worst=si_max(q,worst); 16 indizes[filled]=i; 17 weight[filled]=q; 18 filled++; 19 } 20 } 21 else{ 22 int j; 23 for(j=0;j<filled;j++){ 24 if (worst==weight[j]){ 25 weight[j]=q; 26 indizes[j]=i; 27 } 28 } 29 worst=-1; 30 for(j=0;j<filled;j++){ 31 if (worst<weight[j]){ 32 worst=weight[j]; 33 } 34 } 35 } 36 } 37 assume(filled==n); 38 int pos=0; 39 40 for(i=0;i<filled;i++){ 41 r[indizes[i]].canonicalize(); 42 weight[i]=r[indizes[i]].guess_quality(c); 43 if(weight[i]<weight[pos]) pos=i; 44 } 45 w=weight[pos]; 46 pos=indizes[pos]; 47 48 omfree(indizes); 49 omfree(weight); 50 51 assume(w==r[pos].guess_quality(c)); 52 assume(l<=pos); 53 assume(u>=pos); 54 return pos; 55 56 } 57 static poly redNF (poly h,kStrategy strat) 58 { 59 int j = 0; 60 int z = 3; 61 unsigned long not_sev; 62 63 if (0 > strat->sl) 64 { 65 return h; 66 } 67 not_sev = ~ pGetShortExpVector(h); 68 loop 69 { 70 if (pLmShortDivisibleBy(strat->S[j], strat->sevS[j], h, not_sev)) 71 { 72 //if (strat->interpt) test_int_std(strat->kIdeal); 73 /*- compute the s-polynomial -*/ 74 #ifdef KDEBUG 75 if (TEST_OPT_DEBUG) 76 { 77 78 PrintS("red:"); 79 wrp(h); 80 PrintS(" with "); 81 wrp(strat->S[j]); 82 } 83 #endif 84 h = ksOldSpolyRed(strat->S[j],h,strat->kNoether); 85 #ifdef KDEBUG 86 if (TEST_OPT_DEBUG) 87 { 88 PrintS("\nto:"); 89 wrp(h); 90 PrintLn(); 91 } 92 #endif 93 if (h == NULL) return NULL; 94 z++; 95 if (z>=10) 96 { 97 z=0; 98 pNormalize(h); 99 } 100 /*- try to reduce the s-polynomial -*/ 101 j = 0; 102 not_sev = ~ pGetShortExpVector(h); 103 } 104 else 105 { 106 if (j >= strat->sl) return h; 107 j++; 108 } 109 } 110 } 2 111 static sorted_pair_node** add_to_basis(poly h, int i_pos, int j_pos,calc_dat* c, int* ip) 3 112 {
Note: See TracChangeset
for help on using the changeset viewer.