Changeset 15a55a5 in git
- Timestamp:
- Sep 14, 2018, 4:50:10 PM (6 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- b8c7320badf49a7c36b996413b1bf90743b4a312
- Parents:
- 5292886b6f6adce1c6a27dacf4fe27712caac11f
- Location:
- kernel/GBEngine
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/GBEngine/kspoly.cc
r529288 r15a55a5 940 940 // note: because of the crits, p2 is never shifted 941 941 int split = p_mFirstVblock(p1, tailRing); 942 // TODO: shouldn't we use p1 AND p2 here??943 942 k_SplitFrame(m1, m12, split, tailRing); 944 943 k_SplitFrame(m2, m22, split, tailRing); … … 946 945 n_Delete(&(m1->coef), tailRing->cf); 947 946 n_Delete(&(m2->coef), tailRing->cf); 948 949 a1 = p_LPshift(p_Copy(a1, tailRing), 1 - split, tailRing); // unshift a1950 947 } 951 948 … … 1008 1005 p_LmDelete(m22, tailRing); 1009 1006 // m2 is already deleted 1010 p_Delete(&a1, tailRing); // a1 is a copy: safe to destroy1011 1007 } 1012 1008 … … 1127 1123 { 1128 1124 poly a1 = pNext(p1), a2 = pNext(p2); 1125 #ifdef HAVE_SHIFTBBA 1126 int shift1, shift2; 1127 if (tailRing->isLPring) { 1128 // assume: LM is shifted, tail unshifted 1129 assume(p_FirstVblock(a1, tailRing) <= 1); 1130 assume(p_FirstVblock(a2, tailRing) <= 1); 1131 // save the shift of the LM so we can shift the other monomials on demand 1132 shift1 = p_mFirstVblock(p1, tailRing) - 1; 1133 shift2 = p_mFirstVblock(p2, tailRing) - 1; 1134 } 1135 #endif 1129 1136 long c1=p_GetComp(p1, currRing),c2=p_GetComp(p2, currRing); 1130 1137 long c; … … 1157 1164 #endif 1158 1165 1166 #ifdef HAVE_SHIFTBBA 1167 // shift the next monomial on demand 1168 if (tailRing->isLPring) 1169 { 1170 a1 = p_LPCopyAndShiftLM(a1, shift1, tailRing); 1171 a2 = p_LPCopyAndShiftLM(a2, shift2, tailRing); 1172 } 1173 #endif 1159 1174 if (a1==NULL) 1160 1175 { … … 1379 1394 } 1380 1395 #endif 1396 #ifdef HAVE_SHIFTBBA 1397 if (tailRing->isLPring) 1398 { 1399 a1 = p_LPCopyAndShiftLM(a1, shift1, tailRing); 1400 a2 = p_LPCopyAndShiftLM(a2, shift2, tailRing); 1401 } 1402 #endif 1381 1403 if (a2==NULL) 1382 1404 { -
kernel/GBEngine/kutil.cc
r529288 r15a55a5 12049 12049 static void enterOnePairManyShifts (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR) 12050 12050 { 12051 /* p comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */ 12052 12053 assume(p_LmCheckIsFromRing(p,currRing)); 12054 assume(p_CheckIsFromRing(pNext(p),strat->tailRing)); 12051 poly s = strat->S[i]; 12052 assume(i<=strat->sl); // from OnePair 12055 12053 12056 12054 /* cycles through all shifts of s[i] until uptodeg - lastVblock(s[i]) */ 12057 12055 /* that is create the pairs (f, s \dot g) */ 12058 12059 poly qq = strat->S[i]; // lm in currRing, tail in tailRing12060 12056 12061 12057 // poly q = pCopy(pHead(strat->S[i])); // lm in currRing … … 12066 12062 /* hence, a total number of elt's to add is: */ 12067 12063 /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */ 12068 int toInsert = itoInsert(qq, strat->tailRing); 12069 12070 #ifdef KDEBUG 12071 if (TEST_OPT_DEBUG) 12072 { 12073 // Print("entered ManyShifts: with toInsert=%d",toInsert); PrintLn(); 12074 } 12075 #endif 12076 12077 assume(i<=strat->sl); // from OnePair 12064 int toInsert = itoInsert(s, currRing); 12065 12078 12066 12079 12067 /* these vars hold for all shifts of s[i] */ … … 12090 12078 } 12091 12079 12092 int j;12093 12094 poly q/*, s*/;12095 12096 12080 // for the 0th shift: insert the orig. pair 12097 enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i); 12098 12099 for (j=1; j<= toInsert; j++) 12100 { 12101 // q = pLPshift(strat->S[i],j,uptodeg,lV); 12102 q = p_LPshiftT(qq, j, strat, currRing); 12103 // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial 12104 // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing 12105 // pNext(q) = s; // in tailRing 12106 /* here we need to call enterOnePair with two polys ... */ 12107 12108 #ifdef KDEBUG 12109 //if (TEST_OPT_DEBUG) 12110 //{ 12111 // PrintS("ManyShifts: calling enterOnePairShift(q,p)"); PrintLn(); 12112 //} 12113 #endif 12114 //kFindInTShift(q,atR,strat); 12081 enterOnePairShift(s, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i); 12082 12083 for (int j = 1; j <= toInsert; j++) 12084 { 12085 poly q = pLPCopyAndShiftLM(s, j); 12115 12086 enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i); 12116 12087 } … … 12125 12096 void enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int /*atR*/) 12126 12097 { 12127 12128 /* format: p,qq are in LObject form: lm in CR, tail in TR */12129 /* for true self pairs qq ==p */12130 /* we test both qq and p */12131 assume(p_LmCheckIsFromRing(qq,currRing));12132 assume(p_CheckIsFromRing(pNext(qq),strat->tailRing));12133 assume(p_LmCheckIsFromRing(p,currRing));12134 assume(p_CheckIsFromRing(pNext(p),strat->tailRing));12135 12136 /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 only */12137 12138 // int j = 0;12139 int j = 1;12140 12141 /* for such self pairs start with 1, not with 0 */12142 if (qq == p) j=1;12143 12144 12098 /* should cycle through all shifts of q until uptodeg - lastVblock(q) */ 12145 12099 /* that is create the pairs (f, s \dot g) */ 12146 12100 12147 int toInsert = itoInsert(qq, strat->tailRing); 12148 12149 #ifdef KDEBUG 12150 //if (TEST_OPT_DEBUG) 12151 //{ 12152 // Print("entered SelfShifts: with toInsert=%d",toInsert); PrintLn(); 12153 //} 12154 #endif 12155 12156 poly q; 12101 int toInsert = itoInsert(qq, currRing); 12157 12102 12158 12103 /* these vars hold for all shifts of s[i] */ … … 12160 12105 int qfromQ = 0; // strat->fromQ[i]; 12161 12106 12162 for (; j<= toInsert; j++) 12163 { 12164 // q = pLPshift(strat->S[i],j,uptodeg,lV); 12165 /* we increase shifts by one; must delete q there*/ 12166 // q = qq; q = pMoveCurrTail2poly(q,strat); 12167 // q = pLPshift(q,j,uptodeg,lV); //,currRing); 12168 q = p_LPshiftT(qq, j, strat, currRing); 12169 // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial 12170 // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing 12171 // pNext(q) = s; // in tailRing 12172 /* here we need to call enterOnePair with two polys ... */ 12173 #ifdef KDEBUG 12174 //if (TEST_OPT_DEBUG) 12175 //{ 12176 // PrintS("SelfShifts: calling enterOnePairShift(q,p)"); PrintLn(); 12177 //} 12178 #endif 12107 /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 */ 12108 for (int j = 1; j<= toInsert; j++) 12109 { 12110 poly q = pLPCopyAndShiftLM(qq, j); 12179 12111 enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1); 12180 12112 } … … 12596 12528 for (int i = 1; i <= toInsert; i++) 12597 12529 { 12598 poly shifted = p_mLPshift(p_Head(p.p, currRing), i, currRing);12599 pNext(shifted) = pNext(p.p);12600 12530 LObject qq; 12601 qq.p = shifted; // don't use Set() because it'll test the poly order12531 qq.p = pLPCopyAndShiftLM(p.p, i); // don't use Set() because it'll test the poly order 12602 12532 qq.shift = i; 12603 12533 strat->initEcart(&qq); // initEcartBBA sets length, pLength, FDeg and ecart -
kernel/GBEngine/shiftgb.cc
r529288 r15a55a5 35 35 #define freeT(A,v) omFreeSize((ADDRESS)A,(v+1)*sizeof(int)) 36 36 37 poly p_LPshiftT(poly p, int sh, kStrategy strat, const ring r)38 {39 /* assume shift takes place, shifts the poly p by sh */40 /* p is like TObject: lm in currRing = r, tail in tailRing */41 /* copies p */42 43 if (p==NULL) return(p);44 45 assume(p_LmCheckIsFromRing(p,r));46 assume(p_CheckIsFromRing(pNext(p),strat->tailRing));47 48 /* assume sh and uptodeg agree TODO check */49 50 if (sh == 0) return(p); /* the zero shift */51 52 poly q = NULL;53 poly s = p_mLPshift(p_Head(p,r), sh, r); // lm in currRing54 /* pNext(s) will be fixed below */55 poly pp = pNext(p);56 57 while (pp != NULL)58 {59 poly h=p_mLPshift(p_Head(pp,strat->tailRing),sh,strat->tailRing);60 pIter(pp);61 62 q = p_Add_q(q, h,strat->tailRing);63 }64 pNext(s) = q;65 /* int version: returns TRUE if it was successful */66 return(s);67 }68 69 37 poly p_LPshift(poly p, int sh, const ring r) 70 38 { 71 /* assume shift takes place */ 72 /* shifts the poly p from the ring r by sh */ 73 74 /* assume sh and uptodeg agree TODO check */ 75 76 if (sh == 0) return(p); /* the zero shift */ 39 if (sh == 0 || p == NULL) return(p); 77 40 78 41 poly q = NULL; … … 91 54 poly p_mLPshift(poly p, int sh, const ring r) 92 55 { 93 /* p is a monomial from the ring r */94 95 int lV = r->isLPring;96 97 56 if (sh == 0 || p == NULL || p_LmIsConstantComp(p,r)) return(p); 57 58 int lV = r->isLPring; 98 59 99 60 int L = p_mLastVblock(p,r); … … 126 87 // p_SetCoeff0(m,p_GetCoeff(p,r),r); 127 88 return(p); 89 } 90 91 poly p_LPCopyAndShiftLM(poly p, int sh, const ring r) 92 { 93 if (sh == 0 || p == NULL) return p; 94 poly q = p_mLPshift(p_Head(p, r), sh, r); 95 pNext(q) = pNext(p); 96 return q; 128 97 } 129 98 … … 328 297 m1 = p_GetExp_k_n(m1, hole, r->N, r); 329 298 330 p_ LPshift(m2, 1 - p_mFirstVblock(m2, r), r);299 p_mLPshift(m2, 1 - p_mFirstVblock(m2, r), r); 331 300 p_SetCoeff(m1, m1Coeff, r); 332 301 } -
kernel/GBEngine/shiftgb.h
r529288 r15a55a5 12 12 #include "polys/nc/nc.h" 13 13 14 poly p_LPshiftT(poly p, int sh, kStrategy strat, const ring r);15 16 14 poly p_LPshift(poly p, int sh, const ring r); 17 15 poly p_mLPshift(poly p, int sh, const ring r); 16 poly p_LPCopyAndShiftLM(poly p, int sh, const ring r); 18 17 18 #define pLPshift(p, sh) p_LPshift(p, sh, currRing) 19 #define pmLPshift(p, sh) p_mLPshift(p, sh, currRing) 20 #define pLPCopyAndShiftLM(p, sh) p_LPCopyAndShiftLM(p, sh, currRing) 21 22 int p_LastVblock(poly p, const ring r); 19 23 int p_mLastVblock(poly p, const ring r); 20 int p_LastVblock(poly p, const ring r);21 24 22 25 #define pLastVblock(p) p_LastVblock(p,currRing)
Note: See TracChangeset
for help on using the changeset viewer.