Changeset 206e158 in git for kernel/kutil.cc
- Timestamp:
- May 11, 2007, 12:48:05 PM (17 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- d15996cd44ce997d3360fac629f4062adb1c4836
- Parents:
- 3fd4df896525da08d34f33e88e6239994fa4d0e6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/kutil.cc
r3fd4df r206e158 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kutil.cc,v 1.5 2 2007-05-10 08:12:41wienand Exp $ */4 /* $Id: kutil.cc,v 1.53 2007-05-11 10:48:04 wienand Exp $ */ 5 5 /* 6 6 * ABSTRACT: kernel: utils for kStd … … 104 104 static poly redBba (poly h,int maxIndex,kStrategy strat); 105 105 106 #ifdef HAVE_RING 2TOM106 #ifdef HAVE_RINGS 107 107 #define pDivComp_EQUAL 2 108 108 #define pDivComp_LESS 1 … … 130 130 if (la < lb) 131 131 { 132 if (b) return 0;132 if (b) return pDivComp_INCOMP; 133 133 if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask)) 134 return 0;134 return pDivComp_INCOMP; 135 135 a = TRUE; 136 136 } 137 137 else 138 138 { 139 if (a) return 0;139 if (a) return pDivComp_INCOMP; 140 140 if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask)) 141 return 0;141 return pDivComp_INCOMP; 142 142 b = TRUE; 143 143 } 144 144 } 145 145 } 146 if (a) return 1;147 if (b) return -1;146 if (a) return pDivComp_LESS; 147 if (b) return pDivComp_GREATER; 148 148 if (!a & !b) return pDivComp_EQUAL; 149 149 } … … 492 492 } 493 493 494 #ifdef HAVE_RING2TOM495 //void initLMtest(kStrategy strat)496 //{497 // strat->lmtest = (unsigned int *)omAlloc0((strat->sl*strat->sl/2+2)*sizeof(BOOLEAN));498 //}499 #endif500 501 494 /*2 502 495 *test whether (p1,p2) or (p2,p1) is in L up position length … … 1022 1015 } 1023 1016 1024 #ifdef HAVE_RING2TOM 1025 /* TODO move to numbers.cc 1026 */ 1027 inline int nComp(NATNUMBER a, NATNUMBER b) 1028 { 1029 assume(a != 0 && b != 0); 1030 while (a % 2 == 0 && b % 2 == 0) 1031 { 1032 a = a / 2; 1033 b = b / 2; 1034 } 1035 if (a % 2 == 0) 1036 { 1037 return -1; 1038 } 1039 else 1040 { 1041 if (b % 2 == 1) 1042 { 1043 return 0; 1044 } 1045 else 1046 { 1047 return 1; 1048 } 1049 } 1050 } 1051 1017 #ifdef HAVE_RINGS 1052 1018 /*2 1053 1019 * put the pair (s[i],p) into the set B, ecart=ecart(p) (ring case) … … 1088 1054 { 1089 1055 compare=pDivCompRing(strat->B[j].lcm,Lp.lcm); 1090 compareCoeff = nComp( (long) pGetCoeff(strat->B[j].lcm), (long)pGetCoeff(Lp.lcm));1056 compareCoeff = nComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(Lp.lcm)); 1091 1057 if (compareCoeff == 0 || compare == compareCoeff) 1092 1058 { … … 1111 1077 { 1112 1078 // Add hint for same LM and direction of LC (later) (TODO Oliver) 1113 if (compareCoeff == 1)1079 if (compareCoeff == pDivComp_LESS) 1114 1080 { 1115 1081 strat->c3++; … … 1122 1088 } 1123 1089 else 1124 if (compareCoeff == -1)1090 if (compareCoeff == pDivComp_GREATER) 1125 1091 { 1126 1092 deleteInL(strat->B,&strat->Bl,j,strat); … … 1808 1774 } 1809 1775 1810 #ifdef HAVE_RING 2TOM1776 #ifdef HAVE_RINGS 1811 1777 /*2 1812 1778 *the pairset B of pairs of type (s[i],p) is complete now. It will be updated … … 1936 1902 } 1937 1903 } 1938 1904 #endif 1905 1906 #ifdef HAVE_RING2TOM 1939 1907 long twoPow(long arg) 1940 1908 { … … 1996 1964 { 1997 1965 compare=pDivCompRing(strat->B[j].lcm,Lp.lcm); 1998 compareCoeff = nComp( (long) pGetCoeff(strat->B[j].lcm), (long)pGetCoeff(Lp.lcm));1966 compareCoeff = nComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(Lp.lcm)); 1999 1967 if (compareCoeff == 0 || compare == compareCoeff) 2000 1968 { … … 2343 2311 idSkipZeroes(G0); 2344 2312 return G0; 2345 } 2346 2313 } 2314 #endif 2315 2316 #ifdef HAVE_RINGS 2347 2317 /*2 2348 2318 *(s[0],h),...,(s[k],h) will be put to the pairset L … … 2413 2383 void enterExtendedSpoly(poly h,kStrategy strat) 2414 2384 { 2415 if (((long) ((h)->coef)) % 2 == 0) 2416 { 2417 long a = ((long) ((h)->coef)) / 2; 2385 number gcd = nGcd((number) 0, pGetCoeff(h), strat->tailRing); 2386 if ((NATNUMBER) gcd > 1) 2387 { 2388 poly p = p_Copy(h->next, strat->tailRing); 2389 /* long a = ((long) ((h)->coef)) / 2; 2418 2390 long b = currRing->ch - 1; 2419 poly p = p_Copy(h->next, strat->tailRing);2420 2391 while (a % 2 == 0) 2421 2392 { … … 2423 2394 b--; 2424 2395 } 2425 p = p_Mult_nn(p, (number) twoPow(b), strat->tailRing); 2396 p = p_Mult_nn(p, (number) twoPow(b), strat->tailRing); */ 2397 p = p_Mult_nn(p, nIntDiv(0, gcd), strat->tailRing); 2426 2398 2427 2399 if (p != NULL) … … 2665 2637 else 2666 2638 { 2667 #ifdef HAVE_RING 2TOM2668 if (rField_is_Ring _2toM(currRing))2639 #ifdef HAVE_RINGS 2640 if (rField_is_Ring(currRing)) 2669 2641 { 2670 2642 if (pLmCmp(set[length],p)== -cmp_int) … … 5166 5138 else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18)) 5167 5139 strat->posInT = posInT1; 5168 #ifdef HAVE_RING 2TOM5140 #ifdef HAVE_RINGS 5169 5141 if (rField_is_Ring(currRing)) 5170 5142 { … … 5496 5468 // might be too strong 5497 5469 #ifdef HAVE_RINGS 5498 (strat->homog && pFDeg == pDeg && rField_is_Ring(currRing)), // TODO Oliver5470 (strat->homog && pFDeg == pDeg && !(rField_is_Ring(currRing))), // TODO Oliver 5499 5471 #else 5500 5472 (strat->homog && pFDeg == pDeg),
Note: See TracChangeset
for help on using the changeset viewer.