Changeset a8b44d in git
- Timestamp:
- Mar 21, 2011, 3:55:47 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 9cd697732c2adbda992d49885d226fc966966251
- Parents:
- f4a33e267c2b5be378ef1fc5426935bee8f1e4d9
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/ideals.cc
rf4a33e ra8b44d 299 299 300 300 // 301 // Delete id[j], if Lm(j) == Lm(i) and j > i301 // Delete id[j], if Lm(j) == Lm(i) and both LC(j), LC(i) are units and j > i 302 302 // 303 303 void idDelLmEquals(ideal id) … … 312 312 { 313 313 if ((id->m[j] != NULL) 314 && pLmEqual(id->m[i], id->m[j])) 314 && pLmEqual(id->m[i], id->m[j]) 315 #ifdef HAVE_RINGS 316 && nIsUnit(pGetCoeff(id->m[i])) && nIsUnit(pGetCoeff(id->m[j])) 317 #endif 318 ) 315 319 { 316 320 pDelete(&id->m[j]); … … 321 325 } 322 326 327 // 328 // delete id[j], if LT(j) == coeff*mon*LT(i) and vice versa, i.e., 329 // delete id[i], if LT(i) == coeff*mon*LT(j) 330 // 323 331 void idDelDiv(ideal id) 324 332 { … … 333 341 if (id->m[j]!=NULL) 334 342 { 335 if(pDivisibleBy(id->m[i], id->m[j])) 343 #ifdef HAVE_RINGS 344 if (rField_is_Ring(currRing)) 336 345 { 337 pDelete(&id->m[j]); 338 } 339 else if(pDivisibleBy(id->m[j], id->m[i])) 346 if (pDivisibleByRingCase(id->m[i], id->m[j])) 347 { 348 pDelete(&id->m[j]); 349 } 350 else if (pDivisibleByRingCase(id->m[j], id->m[i])) 340 351 { 341 352 pDelete(&id->m[i]); 342 353 break; 343 354 } 355 } 356 else 357 { 358 #endif 359 /* the case of a ground field: */ 360 if (pDivisibleBy(id->m[i], id->m[j])) 361 { 362 pDelete(&id->m[j]); 363 } 364 else if (pDivisibleBy(id->m[j], id->m[i])) 365 { 366 pDelete(&id->m[i]); 367 break; 368 } 369 #ifdef HAVE_RINGS 370 } 371 #endif 344 372 } 345 373 } -
kernel/polys.cc
rf4a33e ra8b44d 99 99 * assumes that the head term of b is a multiple of the head term of a 100 100 * and return the multiplicant *m 101 * Frank's observation: If LM(b) = LM(a)*m, then we may actually set 102 * negative(!) exponents in the below loop. I suspect that the correct 103 * comment should be "assumes that LM(a) = LM(b)*m, for some monomial m..." 101 104 */ 102 105 poly pDivide(poly a, poly b) … … 130 133 p_Test(q, r); 131 134 return q; 135 } 136 #endif 137 138 static void printNumber(const number z) 139 { 140 if (nIsZero(z)) printf("number = 0\n"); 141 else 142 { 143 poly p = pOne(); 144 pSetCoeff(p, nCopy(z)); 145 pSetm(p); 146 printf("number = %s\n", pString(p)); 147 pDelete(&p); 148 } 149 } 150 151 #ifdef HAVE_RINGS 152 /* TRUE iff LT(f) | LT(g) */ 153 BOOLEAN pDivisibleByRingCase(poly f, poly g) 154 { 155 int exponent; 156 for(int i = (int)pVariables; i; i--) 157 { 158 exponent = pGetExp(g, i) - pGetExp(f, i); 159 if (exponent < 0) return FALSE; 160 } 161 return nDivBy(pGetCoeff(g), pGetCoeff(f)); 132 162 } 133 163 #endif … … 567 597 568 598 /*2 569 *divides p1 by its leading coefficient 599 * divides p1 by its leading coefficient if it is a unit 600 * (this will always be true over fields; but not over coefficient rings) 570 601 */ 571 602 void pNorm(poly p1) … … 574 605 if (rField_is_Ring(currRing)) 575 606 { 576 Werror("pNorm not possible in the case of coefficient rings."); 577 } 578 else 607 if (!nIsUnit(pGetCoeff(p1))) return; 608 } 579 609 #endif 580 610 if (p1!=NULL) -
kernel/polys.h
rf4a33e ra8b44d 169 169 // tests (see polys-impl.cc ) 170 170 #define pGetShortExpVector(a) p_GetShortExpVector(a, currRing) 171 #ifdef HAVE_RINGS 172 /* divisibility check over ground ring (which may contain zero divisors); 173 TRUE iff LT(f) divides LT(g), i.e., LT(f)*c*m = LT(g), for some 174 coefficient c and some monomial m; 175 does not take components into account */ 176 BOOLEAN pDivisibleByRingCase(poly f, poly g); 177 #endif 171 178 172 179 /*************************************************************** -
kernel/polys1.cc
rf4a33e ra8b44d 1720 1720 if (rField_is_Ring(currRing)) 1721 1721 { 1722 if ((pLength(p1) == 1) && (nEqual(pGetCoeff(p1), pGetCoeff(p2)))) 1723 return TRUE; 1724 if (!nIsUnit(pGetCoeff(p2))) return FALSE; 1722 if (!nDivBy(pGetCoeff(p1), pGetCoeff(p2))) return FALSE; 1725 1723 } 1726 1724 #endif -
kernel/rmodulon.cc
rf4a33e ra8b44d 270 270 } 271 271 272 BOOLEAN nrnDivBy (number a, number b)272 BOOLEAN nrnDivBy (number a, number b) 273 273 { 274 274 if (a == NULL) 275 return mpz_divisible_p(currRing->nrnModul, (int_number) 275 return mpz_divisible_p(currRing->nrnModul, (int_number)b); 276 276 else 277 return mpz_divisible_p((int_number) a, (int_number) b); 278 /* 279 number bs = nrnGcd(a, b, currRing); 280 mpz_tdiv_q((int_number) bs, (int_number) b, (int_number) bs); 281 bool res = nrnIsUnit(bs); 282 nrnDelete(&bs, NULL); 283 return res; 284 */ 277 { /* b divides a iff b/gcd(a, b) is a unit in the given ring: */ 278 number n = nrnGcd(a, b, currRing); 279 mpz_tdiv_q((int_number)n, (int_number)b, (int_number)n); 280 bool result = nrnIsUnit(n); 281 nrnDelete(&n, NULL); 282 return result; 283 } 285 284 } 286 285
Note: See TracChangeset
for help on using the changeset viewer.