Changeset 585bbcb in git for kernel/kstd2.cc
- Timestamp:
- Nov 27, 2005, 4:28:46 PM (18 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 6a972af1108afd9ad6a0a74a519e0b3107421d16
- Parents:
- f498f1081627c853c4d77077fcaa2ea32d82a711
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/kstd2.cc
rf498f10 r585bbcb 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kstd2.cc,v 1. 3 2005-10-17 13:42:48 SingularExp $ */4 /* $Id: kstd2.cc,v 1.4 2005-11-27 15:28:44 wienand Exp $ */ 5 5 /* 6 6 * ABSTRACT - Kernel: alg. of Buchberger … … 103 103 } 104 104 } 105 106 #ifdef HAVE_RING2TOM 107 // return -1 if no divisor is found 108 // number of first divisor, otherwise 109 int kRingFindDivisibleByInT(const TSet &T, const unsigned long* sevT, 110 const int tl, const LObject* L, const int start) 111 { 112 unsigned long not_sev = ~L->sev; 113 int j = start; 114 poly p; 115 ring r; 116 L->GetLm(p, r); 117 118 pAssume(~not_sev == p_GetShortExpVector(p, r)); 119 120 { 121 loop 122 { 123 if (j > tl) return -1; 124 #if defined(PDEBUG) || defined(PDIV_DEBUG) 125 if (p_LmRingShortDivisibleBy(T[j].p, sevT[j], 126 p, not_sev, r)) 127 return j; 128 #else 129 if ( !(sevT[j] & not_sev) && 130 p_LmRingDivisibleBy(T[j].p, p, r) ) 131 return j; 132 #endif 133 j++; 134 } 135 } 136 return -1; 137 } 138 139 // same as above, only with set S 140 int kRingFindDivisibleByInS(const polyset &S, const unsigned long* sev, const int sl, LObject* L) 141 { 142 unsigned long not_sev = ~L->sev; 143 poly p = L->GetLmCurrRing(); 144 int j = 0; 145 //PrintS("FindDiv: p="); wrp(p); PrintLn(); 146 pAssume(~not_sev == p_GetShortExpVector(p, currRing)); 147 loop 148 { 149 //PrintS("FindDiv: S[j]="); wrp(S[j]); PrintLn(); 150 if (j > sl) return -1; 151 #if defined(PDEBUG) || defined(PDIV_DEBUG) 152 if (p_LmRingShortDivisibleBy(S[j], sev[j], 153 p, not_sev, currRing)) 154 return j; 155 #else 156 if ( !(sev[j] & not_sev) && 157 p_LmRingDivisibleBy(S[j], p, currRing) ) 158 return j; 159 #endif 160 j++; 161 } 162 } 163 164 /*2 165 * reduction procedure for the ring Z/2^m 166 */ 167 int redRing2toM (LObject* h,kStrategy strat) 168 { 169 // PrintS("redRing2toM"); 170 // PrintLn(); 171 if (strat->tl<0) return 1; 172 int at,d,i; 173 int j = 0; 174 int pass = 0; 175 assume(h->pFDeg() == h->FDeg); 176 long reddeg = h->GetpFDeg(); 177 178 h->SetShortExpVector(); 179 loop 180 { 181 j = kRingFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h); 182 if (j < 0) return 1; 183 184 #ifdef KDEBUG 185 if (TEST_OPT_DEBUG) 186 { 187 PrintS("red:"); 188 h->wrp(); 189 PrintS(" with "); 190 strat->T[j].wrp(); 191 } 192 #endif 193 194 ksRingReducePoly(h, &(strat->T[j]), NULL, NULL, strat); 195 196 #ifdef KDEBUG 197 if (TEST_OPT_DEBUG) 198 { 199 PrintS("\nto "); 200 h->wrp(); 201 PrintLn(); 202 } 203 #endif 204 205 if (h->GetLmTailRing() == NULL) 206 { 207 if (h->lcm!=NULL) pLmFree(h->lcm); 208 #ifdef KDEBUG 209 h->lcm=NULL; 210 #endif 211 return 0; 212 } 213 h->SetShortExpVector(); 214 d = h->SetpFDeg(); 215 /*- try to reduce the s-polynomial -*/ 216 pass++; 217 if (!K_TEST_OPT_REDTHROUGH && 218 (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass))) 219 { 220 h->SetLmCurrRing(); 221 at = strat->posInL(strat->L,strat->Ll,h,strat); 222 if (at <= strat->Ll) 223 { 224 #if 0 225 if (kRingFindDivisibleByInS(strat->S, strat->sevS, strat->sl, h) < 0) 226 return 1; 227 #endif 228 #ifdef KDEBUG 229 if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at); 230 #endif 231 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); 232 h->Clear(); 233 return -1; 234 } 235 } 236 else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d != reddeg)) 237 { 238 Print(".%d",d);mflush(); 239 reddeg = d; 240 } 241 } 242 } 243 #endif 105 244 106 245 /*2 … … 417 556 loop 418 557 { 419 j=kFindDivisibleByInS(strat->S,strat->sevS,strat->sl,&P); 558 #ifdef HAVE_RING2TOM 559 if (currRing->cring == 1) { 560 j=kRingFindDivisibleByInS(strat->S,strat->sevS,strat->sl,&P); 561 } 562 else 563 #endif 564 j=kFindDivisibleByInS(strat->S,strat->sevS,strat->sl,&P); 420 565 if (j>=0) 421 566 { … … 520 665 #ifdef KDEBUG 521 666 loop_count++; 667 #ifdef HAVE_RING2TOM 668 if (TEST_OPT_DEBUG) PrintS("--- next step ---\n"); 669 #endif 522 670 if (TEST_OPT_DEBUG) messageSets(strat); 523 671 #endif
Note: See TracChangeset
for help on using the changeset viewer.