Changeset 9f17c9 in git
- Timestamp:
- Apr 23, 2009, 7:28:07 PM (15 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- 06f49a74058e21b60e4d16caee96019a21543062
- Parents:
- 822aa3ad9062852dd98789a4bd54970e85327ef2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/kutil.cc
r822aa3a r9f17c9 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kutil.cc,v 1.13 4 2009-04-10 19:01:11 motsakExp $ */4 /* $Id: kutil.cc,v 1.135 2009-04-23 17:28:07 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: kernel: utils for kStd … … 169 169 q,currRing, 170 170 currRing->real_var_start, currRing->real_var_end)) 171 return 0; 171 return 0; 172 172 return pLmCmp(q,p); // ONLY FOR GLOBAL ORDER! 173 173 } … … 1557 1557 else 1558 1558 { 1559 Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing); 1559 Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing); 1560 1560 nc_CreateShortSpoly(strat->S[i], p, currRing); 1561 1561 1562 assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used 1562 assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used 1563 1563 pNext(Lp.p) = strat->tail; // !!! 1564 1564 } … … 1566 1566 else 1567 1567 { 1568 Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing); 1568 Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing); 1569 1569 nc_CreateShortSpoly(strat->S[i], p, currRing); 1570 1570 1571 assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used 1571 assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used 1572 1572 pNext(Lp.p) = strat->tail; // !!! 1573 1573 1574 1574 } 1575 1575 1576 1576 1577 1577 #if MYTEST 1578 1578 if (TEST_OPT_DEBUG) … … 1582 1582 PrintS("SPoly: "); pWrite(Lp.p); 1583 1583 } 1584 #endif 1585 1584 #endif 1585 1586 1586 } 1587 1587 else … … 1597 1597 PrintS("commutative SPoly: "); pWrite(Lp.p); 1598 1598 } 1599 #endif 1599 #endif 1600 1600 1601 1601 } … … 1627 1627 if ( 1628 1628 (!rIsPluralRing(currRing)) 1629 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie)) 1629 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie)) 1630 1630 ) 1631 1631 { 1632 assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used 1632 assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used 1633 1633 pNext(Lp.p) = strat->tail; // !!! 1634 1634 } … … 2006 2006 if(TEST_OPT_DEBUG) 2007 2007 { 2008 Print("chain-crit-part: S[%d]=",j); 2008 Print("chain-crit-part: S[%d]=",j); 2009 2009 p_wrp(strat->S[j],currRing); 2010 2010 Print(" divide B[%d].lcm=",i); … … 2041 2041 if(TEST_OPT_DEBUG) 2042 2042 { 2043 PrintS("chain-crit-part: pCompareChainPart p="); 2043 PrintS("chain-crit-part: pCompareChainPart p="); 2044 2044 p_wrp(p,currRing); 2045 2045 Print(" delete L[%d]",j); … … 2072 2072 if(TEST_OPT_DEBUG) 2073 2073 { 2074 Print("chain-crit-part: sugar B[%d].lcm=",j); 2074 Print("chain-crit-part: sugar B[%d].lcm=",j); 2075 2075 p_wrp(strat->B[j].lcm,currRing); 2076 2076 Print(" delete B[%d]",i); … … 2085 2085 if(TEST_OPT_DEBUG) 2086 2086 { 2087 Print("chain-crit-part: sugar B[%d].lcm=",i); 2087 Print("chain-crit-part: sugar B[%d].lcm=",i); 2088 2088 p_wrp(strat->B[i].lcm,currRing); 2089 2089 Print(" delete B[%d]",j); … … 2115 2115 if(TEST_OPT_DEBUG) 2116 2116 { 2117 PrintS("chain-crit-part: sugar:pCompareChainPart p="); 2117 PrintS("chain-crit-part: sugar:pCompareChainPart p="); 2118 2118 p_wrp(p,currRing); 2119 2119 Print(" delete L[%d]",j); … … 2141 2141 if(TEST_OPT_DEBUG) 2142 2142 { 2143 Print("chain-crit-part: equal lcm B[%d].lcm=",j); 2143 Print("chain-crit-part: equal lcm B[%d].lcm=",j); 2144 2144 p_wrp(strat->B[j].lcm,currRing); 2145 2145 Print(" delete B[%d]\n",i); … … 2168 2168 if(TEST_OPT_DEBUG) 2169 2169 { 2170 PrintS("chain-crit-part: pCompareChainPart p="); 2170 PrintS("chain-crit-part: pCompareChainPart p="); 2171 2171 p_wrp(p,currRing); 2172 2172 Print(" delete L[%d]",j); … … 2232 2232 if(TEST_OPT_DEBUG) 2233 2233 { 2234 PrintS("chain-crit-part: divisible_by p="); 2234 PrintS("chain-crit-part: divisible_by p="); 2235 2235 p_wrp(p,currRing); 2236 2236 Print(" delete L[%d]",l); … … 2245 2245 if(TEST_OPT_DEBUG) 2246 2246 { 2247 PrintS("chain-crit-part: divisible_by(2) p="); 2247 PrintS("chain-crit-part: divisible_by(2) p="); 2248 2248 p_wrp(p,currRing); 2249 2249 Print(" delete L[%d]",i); … … 2320 2320 } 2321 2321 2322 if (new_pair) 2322 if (new_pair) 2323 2323 { 2324 2324 #ifdef HAVE_RATGRING … … 3112 3112 3113 3113 if (strat->noClearS) return; 3114 3114 3115 3115 // #ifdef HAVE_PLURAL 3116 3116 /* … … 3128 3128 k--; 3129 3129 } 3130 3130 3131 3131 j++; 3132 3132 } 3133 } 3133 } 3134 3134 else 3135 */ 3136 // #endif // ??? Why was the following cancelation disabled for non-commutative rings? 3137 { 3135 */ 3136 // #endif // ??? Why was the following cancelation disabled for non-commutative rings? 3137 { 3138 3138 j=pos; 3139 3139 loop … … 4542 4542 if (cnt==0) 4543 4543 { 4544 cnt=REDTAIL_CANONICALIZE; 4545 poly tmp=Ln.CanonicalizeP(); 4546 if (normalize) 4544 cnt=REDTAIL_CANONICALIZE; 4545 poly tmp=Ln.CanonicalizeP(); 4546 if (normalize) 4547 4547 { 4548 4548 Ln.Normalize(); … … 4887 4887 /*- test, if a unit is in F -*/ 4888 4888 4889 if ((strat->Ll>=0) 4889 if ((strat->Ll>=0) 4890 4890 #ifdef HAVE_RINGS 4891 4891 && nIsUnit(pGetCoeff(strat->L[strat->Ll].p)) … … 5524 5524 assume(!p.is_normalized || nIsOne(pGetCoeff(p.p))); 5525 5525 5526 #ifdef KDEBUG 5526 #ifdef KDEBUG 5527 5527 // do not put an LObject twice into T: 5528 5528 for(i=strat->tl;i>=0;i--) 5529 5529 { 5530 if (p.p==strat->T[i].p) 5530 if (p.p==strat->T[i].p) 5531 5531 { 5532 5532 printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT); … … 5534 5534 } 5535 5535 } 5536 #endif 5536 #endif 5537 5537 strat->newt = TRUE; 5538 5538 if (atT < 0) … … 5943 5943 { 5944 5944 int i; 5945 int low = ( pOrdSgn == 1? 1 : 0);5945 int low = (((pOrdSgn==1) && (strat->fromQ==NULL) ? 1 : 0); 5946 5946 LObject L; 5947 5947 … … 5964 5964 for (i=strat->sl; i>=low; i--) 5965 5965 { 5966 int end_pos=strat->sl; 5967 if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i 5968 if (strat->ak==0) end_pos=i-1; 5966 5969 TObject* T_j = strat->s_2_t(i); 5967 5970 if (T_j != NULL) … … 5970 5973 poly p; 5971 5974 if (pOrdSgn == 1) 5972 strat->S[i] = redtailBba(&L, i-1, strat, withT);5975 strat->S[i] = redtailBba(&L, end_pos, strat, withT); 5973 5976 else 5974 5977 strat->S[i] = redtail(&L, strat->sl, strat); … … 5989 5992 assume(currRing == strat->tailRing); 5990 5993 if (pOrdSgn == 1) 5991 strat->S[i] = redtailBba(strat->S[i], i-1, strat, withT);5994 strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT); 5992 5995 else 5993 5996 strat->S[i] = redtail(strat->S[i], strat->sl, strat); … … 6019 6022 else 6020 6023 scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing); 6021 #else 6024 #else 6022 6025 scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing); 6023 #endif 6026 #endif 6024 6027 if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing); 6025 6028 if (strat->tailRing != currRing) … … 6516 6519 { 6517 6520 /* assume: p is completely in currRing */ 6518 /* produces an object with LM in curring 6521 /* produces an object with LM in curring 6519 6522 and TAIL in tailring */ 6520 6523 if (pNext(p)!=NULL) … … 6585 6588 /* creates LObject from the poly in currRing */ 6586 6589 /* actually put p into L.p and make L.t_p=NULL : does not work */ 6587 6590 6588 6591 //} 6589 6592 … … 6615 6618 // { 6616 6619 // p = p_ShallowCopyDelete(h.p, (strat->tailRing != NULL ? strat->tailRing : currRing), strat->tailBin); 6617 // } 6620 // } 6618 6621 // return(p); 6619 6622 // } … … 6773 6776 /* these vars hold for all shifts of s[i] */ 6774 6777 int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart 6775 6778 6776 6779 int qfromQ; 6777 6780 if (strat->fromQ != NULL) 6778 6781 { 6779 qfromQ = strat->fromQ[i]; 6782 qfromQ = strat->fromQ[i]; 6780 6783 } 6781 6784 else … … 6791 6794 enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV); 6792 6795 6793 for (j=1; j<= toInsert; j++) 6796 for (j=1; j<= toInsert; j++) 6794 6797 { 6795 6798 // q = pLPshift(strat->S[i],j,uptodeg,lV); 6796 q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing); 6799 q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing); 6797 6800 // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial 6798 6801 // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing … … 6853 6856 /* these vars hold for all shifts of s[i] */ 6854 6857 int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart 6855 int qfromQ = 0; // strat->fromQ[i]; 6858 int qfromQ = 0; // strat->fromQ[i]; 6856 6859 6857 6860 for (; j<= toInsert; j++) … … 6898 6901 // wrp(q); // wrp(pHead(q)); 6899 6902 // PrintS(", p = "); 6900 // wrp(p); //wrp(pHead(p)); 6903 // wrp(p); //wrp(pHead(p)); 6901 6904 // PrintLn(); 6902 6905 } … … 6933 6936 wrp(q); // wrp(pHead(q)); 6934 6937 PrintS(", p = "); 6935 wrp(p); //wrp(pHead(p)); 6938 wrp(p); //wrp(pHead(p)); 6936 6939 PrintLn(); 6937 6940 } … … 7108 7111 // else 7109 7112 // { 7110 7113 7111 7114 /* ksCreateShortSpoly needs two Lobject-kind presentations */ 7112 7115 /* p is already in this form, so convert q */ … … 7139 7142 /*- the pair (S[i],p) enters B -*/ 7140 7143 /* both of them should have their LM in currRing and TAIL in tailring */ 7141 Lp.p1 = q; // already in the needed form 7142 Lp.p2 = p; // already in the needed form 7144 Lp.p1 = q; // already in the needed form 7145 Lp.p2 = p; // already in the needed form 7143 7146 7144 7147 if ( !rIsPluralRing(currRing) ) … … 7149 7152 if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) ) 7150 7153 { 7151 Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS]; 7154 Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS]; 7152 7155 Lp.i_r2 = atR; 7153 7156 } … … 7300 7303 if (atT < 0) 7301 7304 atT = strat->posInT(strat->T, strat->tl, p); 7302 7305 7303 7306 /* can call enterT in a sequence, e.g. */ 7304 7307 … … 7309 7312 { 7310 7313 qq = p; //qq.Copy(); 7311 qq.p = NULL; 7314 qq.p = NULL; 7312 7315 qq.max = NULL; 7313 7316 qq.t_p = p_LPshift(p_Copy(p.t_p,strat->tailRing), i, uptodeg, lV, strat->tailRing); // direct shift
Note: See TracChangeset
for help on using the changeset viewer.