Changeset cfb769 in git
 Timestamp:
 Jul 9, 2015, 11:48:52 AM (8 years ago)
 Branches:
 (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
 Children:
 6497fdd7bf6eceae3c2f2cfdaec035bf5eb69755
 Parents:
 35a23c97dc27edb90d79faea3ca4dc136e382ea2
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

kernel/GBEngine/kutil.cc
r35a23c9 rcfb769 1168 1168 void enterOnePairRing (int i,poly p,int ecart, int isFromQ,kStrategy strat, int atR = 1) 1169 1169 { 1170 #if 0 1171 assume(i<=strat>sl); 1172 int l,j,compare,compareCoeff; 1173 LObject Lp; 1174 if (strat>interred_flag) return; 1175 #ifdef KDEBUG 1176 Lp.ecart=0; Lp.length=0; 1177 #endif 1178 /* computes the lcm(s[i],p) */ 1179 Lp.lcm = pInit(); 1180 pSetCoeff0(Lp.lcm, n_Lcm(pGetCoeff(p), pGetCoeff(strat>S[i]), currRing>cf)); 1181 1182 // Lp.lcm == 0 1183 if (nIsZero(pGetCoeff(Lp.lcm))) 1184 { 1185 #ifdef KDEBUG 1186 if (TEST_OPT_DEBUG) 1187 { 1188 PrintS(" Lp.lcm == 0\n"); 1189 PrintS("p:"); 1190 wrp(p); 1191 Print(" strat>S[%d]:", i); 1192 wrp(strat>S[i]); 1193 PrintLn(); 1194 } 1195 #endif 1196 strat>cp++; 1197 pLmDelete(Lp.lcm); 1198 return; 1199 } 1200 // basic product criterion 1201 pLcm(p,strat>S[i],Lp.lcm); 1202 1203 pSetm(Lp.lcm); 1204 assume(!strat>sugarCrit); 1205 if (pHasNotCF(p,strat>S[i]) && n_IsUnit(pGetCoeff(p),currRing>cf) 1206 && n_IsUnit(pGetCoeff(strat>S[i]),currRing>cf)) 1207 { 1208 #ifdef KDEBUG 1209 if (TEST_OPT_DEBUG) 1210 { 1211 PrintS(" product criterion func enterOnePairRing type 1\n"); 1212 PrintS("p:"); 1213 wrp(p); 1214 Print(" strat>S[%d]:", i); 1215 wrp(strat>S[i]); 1216 PrintLn(); 1217 } 1218 #endif 1219 strat>cp++; 1220 pLmDelete(Lp.lcm); 1221 return; 1222 } 1223 assume(!strat>fromT); 1224 /* 1225 *the set B collects the pairs of type (S[j],p) 1226 *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p) 1227 *if the leading term of s devides lcm(r,p) then (r,p) will be canceled 1228 *if the leading term of r devides lcm(s,p) then (s,p) will not enter B 1229 */ 1230 for(j = strat>Bl;j>=0;j) 1231 { 1232 compare=pDivCompRing(strat>B[j].lcm,Lp.lcm); 1233 compareCoeff = n_DivComp(pGetCoeff(strat>B[j].lcm), pGetCoeff(Lp.lcm), currRing>cf); 1234 if ((compareCoeff == pDivComp_EQUAL)  (compare == compareCoeff)) 1235 { 1236 if (compare == 1) 1237 { 1238 strat>c3++; 1239 #ifdef KDEBUG 1240 if (TEST_OPT_DEBUG) 1241 { 1242 PrintS(" chain criterion type 1\n"); 1243 PrintS("strat>B[j]:"); 1244 wrp(strat>B[j].lcm); 1245 PrintS(" Lp.lcm:"); 1246 wrp(Lp.lcm); 1247 PrintLn(); 1248 } 1249 #endif 1250 if ((strat>fromQ==NULL)  (isFromQ==0)  (strat>fromQ[i]==0)) 1251 { 1252 pLmDelete(Lp.lcm); 1253 return; 1254 } 1255 break; 1256 } 1257 else 1258 if (compare == 1) 1259 { 1260 #ifdef KDEBUG 1261 if (TEST_OPT_DEBUG) 1262 { 1263 PrintS(" chain criterion type 2\n"); 1264 Print("strat>B[%d].lcm:",j); 1265 wrp(strat>B[j].lcm); 1266 PrintS(" Lp.lcm:"); 1267 wrp(Lp.lcm); 1268 PrintLn(); 1269 } 1270 #endif 1271 deleteInL(strat>B,&strat>Bl,j,strat); 1272 strat>c3++; 1273 } 1274 } 1275 if ((compare == pDivComp_EQUAL) && (compareCoeff != 2)) 1276 { 1277 if (compareCoeff == pDivComp_LESS) 1278 { 1279 #ifdef KDEBUG 1280 if (TEST_OPT_DEBUG) 1281 { 1282 PrintS(" chain criterion type 3\n"); 1283 Print("strat>B[%d].lcm:", j); 1284 wrp(strat>B[j].lcm); 1285 PrintS(" Lp.lcm:"); 1286 wrp(Lp.lcm); 1287 PrintLn(); 1288 } 1289 #endif 1290 strat>c3++; 1291 if ((strat>fromQ==NULL)  (isFromQ==0)  (strat>fromQ[i]==0)) 1292 { 1293 pLmDelete(Lp.lcm); 1294 return; 1295 } 1296 break; 1297 } 1298 else 1299 // Add hint for same LM and LC (later) (TODO Oliver) 1300 // if (compareCoeff == pDivComp_GREATER) 1301 { 1302 #ifdef KDEBUG 1303 if (TEST_OPT_DEBUG) 1304 { 1305 PrintS(" chain criterion type 4\n"); 1306 Print("strat>B[%d].lcm:", j); 1307 wrp(strat>B[j].lcm); 1308 PrintS(" Lp.lcm:"); 1309 wrp(Lp.lcm); 1310 PrintLn(); 1311 } 1312 #endif 1313 deleteInL(strat>B,&strat>Bl,j,strat); 1314 strat>c3++; 1315 } 1316 } 1317 } 1318 /* 1319 *the pair (S[i],p) enters B if the spoly != 0 1320 */ 1321 /* compute the short spolynomial */ 1322 if ((strat>S[i]==NULL)  (p==NULL)) 1323 { 1324 #ifdef KDEBUG 1325 if (TEST_OPT_DEBUG) 1326 { 1327 PrintS(" spoly = NULL\n"); 1328 } 1329 #endif 1330 pLmDelete(Lp.lcm); 1331 return; 1332 } 1333 if ((strat>fromQ!=NULL) && (isFromQ!=0) && (strat>fromQ[i]!=0)) 1334 { 1335 // Is from a previous computed GB, therefore we know that spoly will 1336 // reduce to zero. Oliver. 1337 WarnS("Could we come here? 8738947389"); 1338 Lp.p=NULL; 1339 } 1340 else 1341 { 1342 Lp.p = ksCreateShortSpoly(strat>S[i], p, strat>tailRing); 1343 } 1344 if (Lp.p == NULL) 1345 { 1346 #ifdef KDEBUG 1347 if (TEST_OPT_DEBUG) 1348 { 1349 PrintS(" spoly = NULL\n"); 1350 } 1351 #endif 1352 /* the case that the spoly is 0 */ 1353 if (strat>pairtest==NULL) initPairtest(strat); 1354 strat>pairtest[i] = TRUE;/* hint for spoly(S^[i],p)=0 */ 1355 strat>pairtest[strat>sl+1] = TRUE; 1356 /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/ 1357 /* 1358 *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is 1359 *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not 1360 *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading 1361 *term of p devides the lcm(s,r) 1362 *(this canceling should be done here because 1363 *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit) 1364 *the first case is handeled in chainCrit 1365 */ 1366 pLmDelete(Lp.lcm); 1367 } 1368 else 1369 { 1370 /* the pair (S[i],p) enters B */ 1371 Lp.p1 = strat>S[i]; 1372 Lp.p2 = p; 1373 1374 pNext(Lp.p) = strat>tail; 1375 1376 if (atR >= 0) 1377 { 1378 Lp.i_r2 = atR; 1379 Lp.i_r1 = strat>S_2_R[i]; 1380 } 1381 strat>initEcartPair(&Lp,strat>S[i],p,strat>ecartS[i],ecart); 1382 l = strat>posInL(strat>L,strat>Ll,&Lp,strat); 1383 enterL(&strat>L,&strat>Ll,&strat>Lmax,Lp,l); 1384 } 1385 #else 1170 number s, t; 1386 1171 assume(i<=strat>sl); 1387 1172 assume(atR >= 0); … … 1500 1285 } 1501 1286 #endif 1502 number s, t;1503 1287 poly m1, m2, gcd; 1504 1288 #if ADIDEBUG … … 1512 1296 pSetCoeff0(m2, t); 1513 1297 pNeg(m2); 1514 p_Test(m1, 1515 p_Test(m2, 1298 p_Test(m1,strat>tailRing); 1299 p_Test(m2,strat>tailRing); 1516 1300 poly si = pCopy(strat>S[i]); 1517 1301 poly pm1 = pp_Mult_mm(pNext(p), m1, strat>tailRing); … … 1548 1332 } 1549 1333 p_Test(gcd, strat>tailRing); 1550 //p_LmDelete(m1, strat>tailRing);1551 //p_LmDelete(m2, strat>tailRing);1334 p_LmDelete(m1, strat>tailRing); 1335 p_LmDelete(m2, strat>tailRing); 1552 1336 #ifdef KDEBUG 1553 1337 if (TEST_OPT_DEBUG) … … 1685 1469 h.i_r1 = 1;h.i_r2 = 1; 1686 1470 if (currRing!=strat>tailRing) 1687 h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat>tailRing); 1471 { 1472 if (h.t_p==NULL) /* may already been set by pLdeg() in initEcart */ 1473 h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat>tailRing); 1474 } 1688 1475 #if 1 1689 1476 h.p1 = p;h.p2 = strat>S[i];
Note: See TracChangeset
for help on using the changeset viewer.