Changeset a09a42 in git for kernel/kstd2.cc
- Timestamp:
- Jan 16, 2006, 3:02:52 PM (18 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- ce89df54a95c17d936886fb9f5a3c977f877d690
- Parents:
- e6e28e89e44a9e577c2fdbae4479e7ab4a01d1ca
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/kstd2.cc
re6e28e8 ra09a42 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kstd2.cc,v 1. 6 2006-01-16 03:27:10 wienandExp $ */4 /* $Id: kstd2.cc,v 1.7 2006-01-16 14:02:51 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT - Kernel: alg. of Buchberger … … 164 164 */ 165 165 166 long factorial(long arg) { 167 long tmp = 1; 168 for (int i = 2; i < arg + 1; i++) { 166 long factorial(long arg) 167 { 168 long tmp = 1; arg++; 169 for (int i = 2; i < arg; i++) 170 { 169 171 tmp = tmp * i; 170 172 } … … 172 174 } 173 175 174 poly kFindZeroPoly(poly input_p, ring leadRing, ring tailRing) { 176 poly kFindZeroPoly(poly input_p, ring leadRing, ring tailRing) 177 { 175 178 // m = currRing->ch 176 179 … … 185 188 long k = 1; 186 189 187 while (a%2 == 0) { 190 while (a%2 == 0) 191 { 188 192 a = a / 2; 189 193 a_ind2++; 190 194 } 191 195 192 for (int i = 1; i <= leadRing->N; i++) { 196 for (int i = 1; i <= leadRing->N; i++) 197 { 193 198 a = factorial(pGetExp(p, i)); 194 199 k = k * a; 195 while (a%2 == 0) { 200 while (a%2 == 0) 201 { 196 202 a = a / 2; 197 203 k_ind2++; … … 202 208 number tmp1; 203 209 poly tmp2, tmp3; 204 if (leadRing->ch <= k_ind2 + a_ind2) { 210 if (leadRing->ch <= k_ind2 + a_ind2) 211 { 205 212 zeroPoly = p_ISet(a, tailRing); 206 for (int i = 1; i <= leadRing->N; i++) { 207 for (long j = 1; j <= pGetExp(p, i); j++) { 213 for (int i = 1; i <= leadRing->N; i++) 214 { 215 for (long j = 1; j <= pGetExp(p, i); j++) 216 { 208 217 tmp1 = nInit(j); 209 218 tmp2 = p_ISet(1, tailRing); 210 219 p_SetExp(tmp2, i, 1, tailRing); 211 220 p_Setm(tmp2, tailRing); 212 if (nIsZero(tmp1)) { 221 if (nIsZero(tmp1)) 222 { 213 223 zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing); 214 224 } 215 else { 225 else 226 { 216 227 tmp3 = p_ISet((long) tmp1, tailRing); 217 228 zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp2, tmp3, tailRing), tailRing); … … 221 232 zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing); 222 233 tmp2 = pISet(a); 223 for (int i = 1; i <= leadRing->N; i++) { 234 for (int i = 1; i <= leadRing->N; i++) 235 { 224 236 pSetExp(tmp2, i, pGetExp(p, i)); 225 237 } … … 228 240 return tmp2; 229 241 } 230 if (leadRing->ch - k_ind2 <= a_ind2) { 231 PrintS("Case not implented yet !!!"); PrintLn(); 232 PrintS("But it should not mae any difference."); PrintLn(); 242 if (leadRing->ch - k_ind2 <= a_ind2) 243 { 244 PrintS("Case not implented yet !!!\n"); 245 PrintS("But it should not mae any difference.\n"); 233 246 return zeroPoly; 234 247 } … … 236 249 } 237 250 238 poly kFindDivisibleByZeroPoly(LObject* h) { 251 poly kFindDivisibleByZeroPoly(LObject* h) 252 { 239 253 return kFindZeroPoly(h->GetLmCurrRing(), currRing, h->tailRing); 240 254 } 241 255 256 #ifdef HAVE_RING2TOM 242 257 /*2 243 258 * reduction procedure for the ring Z/2^m … … 253 268 poly zeroPoly; 254 269 255 #ifdef HAVE_RING2TOM270 //#ifdef HAVE_RING2TOM 256 271 h->SetpFDeg(); 257 272 assume(h->pFDeg() == h->FDeg); 258 if (h->pFDeg() != h->FDeg) { 273 if (h->pFDeg() != h->FDeg) 274 { 259 275 Print("h->pFDeg()=%d =!= h->FDeg=%d\n", h->pFDeg(), h->FDeg); 260 276 } 261 277 long reddeg = h->SetpFDeg(); 262 #else263 assume(h->pFDeg() == h->FDeg);264 long reddeg = h->GetpFDeg();265 #endif278 //#else 279 // assume(h->pFDeg() == h->FDeg); 280 // long reddeg = h->GetpFDeg(); 281 //#endif 266 282 267 283 h->SetShortExpVector(); … … 269 285 { 270 286 zeroPoly = kFindDivisibleByZeroPoly(h); 271 if (zeroPoly != NULL) { 287 if (zeroPoly != NULL) 288 { 272 289 #ifdef KDEBUG 273 290 if (TEST_OPT_DEBUG) … … 288 305 j = strat->tl; 289 306 } 290 else { 307 else 308 { 291 309 j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h); 292 310 if (j < 0) return 1; … … 359 377 } 360 378 } 379 #endif 361 380 #endif 362 381
Note: See TracChangeset
for help on using the changeset viewer.