Changeset 8152f7 in git
- Timestamp:
- May 30, 2013, 9:38:01 PM (10 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 7a084037acf0669aed29b40ab674ae5b62ef72f7
- Parents:
- c760e259ac3027fa03d62991a376b52296dfb095
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2013-05-30 21:38:01+02:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:49+02:00
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/schreyer.lib
rc760e25 r8152f7 794 794 attrib(S, "SYZNUMBER", 0); 795 795 796 "attrib(S,'TREEOUTPUT'): ", attrib(S, "TREEOUTPUT");797 798 796 if( @DEBUG ) 799 797 { … … 2289 2287 /*static*/ proc StartResTesting(list #) 2290 2288 { 2289 int @treeout = attrib(SSinit, "TREEOUTPUT"); 2290 2291 2291 if( defined(@save_res_list) ) 2292 2292 { ERROR("Sorry: existing global variable @save_res_list - run StopAddResTesting before another Start!!!"); } 2293 2293 2294 2294 string @save_res_desc = string(#); 2295 ">>>>>>>>> {{{{{{{{{ STARTING TESTING ('" + @save_res_desc + "') :::::::::::: "; 2295 2296 if( !@treeout ) 2297 { 2298 ">>>>>>>>> {{{{{{{{{ STARTING TESTING ('" + @save_res_desc + "') :::::::::::: "; 2299 } else 2300 { 2301 "{ \"Example\": \"" + @save_res_desc + "\", \"computations\": ["; 2302 } 2296 2303 2297 2304 list @save_res_list = list(); … … 2302 2309 /*static*/ proc StopResTesting() 2303 2310 { 2311 int @treeout = attrib(SSinit, "TREEOUTPUT"); 2312 2304 2313 if( defined(@save_opts) || defined(@save_method) || defined(@save_desc) ) 2305 2314 { ERROR("Sorry: existing global variables - run StopAddResTest before another Start!!!"); } … … 2307 2316 if( !defined(@save_res_list) || !defined(@save_res_desc) ) 2308 2317 { ERROR("Sorry: no global variable - run StartResTesting beforehand!!!"); } 2309 2318 2310 2319 int i, j; 2311 2320 int f = 0; 2312 2321 def m, mm; 2313 2322 2323 if( !@treeout ) 2324 { 2314 2325 for (i = size(@save_res_list); i > 0; i--) 2315 2326 { 2316 2327 "Total Time: ", @save_res_list[i][5], ", Res: ", @save_res_list[i][6], ", Minimal Betti: ", @save_res_list[i][5] - @save_res_list[i][6], ", ", @save_res_list[i][1], " :with: ", @save_res_list[i][2]; 2328 } 2329 2317 2330 } 2318 2331 … … 2357 2370 2358 2371 }; 2372 2359 2373 if( f ) 2360 2374 { … … 2366 2380 } else 2367 2381 { 2368 "BETTI: "; print( @save_res_list[1][4], "betti"); 2382 if( !@treeout ) 2383 { 2384 "BETTI: "; print( @save_res_list[1][4], "betti"); 2385 } 2369 2386 } 2370 2387 2371 2388 kill @save_res_list; 2372 2389 2373 "<<<<<<<<< }}}}}}}}} STOP TESTING (", @save_res_desc, ") !!!!!!!!!!!! "; 2390 if( !@treeout ) 2391 { 2392 "<<<<<<<<< }}}}}}}}} STOP TESTING (", @save_res_desc, ") !!!!!!!!!!!! "; 2393 } else 2394 { 2395 // "{ \"Example\": \"" + @save_res_desc + "\", \"computations\": ["; 2396 "] },"; 2397 } 2374 2398 kill @save_res_desc; 2375 2399 } … … 2377 2401 /*static*/ proc StartAddResTest(string method, string desc) 2378 2402 { 2403 int @treeout = attrib(SSinit, "TREEOUTPUT"); 2404 2379 2405 if( !defined(@save_res_list) ) 2380 2406 { ERROR("Sorry: no global variable - run StartResTesting beforehand!!!"); } … … 2388 2414 def @save_desc = desc; export @save_desc; 2389 2415 2390 "< START RES TEST{{{ ", @save_method, ", with:", @save_desc, " ... "; 2416 if( !@treeout ) 2417 { 2418 "< START RES TEST{{{ ", @save_method, ", with:", @save_desc, " ... "; 2419 } else 2420 { 2421 // Print("{ \"RESOLUTION: HYBRIDNF:%d, TAILREDSYZ: %d, LEAD2SYZ: %d, IGNORETAILS: %d\": [\n", 2422 // attributes.__HYBRIDNF__, attributes.__TAILREDSYZ__, attributes.__LEAD2SYZ__, attributes.__IGNORETAILS__); 2423 " { \"RESOLUTION: " + @save_method + ", with: " + @save_desc + "\": ["; 2424 } 2391 2425 } 2392 2426 … … 2394 2428 /*static*/ proc StopAddResTest(def RR, intmat S, int @t, int @m) 2395 2429 { 2430 int @treeout = attrib(SSinit, "TREEOUTPUT"); 2431 2396 2432 if( !(defined(@save_opts) && defined(@save_method) && defined(@save_desc)) ) 2397 2433 { ERROR("Sorry: no global variables - run StartAddResTest beforehand!!!"); } … … 2402 2438 // print(S, "betti"); 2403 2439 2404 "> -STOP RES TEST}}} ", @save_method, ", with:", @save_desc, ", Timer:", @t; option(); 2440 if( !@treeout ) 2441 { 2442 "> -STOP RES TEST}}} ", @save_method, ", with:", @save_desc, ", Timer:", @t; option(); 2443 } else 2444 { 2445 " ] },"; 2446 } 2447 2405 2448 2406 2449 option(set, @save_opts); kill @save_opts; … … 2486 2529 if(@PROFILE){ProfilerStop();} 2487 2530 setring R;module M;list @l=list();@l[size(RES)-1]=list();r=nrows(RES[1]);for(i=2;i<=size(RES);i++){M=RES[i];rr=nrows(M);if((r>0)&&(size(M)>0)&&(r<rr)){M=transpose(M);M=M[(r+1)..ncols(M)];M=transpose(M);RES[i]=M;};r=rr;@l[i-1] = M;};resolution RR=@l;RR=minres(RR);def S=betti(RR,1);@t=rtimer; 2488 DetailedPrint(RR,0);2531 // DetailedPrint(RR,0); 2489 2532 SCheck(R); 2490 2533 StopAddResTest(RR, S, @t,@m); … … 2577 2620 { 2578 2621 StartResTesting(#); 2622 int @treeout = attrib(SSinit, "TREEOUTPUT"); 2579 2623 // simple tests... 2580 2624 // M = groebner(M); "groebner: "; M; ""; 2581 2625 2626 if( !@treeout ) 2627 { 2628 Testlres(M); 2629 Testnres(M); 2630 } 2631 // Testsres(M); 2632 // TestSres(M); // too long for the last medium test :( 2633 2634 2635 // attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSres(M); // TODO: FIX ERROR!!!! 2636 // attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSSres(M); 2637 2638 // attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 0); attrib(SSinit, "HYBRIDNF", 0); TestSSres(M); 2639 // attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 0); attrib(SSinit, "HYBRIDNF", 1); TestSSres(M); 2640 2641 // attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 2); TestSSSres(M); 2642 attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSSSres(M); 2643 attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSSres(M); 2644 2645 2646 // attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSres(M); 2647 2648 2649 // the following 2 setups are bad for AGR@101n3d002s004%1:((( 2650 // attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 0); attrib(SSinit, "HYBRIDNF", 0); TestSSres(M); 2651 // attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 0); attrib(SSinit, "HYBRIDNF", 1); TestSSres(M); 2652 2653 StopResTesting(); 2654 2655 } 2656 2657 2658 proc TestSSresAttribs2tr(def M, list #) 2659 { 2660 StartResTesting(#); 2661 2662 attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSSres(M); 2663 attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSSSres(M); 2664 // attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 2); TestSSSres(M); 2665 2666 attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSSres(M); 2667 attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSSSres(M); 2668 // attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 2); TestSSSres(M); 2669 2670 2582 2671 Testlres(M); 2583 2672 Testnres(M); … … 2585 2674 // TestSres(M); // too long for the last medium test :( 2586 2675 2587 2588 // attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSres(M);2589 // attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSSres(M);2590 2591 // attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 0); attrib(SSinit, "HYBRIDNF", 0); TestSSres(M);2592 // attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 0); attrib(SSinit, "HYBRIDNF", 1); TestSSres(M);2593 2594 attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 2); TestSSSres(M);2595 attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSSSres(M);2596 attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSSres(M);2597 2598 2599 // attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSres(M);2600 2601 2602 // the following 2 setups are bad for AGR@101n3d002s004%1:(((2603 // attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 0); attrib(SSinit, "HYBRIDNF", 0); TestSSres(M);2604 // attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 0); attrib(SSinit, "HYBRIDNF", 1); TestSSres(M);2605 2606 StopResTesting();2607 2608 }2609 2610 2611 proc TestSSresAttribs2tr(def M, list #)2612 {2613 StartResTesting(#);2614 2615 attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSSres(M);2616 attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSSSres(M);2617 // attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 2); TestSSSres(M);2618 2619 attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSSres(M);2620 attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSSSres(M);2621 // attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 2); TestSSSres(M);2622 2623 2624 Testlres(M);2625 Testnres(M);2626 // Testsres(M);2627 // TestSres(M); // too long for the last medium test :(2628 2629 2676 StopResTesting(); 2630 2677 } … … 2642 2689 2643 2690 // TODO: only for now!! 2644 attrib(SSinit, "DEBUG", (DEBUG > 0) );2645 attrib(SSinit, "SYZCHECK", (DEBUG > 0));2646 attrib(SSinit, "KERCHECK", 0);2691 attrib(SSinit, "DEBUG", (DEBUG > 0) ); 2692 attrib(SSinit, "SYZCHECK", 0); 2693 attrib(SSinit, "KERCHECK", (DEBUG > 0) ); 2647 2694 attrib(SSinit, "TREEOUTPUT", 1); 2648 2695 attrib(SSinit, "PROFILE", 0); 2649 2696 2650 ring r; r; ideal M = maxideal(1); 2697 int @treeout = attrib(SSinit, "TREEOUTPUT"); 2698 2699 if( @treeout) 2700 { 2701 monitor("SimpleTests.json", "o"); 2702 "{ \"SimpleTests\": ["; 2703 } 2704 2705 ring r; ideal M = maxideal(1); 2651 2706 // M; 2652 TestSSresAttribs(M, " <" + string(M) + ">in " + string(basering));2707 TestSSresAttribs(M, "\\\\GENERATED{" + string(M) + "} in " + string(basering)); 2653 2708 kill r; 2654 2709 2655 ring r = 0, (a, b, c, d), lp; r;ideal M = maxideal(1);2710 ring r = 0, (a, b, c, d), lp; ideal M = maxideal(1); 2656 2711 // M; 2657 TestSSresAttribs(M, " <" + string(M) + ">in " + string(basering));2712 TestSSresAttribs(M, "\\\\GENERATED{" + string(M) + "} in " + string(basering)); 2658 2713 kill r; 2659 2714 2660 ring R = 0, (w, x, y, z), dp; R;2715 ring R = 0, (w, x, y, z), dp; 2661 2716 ideal M = w^2 - x*z, w*x - y*z, x^2 - w*y, x*y - z^2, y^2 - w*z; 2662 2717 // M; 2663 TestSSresAttribs(M, " <" + string(M) + ">in " + string(basering));2718 TestSSresAttribs(M, "\\\\GENERATED{" + string(M) + "} in " + string(basering)); 2664 2719 kill R; 2665 2720 2666 2721 2667 ring r = 0, (a, b, c, d, e, f), dp; r;ideal M = maxideal(1);2722 ring r = 0, (a, b, c, d, e, f), dp; ideal M = maxideal(1); 2668 2723 // M; 2669 TestSSresAttribs(M, " <" + string(M) + ">in " + string(basering));2724 TestSSresAttribs(M, "\\\\GENERATED{" + string(M) + "} in " + string(basering)); 2670 2725 kill r; 2671 2672 ring AGR = (101), (a, b, c, d), dp; AGR; 2726 2727 2728 ring r = 0, (x, y), lp; ideal M = x2, xy, y2; // Schreyer conterexample??? 2729 TestSSresAttribs(M, "\\\\GENERATED{" + string(M) + "} in " + string(basering)); 2730 kill r; 2731 2732 ring r = 0, (x, y, z), lp; ideal M = xy + y2 +x + 2y -1, xz - x -y -z -2, yz +1; // TODO: seg. fault? 2733 TestSSresAttribs(M, "\\\\GENERATED{" + string(M) + "} in " + string(basering)); 2734 kill r; 2735 2736 2737 ring AGR = (101), (a, b, c, d), dp; 2673 2738 // simple: AGR@101n3d002s004%1: 2674 2739 ideal M = c*d, b*d, a*d, c^2-d^2, b*c, a*c, b^2-d^2, a*b, a^2-d^2; … … 2680 2745 // M; 2681 2746 TestSSresAttribs(M, "medium: AGR@101n3d004s009%1"); 2747 2748 if( @treeout) 2749 { 2750 "] }"; 2751 monitor(""); 2752 } 2753 2682 2754 } 2683 2755 -
dyn_modules/syzextra/Makefile.am
rc760e25 r8152f7 33 33 # 34 34 # EXTRA_DIST = syzextra.tst ederc.tst test_clear_enum.tst test.sh $(TESTS) 35 36 CLEANFILES = SimpleTests.json -
dyn_modules/syzextra/mod_main.cc
rc760e25 r8152f7 1118 1118 { 1119 1119 const SchreyerSyzygyComputationFlags attributes(currRingHdl); 1120 1120 1121 1121 const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 1122 1122 … … 1151 1151 1152 1152 h = h->Next(); 1153 1154 // tail1155 1153 if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL)) 1156 1154 { … … 1198 1196 _res->fullres[index++] = M; 1199 1197 1198 // if (attributes.__TREEOUTPUT__) 1199 // Print("{ \"RESOLUTION: HYBRIDNF:%d, TAILREDSYZ: %d, LEAD2SYZ: %d, IGNORETAILS: %d\": [\n", attributes.__HYBRIDNF__, attributes.__TAILREDSYZ__, attributes.__LEAD2SYZ__, attributes.__IGNORETAILS__); 1200 1200 1201 while( (!idIs0(L)) && (index < length)) 1201 1202 { 1203 attributes.nextSyzygyLayer(); 1202 1204 ideal LL, TT; 1205 1203 1206 ComputeSyzygy(L, T, LL, TT, attributes); 1204 1207 … … 1233 1236 _res->fullres[index++] = M; // ??? 1234 1237 } 1238 // if (attributes.__TREEOUTPUT__) 1239 // PrintS("] }\n"); 1235 1240 1236 1241 id_Delete(&L, r); id_Delete(&T, r); -
dyn_modules/syzextra/syzextra.cc
rc760e25 r8152f7 204 204 /* namespace SORT_c_ds */ 205 205 206 /// writes a monomial (p), 207 /// uses form x*gen(.) if ko != coloumn number of p 208 static void writeLatexTerm(const poly t, const ring r, const bool bCurrSyz = true, const bool bLTonly = true) 209 { 210 if( t == NULL ) 211 { 212 PrintS(" 0 "); 213 return; 214 } 215 216 assume( r != NULL ); 217 const coeffs C = r->cf; assume(C != NULL); 218 219 poly p = t; 220 BOOLEAN writePlus = FALSE; 221 222 do { 223 assume( p != NULL ); 224 225 // write coef... 226 number& n = p_GetCoeff(p, r); 227 228 n_Normalize(n, C); 229 230 BOOLEAN writeMult = FALSE; ///< needs * before pp or module generator 231 232 BOOLEAN writeOne = FALSE; ///< need to write something after '-'! 233 234 if( n_IsZero(n, C) ) 235 { 236 PrintS( writePlus? " + 0" : " 0 " ); writePlus = TRUE; writeMult = TRUE; 237 // return; // yes? 238 } 239 240 if (n_IsMOne(n, C)) 241 { 242 PrintS(" - "); writeOne = TRUE; writePlus = FALSE; 243 } 244 else if (!n_IsOne(n, C)) 245 { 246 if( writePlus && n_GreaterZero(n, C) ) 247 PrintS(" + "); 248 249 StringSetS(""); n_WriteLong(n, C); 250 if (true) 251 { 252 char *s = StringEndS(); PrintS(s); omFree(s); 253 } 254 255 256 writeMult = TRUE; 257 writePlus = TRUE; 258 } else 259 writeOne = TRUE; 260 261 // missing '1' if no PP and gen...!? 262 // write monom... 263 const short N = rVar(r); 264 265 BOOLEAN wrotePP = FALSE; ///< needs * before module generator? 266 267 for (short i = 0; i < N; i++) 268 { 269 const long ee = p_GetExp(p, i+1, r); 270 271 if (ee!=0L) 272 { 273 if (writeMult) 274 { 275 PrintS(" \\\\cdot "); 276 writeMult = FALSE; 277 } else 278 if( writePlus ) 279 PrintS(" + "); 280 281 writePlus = FALSE; 282 283 if (ee != 1L) 284 Print(" %s^{%ld} ", rRingVar(i, r), ee); 285 else 286 Print(" %s ", rRingVar(i, r)); 287 288 writeOne = FALSE; 289 wrotePP = TRUE; 290 } 291 } 292 293 writePlus = writePlus || wrotePP; 294 writeMult = writeMult || wrotePP; 295 296 // write module gen... 297 const long comp = p_GetComp(p, r); 298 299 if (comp > 0 ) 300 { 301 if (writeMult) 302 PrintS(" \\\\cdot "); 303 else 304 if( writePlus ) 305 PrintS(" + "); 306 307 if (bCurrSyz) 308 Print(" \\\\GEN{%ld} ", comp); 309 else 310 Print(" \\\\GENP{%ld} ", comp); 311 312 writeOne = FALSE; 313 } 314 315 if ( writeOne ) 316 PrintS( writePlus? " + 1 " : " 1 " ); 317 318 319 pIter(p); 320 321 writePlus = TRUE; 322 } while( (!bLTonly) && (p != NULL) ); 323 324 } 325 326 327 328 329 206 330 /// return a new term: leading coeff * leading monomial of p 207 331 /// with 0 leading component! … … 460 584 461 585 #ifndef NDEBUG 586 if( !__TREEOUTPUT__ ) 462 587 if( TEST_OPT_PROT | 1) 463 588 Print("%% **!!** SchreyerSyzygyComputation::SetUpTailTerms()::PreProcessing(): X: {c: %lu, C: %lu, P: %lu} + %lu\n", pp[1], pp[2], pp[3], pp[0]); … … 465 590 466 591 #ifndef NDEBUG 592 if( !__TREEOUTPUT__ ) 467 593 if( __DEBUG__ | 0) 468 594 { … … 776 902 assume( r >= 0 && r < IDELEMS(T) ); 777 903 assume( r >= 0 && r < IDELEMS(L) ); 904 905 assume( a != NULL ); 906 907 if( __TREEOUTPUT__ ) 908 { 909 PrintS("{ \"nodelabel\": \""); writeLatexTerm(a, R); PrintS("\", \"children\": ["); 910 } 911 778 912 779 913 poly aa = leadmonom(a, R); assume( aa != NULL); // :( 780 914 781 if( __TREEOUTPUT__ )782 {783 PrintS("%%%% BEGIN LIFTPART DIAGRAMM\n");784 PrintS("\\begin{ROOTTREE}{"); dPrint(a, R, R, 0);PrintS("}");785 // PrintS("\\ROOTRESULT{"); dPrint(t, R, R, 0); PrintS("}");786 // PrintS("\\end{ROOTTREE}\n");787 }788 789 915 poly t = TraverseTail(aa, r); 790 916 791 917 if( a2 != NULL ) 792 918 { 793 919 assume( __LEAD2SYZ__ ); 920 921 if( __TREEOUTPUT__ ) 922 { 923 PrintS("{ \"nodelabel\": \""); writeLatexTerm(a2, R); PrintS("\", \"children\": ["); 924 } 794 925 795 926 // replace the following... ? … … 798 929 assume( r2 >= 0 && r2 < IDELEMS(T) ); 799 930 931 t = p_Add_q(a2, p_Add_q(t, TraverseTail(aa2, r2), R), R); 932 933 p_Delete(&aa2, R); 934 800 935 if( __TREEOUTPUT__ ) 801 { 802 // PrintS("\\CONSIDERTERM{"); dPrint(spoly, r, r, 0); PrintS("}\n"); 803 PrintS("\\CHILDNODE{"); dPrint(a2, R, R, 0); PrintS("}\n"); 804 } 805 806 t = p_Add_q(a2, p_Add_q(t, TraverseTail(aa2, r2), R), R); 807 808 p_Delete(&aa2, R); 936 PrintS("]},"); 937 809 938 } else 810 939 t = p_Add_q(t, ReduceTerm(aa, L->m[r], a), R); 811 940 812 941 p_Delete(&aa, R); 813 942 943 // TODO: print t??? 944 814 945 if( __TREEOUTPUT__ ) 815 { 816 PrintS("\\ROOTRESULT{"); dPrint(t, R, R, 0); PrintS("}"); 817 PrintS("\\end{ROOTTREE}\n"); 818 } 819 820 821 946 { 947 PrintS("], \"noderesult\": \""); writeLatexTerm(t, R, true, false); PrintS("\" },"); 948 } 822 949 return t; 823 950 } … … 846 973 int t, r; 847 974 #endif 975 976 if( __TREEOUTPUT__ ) 977 { 978 Print("\n{ \"syzygylayer\": \"%d\", \"hybridnf\": \"%d\", \"diagrams\": \n[", __SYZNUMBER__, __HYBRIDNF__ ); 979 } 848 980 849 981 if( m_syzLeads == NULL ) 850 982 { 851 983 #ifndef NDEBUG 984 if( !__TREEOUTPUT__ ) 852 985 if( TEST_OPT_PROT | 1) 853 986 { … … 858 991 ComputeLeadingSyzygyTerms( __LEAD2SYZ__ && !__IGNORETAILS__ ); // 2 terms OR 1 term! 859 992 #ifndef NDEBUG 993 if( !__TREEOUTPUT__ ) 860 994 if( TEST_OPT_PROT | 1) 861 995 { … … 874 1008 875 1009 if( size == 1 && LL->m[0] == NULL ) 876 return; 1010 { 1011 if( __TREEOUTPUT__ ) 1012 PrintS("]},"); 1013 return; 1014 } 1015 877 1016 878 1017 // use hybrid method? 879 const bool method = (__HYBRIDNF__ == 1) || (__HYBRIDNF__ == 2 && __SYZNUMBER__ < 3);1018 const bool method = (__HYBRIDNF__ == 1) || (__HYBRIDNF__ == 2 && __SYZNUMBER__ < 3); 880 1019 881 1020 if( !__IGNORETAILS__) … … 884 1023 { 885 1024 #ifndef NDEBUG 1025 if( !__TREEOUTPUT__ ) 886 1026 if( TEST_OPT_PROT | 1 ) 887 1027 { … … 893 1033 SetUpTailTerms(); 894 1034 #ifndef NDEBUG 1035 if( !__TREEOUTPUT__ ) 895 1036 if( TEST_OPT_PROT | 1) 896 1037 { … … 903 1044 904 1045 #ifndef NDEBUG 1046 if( !__TREEOUTPUT__ ) 905 1047 if( TEST_OPT_PROT | 1) 906 1048 { … … 941 1083 942 1084 #ifndef NDEBUG 1085 if( !__TREEOUTPUT__ ) 943 1086 if( TEST_OPT_PROT | 1) 944 1087 { … … 948 1091 #endif 949 1092 950 TT->rank = id_RankFreeModule(TT, R); 1093 TT->rank = id_RankFreeModule(TT, R); 1094 1095 if( __TREEOUTPUT__ ) 1096 PrintS("\n]},"); 951 1097 } 952 1098 … … 1011 1157 if( __TREEOUTPUT__ ) 1012 1158 { 1013 PrintS("%%%% BEGIN LIFTHYBRID DIAGRAMM\n");1014 PrintS("\\begin{ROOTTREE}{"); dPrint(syz_lead, r, r, 0); PrintS("}");1159 // PrintS("%%%% BEGIN LIFTHYBRID DIAGRAMM\n"); 1160 PrintS("{ \"nodelabel\": \""); writeLatexTerm(syz_lead, r); PrintS("\", \"children\": ["); 1015 1161 } 1016 1162 … … 1024 1170 #if NOPRODUCT 1025 1171 syz_2 = m_div.FindReducer(syz_lead, L->m[rr], syz_lead, m_checker); 1172 1173 if( __TREEOUTPUT__ ) 1174 { 1175 PrintS("{ \"nodelabel\": \""); writeLatexTerm(syz_2, r); PrintS("\" },"); 1176 } 1026 1177 #else 1027 1178 poly aa = leadmonom(syz_lead, r); assume( aa != NULL); // :( … … 1030 1181 if( __TREEOUTPUT__ ) 1031 1182 { 1032 PrintS(" \\CONSIDERTERM{"); dPrint(aa, r, r, 0); PrintS("}\n");1183 PrintS("{ \"nodelabel\": \""); writeLatexTerm(syz_2, r); PrintS("\", \"edgelable\": \""); writeLatexTerm(aa, r, false); PrintS("\" },"); 1033 1184 } 1034 1185 … … 1041 1192 1042 1193 assume( syz_2 != NULL ); // by construction of S-Polynomial 1043 1044 if( __TREEOUTPUT__ )1045 {1046 PrintS("\\CHILDNODE{"); dPrint(syz_2, r, r, 0); PrintS("}\n");1047 }1048 1049 assume( syz_2 != NULL );1050 1194 1051 1195 assume( L != NULL ); … … 1106 1250 if( __TREEOUTPUT__ ) 1107 1251 { 1108 PrintS("\\CONSIDERTERM{"); dPrint(spoly, r, r, 0); PrintS("}\n"); 1109 PrintS("\\CHILDNODE{"); dPrint(t, r, r, 0); PrintS("}\n"); 1252 PrintS("{ \"nodelabel\": \""); writeLatexTerm(t, r); PrintS("\", \"edgelable\": \""); writeLatexTerm(spoly, r, false); PrintS("\" },"); 1110 1253 } 1111 1254 … … 1130 1273 if( __TREEOUTPUT__ ) 1131 1274 { 1132 PrintS("\\ROOTRESULT{"); dPrint(result, r, r, 0); PrintS("}"); 1133 PrintS("\\end{ROOTTREE}\n"); 1275 PrintS("]},"); 1134 1276 } 1135 1277 … … 1157 1299 // TODO: store (multiplier, tail) -.-^-.-^-.--> ! 1158 1300 TCache::iterator top_itr = m_cache.find(tail); 1159 1160 if( __TREEOUTPUT__ )1161 {1162 PrintS("\\begin{ROOTTREE}{"); dPrint(multiplier, r, r, 0);Print("*gen(%d)}", tail);1163 // PrintS("\\ROOTRESULT{"); dPrint(t, R, R, 0); PrintS("}");1164 // PrintS("\\end{ROOTTREE}\n");1165 }1166 1301 1167 1302 if ( top_itr != m_cache.end() ) … … 1175 1310 if( itr != T.end() ) // Yey - Reuse!!! 1176 1311 { 1177 assume( p_LmEqual(itr->first, multiplier, r) ); 1312 assume( p_LmEqual(itr->first, multiplier, r) ); 1313 1314 if( itr->second == NULL ) 1315 return (NULL); 1316 1178 1317 poly p = p_Copy(itr->second, r); // no copy??? 1318 1319 if( __TREEOUTPUT__ ) 1320 { 1321 // PrintS("{ \"nodelabel\": \""); writeLatexTerm(multiplier, r, false); 1322 // Print(" \\\\cdot \\\\GEN{%d}\", \"children\": [ ", tail + 1); 1323 Print("{ \"lookedupnode\": \"1\", \"nodelabel\": \""); 1324 writeLatexTerm(p, r, true, false); 1325 } 1326 1179 1327 if( !n_Equal( pGetCoeff(multiplier), pGetCoeff(itr->first), r) ) // normalize coeffs!? 1180 1328 { 1181 1329 number n = n_Div( pGetCoeff(multiplier), pGetCoeff(itr->first), r); 1182 1330 p = p_Mult_nn(p, n, r); 1183 n_Delete(&n, r); 1184 } 1185 1186 if( __TREEOUTPUT__ ) 1331 n_Delete(&n, r); 1332 1333 if( __TREEOUTPUT__ ) 1334 Print("\", \"RESCALEDRESULT\": \"1\" },"); 1335 } else 1187 1336 { 1188 PrintS("\\REUSEROOTRESULT{"); dPrint(p, r, r, 0); PrintS("}\n");1189 PrintS("\\end{ROOTTREE}\n");1337 if( __TREEOUTPUT__ ) 1338 Print("\", \"RESCALEDRESULT\": \"0\" },"); 1190 1339 } 1191 1340 1192 1341 return p; 1193 1342 } 1343 1344 if( __TREEOUTPUT__ ) 1345 { 1346 // PrintS("{ \"nodelabel\": \""); writeLatexTerm(multiplier, r, false); Print(" \\\\cdot \\\\GEN{%d}\", \"children\": [", tail + 1); 1347 } 1194 1348 1195 1349 const poly p = ComputeImage(multiplier, tail); 1196 T.insert( TP2PCache::value_type(p_Copy(multiplier, r), p) ); 1197 // T[ multiplier ] = p; 1350 T.insert( TP2PCache::value_type(p_Copy(multiplier, r), p) ); // T[ multiplier ] = p; 1351 1352 // if( p == NULL ) 1353 // return (NULL); 1198 1354 1199 1355 if( __TREEOUTPUT__ ) 1200 1356 { 1201 PrintS("\\STOREROOTRESULT{"); dPrint(p, r, r, 0); PrintS("}"); 1202 PrintS("\\end{ROOTTREE}\n"); 1357 // PrintS("], \"storedResult\": \""); writeLatexTerm(p, r, true, false); PrintS("\" },"); 1203 1358 } 1359 1204 1360 return p_Copy(p, r); 1205 1361 } 1362 1206 1363 CCacheCompare o(r); TP2PCache T(o); 1207 1364 1365 if( __TREEOUTPUT__ ) 1366 { 1367 // PrintS("{ \"nodelabel\": \""); writeLatexTerm(multiplier, r, false); Print(" \\\\cdot \\\\GEN{%d}\", \"children\": [", tail + 1); 1368 } 1369 1370 1208 1371 const poly p = ComputeImage(multiplier, tail); 1209 1372 … … 1212 1375 m_cache.insert( TCache::value_type(tail, T) ); 1213 1376 1377 // if( p == NULL ) 1378 // return (NULL); 1379 1214 1380 if( __TREEOUTPUT__ ) 1215 1381 { 1216 PrintS("\\STOREROOTRESULT{"); dPrint(p, r, r, 0); PrintS("}"); 1217 PrintS("\\end{ROOTTREE}\n");1218 }1382 // PrintS("], \"storedResult\": \""); writeLatexTerm(p, r, true, false); PrintS("\" },"); 1383 } 1384 1219 1385 return p_Copy(p, r); 1220 1386 } … … 1305 1471 #if NOPRODUCT 1306 1472 s = m_div.FindReducer(multiplier, term4reduction, syztermCheck, m_checker); 1473 1474 if( s == NULL ) // No Reducer? 1475 return s; 1476 1477 if( __TREEOUTPUT__ ) 1478 { 1479 PrintS("{ \"nodelabel\": \""); writeLatexTerm(s, r); 1480 } 1481 1307 1482 #else 1308 1483 // NOTE: only LT(term4reduction) should be used in the following: 1309 1484 poly product = pp_Mult_mm(multiplier, term4reduction, r); 1310 1485 s = m_div.FindReducer(product, syztermCheck, m_checker); 1486 1487 if( s == NULL ) // No Reducer? 1488 return s; 1311 1489 1312 if( __TREEOUTPUT__ && (s != NULL))1313 { 1314 PrintS(" \\CONSIDERTERM{"); dPrint(product, r, r, 0); PrintS("}\n");1490 if( __TREEOUTPUT__ ) 1491 { 1492 PrintS("{ \"nodelabel\": \""); writeLatexTerm(s, r); PrintS("\", \"edgelable\": \""); writeLatexTerm(product, r, false); 1315 1493 } 1316 1494 … … 1321 1499 if( s == NULL ) // No Reducer? 1322 1500 return s; 1323 1324 if( __TREEOUTPUT__ ) 1325 { 1326 PrintS("\\CHILDNODE{"); dPrint(s, r, r, 0); PrintS("}\n"); 1327 } 1501 1328 1502 1329 1503 poly b = leadmonom(s, r); … … 1332 1506 assume( c >= 0 && c < IDELEMS(T) ); 1333 1507 1508 1334 1509 if( __TREEOUTPUT__ ) 1335 { 1336 PrintS("\\begin{ROOTTREE}{"); dPrint(s, r, r, 0); PrintS("}"); 1337 } 1510 PrintS("\", \"children\": ["); 1338 1511 1339 1512 const poly t = TraverseTail(b, c); // T->m[c]; 1340 1513 1341 if( __TREEOUTPUT__ )1342 {1343 PrintS("\\ROOTRESULT{"); dPrint(t, r, r, 0); PrintS("}");1344 PrintS("\\end{ROOTTREE}\n");1345 }1346 1347 1514 if( t != NULL ) 1348 1515 s = p_Add_q(s, t, r); 1349 1516 1517 if( __TREEOUTPUT__ ) 1518 { 1519 1520 PrintS("], \"noderesult\": \""); 1521 writeLatexTerm(s, r, true, false); 1522 PrintS("\" },"); 1523 } 1524 1350 1525 return s; 1351 1526 } … … 1364 1539 END_NAMESPACE 1365 1540 1541 1366 1542 SchreyerSyzygyComputationFlags::SchreyerSyzygyComputationFlags(idhdl rootRingHdl): 1367 1543 #ifndef NDEBUG … … 1504 1680 assume( p_GetComp(p, r) == p_GetComp(product, r) ); 1505 1681 1506 const int k = m_label; 1507 1682 // const int k = m_label; 1508 1683 // assume( m_L->m[k] == p ); 1509 1684 -
dyn_modules/syzextra/syzextra.h
rc760e25 r8152f7 90 90 91 91 /// Syzygy level (within a resolution) 92 const int __SYZNUMBER__; 92 mutable int __SYZNUMBER__; 93 94 inline void nextSyzygyLayer() const 95 { 96 __SYZNUMBER__++; 97 } 93 98 94 99 /// output lifting tree
Note: See TracChangeset
for help on using the changeset viewer.