Changeset b97cce6 in git
- Timestamp:
- Oct 7, 2022, 3:47:59 PM (19 months ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 823db5eb586880d00810d3443c78a45dfbf5a419
- Parents:
- 220bb42fbc1cc6ed2ae16e15cd080008696728fe
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2022-10-07 15:47:59+02:00
- git-committer:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2022-10-07 15:48:32+02:00
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/GBEngine/janet.cc
r220bb4 rb97cce6 100 100 number coef; 101 101 if (y->root_l<=0) y->root_l=pLength(y->root); 102 coef=kBucketPolyRed(x->root_b,y->root,y->root_l,NULL ,FALSE);102 coef=kBucketPolyRed(x->root_b,y->root,y->root_l,NULL); 103 103 nDelete(&coef); 104 104 x->root=kBucketGetLm(x->root_b); -
kernel/GBEngine/kstd2.cc
r220bb4 rb97cce6 2187 2187 #ifdef HAVE_RINGS 2188 2188 BOOLEAN is_ring = rField_is_Ring(currRing); 2189 if(is_ring) nonorm=TRUE; 2189 2190 #endif 2190 2191 #ifdef KDEBUG … … 2198 2199 // } 2199 2200 // }; 2201 #endif 2202 2203 loop 2204 { 2205 j=kFindDivisibleByInS(strat,&max_ind,&P); 2206 while ((j>=0) 2207 && (nonorm) 2208 && (!n_DivBy(pGetCoeff(P.p),pGetCoeff(strat->S[j]),currRing->cf))) 2209 j=kFindNextDivisibleByInS(strat,j+1,max_ind,&P); 2210 if (j>=0) 2211 { 2212 #ifdef HAVE_RINGS 2213 if (!is_ring) 2214 { 2215 #endif 2216 int sl=pSize(strat->S[j]); 2217 int jj=j; 2218 loop 2219 { 2220 int sll; 2221 jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P); 2222 if (jj<0) break; 2223 if ((!nonorm) 2224 || (n_DivBy(pGetCoeff(P.p),pGetCoeff(strat->S[jj]),currRing->cf))) 2225 { 2226 sll=pSize(strat->S[jj]); 2227 if (sll<sl) 2228 { 2229 #ifdef KDEBUG 2230 if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll); 2231 #endif 2232 //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); } 2233 j=jj; 2234 sl=sll; 2235 } 2236 } 2237 } 2238 if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j])))) 2239 { 2240 pNorm(strat->S[j]); 2241 //if (TEST_OPT_PROT) { PrintS("n"); mflush(); } 2242 } 2243 #ifdef HAVE_RINGS 2244 } 2245 #endif 2246 nNormalize(pGetCoeff(P.p)); 2247 #ifdef KDEBUG 2248 if (TEST_OPT_DEBUG) 2249 { 2250 PrintS("red:"); 2251 wrp(h); 2252 PrintS(" with "); 2253 wrp(strat->S[j]); 2254 } 2255 #endif 2256 #ifdef HAVE_PLURAL 2257 if (rIsPluralRing(currRing)) 2258 { 2259 number coef; 2260 nc_kBucketPolyRed_NF(P.bucket,strat->S[j],&coef,nonorm); 2261 nDelete(&coef); 2262 } 2263 else 2264 #endif 2265 { 2266 kBucketPolyRedNF(P.bucket,strat->S[j],pLength(strat->S[j]), 2267 strat->kNoether); 2268 } 2269 cnt--; 2270 if (cnt==0) 2271 { 2272 kBucketCanonicalize(P.bucket); 2273 cnt=REDNF_CANONICALIZE; 2274 } 2275 h = kBucketGetLm(P.bucket); // FRAGE OLIVER 2276 if (h==NULL) 2277 { 2278 kBucketDestroy(&P.bucket); 2279 return NULL; 2280 } 2281 kbTest(P.bucket); 2282 P.p=h; 2283 P.t_p=NULL; 2284 P.SetShortExpVector(); 2285 #ifdef KDEBUG 2286 if (TEST_OPT_DEBUG) 2287 { 2288 PrintS("\nto:"); 2289 wrp(h); 2290 PrintLn(); 2291 } 2292 #endif 2293 } 2294 else 2295 { 2296 P.p=kBucketClear(P.bucket); 2297 kBucketDestroy(&P.bucket); 2298 pNormalize(P.p); 2299 return P.p; 2300 } 2301 } 2302 } 2303 2304 /*2 2305 * reduction procedure from global case but with jet bound 2306 */ 2307 2308 poly redNFBound (poly h,int &max_ind,int nonorm,kStrategy strat,int bound) 2309 { 2310 h = pJet(h,bound); 2311 if (h==NULL) return NULL; 2312 int j; 2313 max_ind=strat->sl; 2314 2315 if (0 > strat->sl) 2316 { 2317 return h; 2318 } 2319 LObject P(h); 2320 P.SetShortExpVector(); 2321 P.bucket = kBucketCreate(currRing); 2322 kBucketInit(P.bucket,P.p,pLength(P.p)); 2323 kbTest(P.bucket); 2324 #ifdef HAVE_RINGS 2325 BOOLEAN is_ring = rField_is_Ring(currRing); 2200 2326 #endif 2201 2327 … … 2249 2375 { 2250 2376 number coef; 2251 nc_kBucketPolyRed_NF(P.bucket,strat->S[j],&coef,nonorm ==0);2377 nc_kBucketPolyRed_NF(P.bucket,strat->S[j],&coef,nonorm); 2252 2378 nDelete(&coef); 2253 2379 } … … 2255 2381 #endif 2256 2382 { 2257 number coef; 2258 coef=kBucketPolyRed(P.bucket,strat->S[j],pLength(strat->S[j]), 2259 strat->kNoether,nonorm==0); 2260 nDelete(&coef); 2261 } 2262 cnt--; 2263 if (cnt==0) 2264 { 2265 kBucketCanonicalize(P.bucket); 2266 cnt=REDNF_CANONICALIZE; 2267 } 2268 h = kBucketGetLm(P.bucket); // FRAGE OLIVER 2269 if (h==NULL) 2270 { 2271 kBucketDestroy(&P.bucket); 2272 return NULL; 2273 } 2274 kbTest(P.bucket); 2275 P.p=h; 2276 P.t_p=NULL; 2277 P.SetShortExpVector(); 2278 #ifdef KDEBUG 2279 if (TEST_OPT_DEBUG) 2280 { 2281 PrintS("\nto:"); 2282 wrp(h); 2283 PrintLn(); 2284 } 2285 #endif 2286 } 2287 else 2288 { 2289 P.p=kBucketClear(P.bucket); 2290 kBucketDestroy(&P.bucket); 2291 pNormalize(P.p); 2292 return P.p; 2293 } 2294 } 2295 } 2296 2297 /*2 2298 * reduction procedure from global case but with jet bound 2299 */ 2300 2301 poly redNFBound (poly h,int &max_ind,int nonorm,kStrategy strat,int bound) 2302 { 2303 h = pJet(h,bound); 2304 if (h==NULL) return NULL; 2305 int j; 2306 max_ind=strat->sl; 2307 2308 if (0 > strat->sl) 2309 { 2310 return h; 2311 } 2312 LObject P(h); 2313 P.SetShortExpVector(); 2314 P.bucket = kBucketCreate(currRing); 2315 kBucketInit(P.bucket,P.p,pLength(P.p)); 2316 kbTest(P.bucket); 2317 #ifdef HAVE_RINGS 2318 BOOLEAN is_ring = rField_is_Ring(currRing); 2319 #endif 2320 2321 loop 2322 { 2323 j=kFindDivisibleByInS(strat,&max_ind,&P); 2324 if (j>=0) 2325 { 2326 #ifdef HAVE_RINGS 2327 if (!is_ring) 2328 { 2329 #endif 2330 int sl=pSize(strat->S[j]); 2331 int jj=j; 2332 loop 2333 { 2334 int sll; 2335 jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P); 2336 if (jj<0) break; 2337 sll=pSize(strat->S[jj]); 2338 if (sll<sl) 2339 { 2340 #ifdef KDEBUG 2341 if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll); 2342 #endif 2343 //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); } 2344 j=jj; 2345 sl=sll; 2346 } 2347 } 2348 if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j])))) 2349 { 2350 pNorm(strat->S[j]); 2351 //if (TEST_OPT_PROT) { PrintS("n"); mflush(); } 2352 } 2353 #ifdef HAVE_RINGS 2354 } 2355 #endif 2356 nNormalize(pGetCoeff(P.p)); 2357 #ifdef KDEBUG 2358 if (TEST_OPT_DEBUG) 2359 { 2360 PrintS("red:"); 2361 wrp(h); 2362 PrintS(" with "); 2363 wrp(strat->S[j]); 2364 } 2365 #endif 2366 #ifdef HAVE_PLURAL 2367 if (rIsPluralRing(currRing)) 2368 { 2369 number coef; 2370 nc_kBucketPolyRed_NF(P.bucket,strat->S[j],&coef,nonorm==0); 2371 nDelete(&coef); 2372 } 2373 else 2374 #endif 2375 { 2376 number coef; 2377 coef=kBucketPolyRed(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether,nonorm==0); 2383 kBucketPolyRedNF(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether); 2378 2384 P.p = kBucketClear(P.bucket); 2379 2385 P.p = pJet(P.p,bound); … … 2385 2391 kBucketInit(P.bucket,P.p,pLength(P.p)); 2386 2392 } 2387 nDelete(&coef);2388 2393 } 2389 2394 h = kBucketGetLm(P.bucket); // FRAGE OLIVER -
kernel/GBEngine/syz0.cc
r220bb4 rb97cce6 685 685 pSetComp(lastmonom,l+1); 686 686 //computes the new toRed 687 number up = kBucketPolyRed(sy0buck,F[l],Flength[l],NULL ,FALSE);687 number up = kBucketPolyRed(sy0buck,F[l],Flength[l],NULL); 688 688 if (! nIsOne(up)) 689 689 { -
kernel/GBEngine/syz1.cc
r220bb4 rb97cce6 833 833 pGetCoeff(p) = nInpNeg(pGetCoeff(p)); 834 834 number up = kBucketPolyRed(syzstr->bucket,redset[j],elL[bin[j]], 835 NULL ,FALSE);835 NULL); 836 836 // Thomas: Check whether you need number here 837 837 nDelete(&up); -
kernel/GBEngine/syz2.cc
r220bb4 rb97cce6 422 422 { 423 423 number up = kBucketPolyRed(syzstr->bucket,redWith->m[i], 424 pLength(redWith->m[i]), NULL , FALSE);424 pLength(redWith->m[i]), NULL); 425 425 nDelete(&up); 426 426 q = kBucketGetLm(syzstr->bucket); … … 624 624 sySPRedSyz(syzstr,redset[j],q); 625 625 number up = kBucketPolyRed(syzstr->bucket,redset[j].p, 626 redset[j].length, NULL , FALSE);626 redset[j].length, NULL); 627 627 nDelete(&up); 628 628 q = kBucketGetLm(syzstr->bucket); -
kernel/GBEngine/syz3.cc
r220bb4 rb97cce6 497 497 if ((red->m[j]!=NULL) && (pDivisibleBy(red->m[j],p))) 498 498 { 499 n = kBucketPolyRed(bucket,red->m[j], g_l[j], NULL , FALSE);499 n = kBucketPolyRed(bucket,red->m[j], g_l[j], NULL); 500 500 nDelete(&n); 501 501 p = kBucketGetLm(bucket); … … 789 789 sySPRedSyz_Kosz(syzstr,new_generators->m[j],new_repr->m[j],p); 790 790 n = kBucketPolyRed(syzstr->bucket,new_generators->m[j], 791 pLength(new_generators->m[j]), NULL , FALSE);791 pLength(new_generators->m[j]), NULL); 792 792 p = kBucketGetLm(syzstr->bucket); 793 793 #ifdef EXPERIMENT1 … … 811 811 assume (old_repr->m[j]!=NULL); 812 812 sySPRedSyz_Kosz(syzstr,ogm[j],old_repr->m[j],p,orp_l[j]); 813 n = kBucketPolyRed(syzstr->bucket,ogm[j],ogm_l[j], NULL ,FALSE);813 n = kBucketPolyRed(syzstr->bucket,ogm[j],ogm_l[j], NULL); 814 814 p = kBucketGetLm(syzstr->bucket); 815 815 #ifdef EXPERIMENT1 … … 1039 1039 { 1040 1040 n = kBucketPolyRed(syzstr->bucket,add_generators->m[j], g_l[j], 1041 NULL , FALSE);1041 NULL); 1042 1042 nDelete(&n); 1043 1043 p = kBucketGetLm(syzstr->bucket); … … 1303 1303 sySPRedSyz_Kosz(syzstr,add_generators->m[j],add_repr->m[j],p); 1304 1304 n = kBucketPolyRed(syzstr->bucket,add_generators->m[j], 1305 pLength(add_generators->m[j]), NULL , FALSE);1305 pLength(add_generators->m[j]), NULL); 1306 1306 p = kBucketGetLm(syzstr->bucket); 1307 1307 if ((p==NULL) || (pGetComp(p)<=crit_comp)) break; … … 1578 1578 sySPRedSyz_Kosz(syzstr,old_generators->m[j],old_repr->m[j],p); 1579 1579 n = kBucketPolyRed(syzstr->bucket,old_generators->m[j], g_l[j], 1580 NULL , FALSE);1580 NULL); 1581 1581 nDelete(&n); 1582 1582 p = kBucketGetLm(syzstr->bucket); -
kernel/GBEngine/tgb.cc
r220bb4 rb97cce6 1834 1834 number coef = kBucketPolyRed (P.bucket, strat->S[j], 1835 1835 strat->lenS[j] /*pLength(strat->S[j]) */ , 1836 strat->kNoether ,FALSE);1836 strat->kNoether); 1837 1837 number m2 = nMult (m, coef); 1838 1838 nDelete (&m); … … 3047 3047 coef = kBucketPolyRed (P.bucket, strat->S[j], 3048 3048 strat->lenS[j] /*pLength(strat->S[j]) */ , 3049 strat->kNoether ,FALSE);3049 strat->kNoether); 3050 3050 res=__p_Mult_nn (res, coef, currRing); 3051 3051 nDelete (&coef); … … 4893 4893 else 4894 4894 #endif 4895 coef = kBucketPolyRed (ro.bucket, p, p_len, c->strat->kNoether ,FALSE);4895 coef = kBucketPolyRed (ro.bucket, p, p_len, c->strat->kNoether); 4896 4896 nDelete (&coef); 4897 4897 } -
libpolys/polys/kbuckets.cc
r220bb4 rb97cce6 1083 1083 number kBucketPolyRed(kBucket_pt bucket, 1084 1084 poly p1, int l1, 1085 poly spNoether, 1086 BOOLEAN reduce) 1085 poly spNoether) 1087 1086 { 1088 1087 ring r=bucket->bucket_ring; … … 1108 1107 { 1109 1108 number an = pGetCoeff(p1), bn = pGetCoeff(lm); 1110 //StringSetS("##### an = "); nWrite(an); PrintS(StringEndS("\n")); // NOTE/TODO: use StringAppendS("\n"); omFree(s);1111 //StringSetS("##### bn = "); nWrite(bn); PrintS(StringEndS("\n")); // NOTE/TODO: use StringAppendS("\n"); omFree(s);1112 1109 /* ksCheckCoeff: divide out gcd from an and bn: */ 1113 1110 int ct = ksCheckCoeff(&an, &bn,r->cf); … … 1119 1116 if ((ct == 0) || (ct == 2)) 1120 1117 { 1121 if (reduce)1122 {1123 if(n_IsMOne(an,r->cf))1124 {1125 an=n_InpNeg(an,r->cf);1126 bn=n_InpNeg(bn,r->cf);1127 }1128 #if 1 //#ifdef KDEBUG1129 else if (!n_IsOne(an,r->cf))1130 {1131 StringSetS("kBucketPolyRed: ");1132 n_Write(an,r->cf);1133 StringAppendS("\n");1134 PrintS(StringEndS());1135 }1136 #endif1137 }1138 1118 /* correct factor for cancelation by changing sign if an=-1 */ 1139 1119 if (rField_is_Ring(r)) … … 1216 1196 kbTest(bucket); 1217 1197 return rn; 1198 } 1199 1200 void kBucketPolyRedNF(kBucket_pt bucket, 1201 poly p1, int l1, 1202 poly spNoether) 1203 { 1204 ring r=bucket->bucket_ring; 1205 assume((!rIsPluralRing(r))||p_LmEqual(p1,kBucketGetLm(bucket), r)); 1206 assume(p1 != NULL && 1207 p_DivisibleBy(p1, kBucketGetLm(bucket), r)); 1208 assume(pLength(p1) == (unsigned) l1); 1209 1210 poly a1 = pNext(p1), lm = kBucketExtractLm(bucket); 1211 BOOLEAN reset_vec=FALSE; 1212 1213 /* we shall reduce bucket=bn*lm+... by p1=an*t+a1 where t=lm(p1) 1214 and an,bn shall be defined further down only if lc(p1)!=1 1215 we already know: an|bn and t|lm */ 1216 if(a1==NULL) 1217 { 1218 p_LmDelete(&lm, r); 1219 return; 1220 } 1221 1222 #ifdef KDEBUG 1223 if (n_DivBy(pGetCoeff(lm),pGetCoeff(p1),r->cf)) 1224 #endif 1225 { 1226 number c=n_Div(pGetCoeff(lm),pGetCoeff(p1),r->cf); 1227 //StringSetS("mult cf:");n_Write(c,r->cf);StringAppendS("\n"); 1228 //PrintS(StringEndS()); 1229 #ifdef KDEBUG 1230 if (n_IsZero(c,r->cf)) 1231 { 1232 StringSetS("a/b: ");n_Write(pGetCoeff(lm),r->cf);StringAppendS(" / "); 1233 n_Write(pGetCoeff(p1),r->cf);StringAppendS("\n");PrintS(StringEndS()); 1234 } 1235 #endif 1236 p_SetCoeff(lm,c,r); 1237 } 1238 #ifdef KDEBUG 1239 else 1240 { 1241 PrintS("bug\n"); 1242 } 1243 #endif 1244 if (p_GetComp(p1, r) != p_GetComp(lm, r)) 1245 { 1246 p_SetCompP(a1, p_GetComp(lm, r), r); 1247 reset_vec = TRUE; 1248 p_SetComp(lm, p_GetComp(p1, r), r); 1249 p_Setm(lm, r); 1250 } 1251 1252 p_ExpVectorSub(lm, p1, r); 1253 l1--; 1254 1255 assume((unsigned)l1==pLength(a1)); 1256 1257 #ifdef HAVE_SHIFTBBA 1258 poly lmRight; 1259 poly lm_org; 1260 if (r->isLPring) 1261 { 1262 int firstBlock = p_mFirstVblock(p1, r); 1263 lm_org=lm; 1264 k_SplitFrame(lm, lmRight, si_max(firstBlock, 1), r); 1265 } 1266 #endif 1267 1268 #ifdef HAVE_SHIFTBBA 1269 if (r->isLPring) 1270 { 1271 poly tmp=r->p_Procs->pp_Mult_mm(a1, lmRight, r); 1272 kBucket_Minus_m_Mult_p(bucket, lm,tmp, &l1, spNoether); 1273 p_Delete(&tmp,r); 1274 p_LmDelete(&lmRight,r); 1275 p_LmDelete(lm_org,r); 1276 } 1277 else 1278 #endif 1279 { 1280 kBucket_Minus_m_Mult_p(bucket, lm, a1, &l1, spNoether); 1281 } 1282 1283 #if 0 1284 if (backuped) 1285 p_SetCoeff0(a1,coef,r); 1286 #endif 1287 1288 p_LmDelete(&lm, r); 1289 if (reset_vec) p_SetCompP(a1, 0, r); 1290 kbTest(bucket); 1291 return; 1218 1292 } 1219 1293 … … 1439 1513 * 3 -> a == 1, b == 1 1440 1514 * this value is used to control the spolys 1441 * reduce is set inside "NF" -> a should be 11442 1515 */ 1443 1516 int ksCheckCoeff(number *a, number *b, const coeffs r) -
libpolys/polys/kbuckets.h
r220bb4 rb97cce6 84 84 number kBucketPolyRed(kBucket_pt bucket, 85 85 poly p, int l, 86 poly spNoether, 87 BOOLEAN reduce); 86 poly spNoether); 87 void kBucketPolyRedNF(kBucket_pt bucket, 88 poly p1, int l1, 89 poly spNoether); 90 88 91 89 92 -
libpolys/polys/nc/old.gring.cc
r220bb4 rb97cce6 2076 2076 { 2077 2077 p_Delete(&m, r); 2078 ctmp = kBucketPolyRed(b,p,pLength(p),NULL ,reduce);2078 ctmp = kBucketPolyRed(b,p,pLength(p),NULL); 2079 2079 } 2080 2080 else … … 2084 2084 p_Cleardenom_n(pp,r,c2); 2085 2085 p_Delete(&m, r); 2086 ctmp = kBucketPolyRed(b,pp,pLength(pp),NULL,reduce); 2086 if (reduce) 2087 { 2088 kBucketPolyRedNF(b,pp,pLength(pp),NULL); 2089 ctmp=n_Init(1,r->cf); 2090 } 2091 else 2092 ctmp = kBucketPolyRed(b,pp,pLength(pp),NULL); 2087 2093 //cc=*c; 2088 2094 //*c=nMult(*c,c2);
Note: See TracChangeset
for help on using the changeset viewer.