Changeset 8152f7 in git


Ignore:
Timestamp:
May 30, 2013, 9:38:01 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
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
Message:
Adding treeoutput

add: syz.term output in Latex format

Note: make check outputs SimpleTests.json with the following JSON format for diagrams:
NODE =
{
  "nodelabel": "syz. term",
  "edgelabel": "elimination term",
  "children": [ NODE1, NODE2, ... , ],
},

Note: edgelabel and children are optional!
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/schreyer.lib

    rc760e25 r8152f7  
    794794  attrib(S, "SYZNUMBER", 0);
    795795 
    796   "attrib(S,'TREEOUTPUT'): ", attrib(S, "TREEOUTPUT");
    797  
    798796  if( @DEBUG )
    799797  {
     
    22892287/*static*/ proc  StartResTesting(list #)
    22902288{
     2289  int @treeout = attrib(SSinit, "TREEOUTPUT");
     2290 
    22912291  if( defined(@save_res_list) )
    22922292  { ERROR("Sorry: existing global variable @save_res_list - run StopAddResTesting before another Start!!!"); }
    22932293 
    22942294  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  }
    22962303 
    22972304  list @save_res_list = list();
     
    23022309/*static*/ proc  StopResTesting()
    23032310{
     2311  int @treeout = attrib(SSinit, "TREEOUTPUT");
     2312 
    23042313  if( defined(@save_opts) || defined(@save_method) || defined(@save_desc) )
    23052314  { ERROR("Sorry: existing global variables - run StopAddResTest before another Start!!!"); }
     
    23072316  if( !defined(@save_res_list) || !defined(@save_res_desc) )
    23082317  { ERROR("Sorry: no global variable - run StartResTesting beforehand!!!"); }
    2309  
     2318
    23102319  int i, j;
    23112320  int f = 0;
    23122321  def m, mm;
    2313  
     2322
     2323  if( !@treeout )
     2324  {
    23142325  for (i = size(@save_res_list); i > 0; i--)
    23152326  {
    23162327    "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 
    23172330  }
    23182331 
     
    23572370 
    23582371  };
     2372 
    23592373  if( f )
    23602374  {
     
    23662380  } else
    23672381  {
    2368     "BETTI: "; print( @save_res_list[1][4], "betti");   
     2382    if( !@treeout )
     2383    {
     2384      "BETTI: "; print( @save_res_list[1][4], "betti");
     2385    }
    23692386  }
    23702387
    23712388  kill @save_res_list;
    23722389   
    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  }
    23742398  kill @save_res_desc;
    23752399}
     
    23772401/*static*/ proc StartAddResTest(string method, string desc)
    23782402{
     2403  int @treeout = attrib(SSinit, "TREEOUTPUT");
     2404 
    23792405  if( !defined(@save_res_list) )
    23802406  { ERROR("Sorry: no global variable - run StartResTesting beforehand!!!"); }
     
    23882414  def @save_desc = desc; export @save_desc;
    23892415 
    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  }
    23912425}
    23922426
     
    23942428/*static*/ proc StopAddResTest(def RR, intmat S, int @t, int @m)
    23952429{
     2430  int @treeout = attrib(SSinit, "TREEOUTPUT");
     2431 
    23962432  if( !(defined(@save_opts) && defined(@save_method) && defined(@save_desc)) )
    23972433  { ERROR("Sorry: no global variables - run StartAddResTest beforehand!!!"); }
     
    24022438//  print(S, "betti");
    24032439 
    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
    24052448 
    24062449  option(set, @save_opts); kill @save_opts;
     
    24862529  if(@PROFILE){ProfilerStop();}
    24872530  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);
    24892532  SCheck(R);
    24902533  StopAddResTest(RR, S, @t,@m);
     
    25772620{
    25782621  StartResTesting(#);
     2622  int @treeout = attrib(SSinit, "TREEOUTPUT");
    25792623// simple tests...
    25802624//  M = groebner(M);  "groebner: "; M;  "";
    25812625
     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
     2658proc 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 
    25822671  Testlres(M); 
    25832672  Testnres(M); 
     
    25852674//  TestSres(M); // too long for the last medium test :(
    25862675
    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 
    26292676  StopResTesting();
    26302677}
     
    26422689
    26432690  // 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) );
    26472694  attrib(SSinit, "TREEOUTPUT", 1);
    26482695  attrib(SSinit, "PROFILE", 0);
    26492696
    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);
    26512706//  M;
    2652   TestSSresAttribs(M, "<" + string(M) + "> in " + string(basering));
     2707  TestSSresAttribs(M, "\\\\GENERATED{" + string(M) + "} in " + string(basering));
    26532708  kill r;
    26542709
    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);
    26562711//  M;
    2657   TestSSresAttribs(M, "<" + string(M) + "> in " + string(basering));
     2712  TestSSresAttribs(M, "\\\\GENERATED{" + string(M) + "} in " + string(basering));
    26582713  kill r;
    26592714
    2660   ring R = 0, (w, x, y, z), dp; R;
     2715  ring R = 0, (w, x, y, z), dp;
    26612716  ideal M = w^2 - x*z,  w*x - y*z,  x^2 - w*y, x*y - z^2, y^2 - w*z;
    26622717//  M;
    2663   TestSSresAttribs(M, "<" + string(M) + "> in " + string(basering));
     2718  TestSSresAttribs(M, "\\\\GENERATED{" + string(M) + "} in " + string(basering));
    26642719  kill R;
    26652720
    26662721
    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);
    26682723//  M;
    2669   TestSSresAttribs(M, "<" + string(M) + "> in " + string(basering));
     2724  TestSSresAttribs(M, "\\\\GENERATED{" + string(M) + "} in " + string(basering));
    26702725  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;
    26732738  // simple: AGR@101n3d002s004%1:
    26742739  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;
     
    26802745//  M;
    26812746  TestSSresAttribs(M, "medium: AGR@101n3d004s009%1");
     2747
     2748  if( @treeout)
     2749  {
     2750    "] }";
     2751    monitor("");
     2752  }
     2753
    26822754}
    26832755
  • dyn_modules/syzextra/Makefile.am

    rc760e25 r8152f7  
    3333#
    3434# EXTRA_DIST = syzextra.tst ederc.tst test_clear_enum.tst test.sh $(TESTS)
     35
     36CLEANFILES = SimpleTests.json
  • dyn_modules/syzextra/mod_main.cc

    rc760e25 r8152f7  
    11181118{
    11191119  const SchreyerSyzygyComputationFlags attributes(currRingHdl);
    1120 
     1120   
    11211121  const BOOLEAN __DEBUG__      = attributes.__DEBUG__;
    11221122   
     
    11511151 
    11521152  h = h->Next();
    1153 
    1154   // tail
    11551153  if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL))
    11561154  {
     
    11981196  _res->fullres[index++] = M;
    11991197
     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   
    12001201  while( (!idIs0(L)) && (index < length))
    12011202  {
     1203    attributes.nextSyzygyLayer();
    12021204    ideal LL, TT; 
     1205     
    12031206    ComputeSyzygy(L, T, LL, TT, attributes);
    12041207
     
    12331236    _res->fullres[index++] = M; // ???
    12341237  }
     1238//  if (attributes.__TREEOUTPUT__)
     1239//    PrintS("] }\n");
    12351240
    12361241  id_Delete(&L, r); id_Delete(&T, r);
  • dyn_modules/syzextra/syzextra.cc

    rc760e25 r8152f7  
    204204/* namespace SORT_c_ds */
    205205
     206/// writes a monomial (p),
     207/// uses form x*gen(.) if ko != coloumn number of p
     208static 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   
    206330/// return a new term: leading coeff * leading monomial of p
    207331/// with 0 leading component!
     
    460584
    461585#ifndef NDEBUG
     586  if( !__TREEOUTPUT__ )
    462587  if( TEST_OPT_PROT | 1)
    463588    Print("%%      **!!**      SchreyerSyzygyComputation::SetUpTailTerms()::PreProcessing(): X: {c: %lu, C: %lu, P: %lu} + %lu\n", pp[1], pp[2], pp[3], pp[0]);
     
    465590   
    466591#ifndef NDEBUG
     592  if( !__TREEOUTPUT__ )
    467593  if( __DEBUG__ | 0)
    468594  {
     
    776902  assume( r >= 0 && r < IDELEMS(T) );
    777903  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   
    778912
    779913  poly aa = leadmonom(a, R); assume( aa != NULL); // :(
    780914
    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    
    789915  poly t = TraverseTail(aa, r);
    790 
     916   
    791917  if( a2 != NULL )
    792918  {
    793919    assume( __LEAD2SYZ__ );
     920
     921    if( __TREEOUTPUT__ )
     922    {
     923       PrintS("{ \"nodelabel\": \""); writeLatexTerm(a2, R); PrintS("\", \"children\": [");
     924    }
    794925
    795926    // replace the following... ?
     
    798929    assume( r2 >= 0 && r2 < IDELEMS(T) );
    799930
     931    t = p_Add_q(a2, p_Add_q(t, TraverseTail(aa2, r2), R), R);
     932
     933    p_Delete(&aa2, R);
     934     
    800935    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
    809938  } else
    810939    t = p_Add_q(t, ReduceTerm(aa, L->m[r], a), R);
    811940
    812941  p_Delete(&aa, R);
    813    
     942
     943  // TODO: print t???
     944
    814945  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  }   
    822949  return t;
    823950}
     
    846973  int t, r;
    847974#endif
     975
     976  if( __TREEOUTPUT__ )
     977  {
     978    Print("\n{ \"syzygylayer\": \"%d\", \"hybridnf\": \"%d\", \"diagrams\": \n[", __SYZNUMBER__, __HYBRIDNF__ );
     979  } 
    848980   
    849981  if( m_syzLeads == NULL )
    850982  {   
    851983#ifndef NDEBUG
     984    if( !__TREEOUTPUT__ )
    852985    if( TEST_OPT_PROT | 1)
    853986    {
     
    858991    ComputeLeadingSyzygyTerms( __LEAD2SYZ__ && !__IGNORETAILS__ ); // 2 terms OR 1 term!
    859992#ifndef NDEBUG
     993    if( !__TREEOUTPUT__ )
    860994    if( TEST_OPT_PROT | 1)
    861995    {
     
    8741008
    8751009  if( size == 1 && LL->m[0] == NULL )
    876     return;
     1010  {
     1011     if( __TREEOUTPUT__ )
     1012       PrintS("]},");
     1013     return;
     1014  }
     1015   
    8771016
    8781017  // use hybrid method?
    879   const bool method = (__HYBRIDNF__ == 1) || (__HYBRIDNF__ == 2 && __SYZNUMBER__ < 3);
     1018  const bool method = (__HYBRIDNF__  == 1) || (__HYBRIDNF__ == 2 && __SYZNUMBER__ < 3);
    8801019
    8811020  if(  !__IGNORETAILS__)
     
    8841023    {
    8851024#ifndef NDEBUG
     1025      if( !__TREEOUTPUT__ )
    8861026      if( TEST_OPT_PROT | 1 )
    8871027      {
     
    8931033      SetUpTailTerms();
    8941034#ifndef NDEBUG
     1035      if( !__TREEOUTPUT__ )
    8951036      if( TEST_OPT_PROT | 1)
    8961037      {
     
    9031044
    9041045#ifndef NDEBUG
     1046  if( !__TREEOUTPUT__ )
    9051047  if( TEST_OPT_PROT | 1)
    9061048  {
     
    9411083
    9421084#ifndef NDEBUG
     1085  if( !__TREEOUTPUT__ )
    9431086  if( TEST_OPT_PROT | 1)
    9441087  {
     
    9481091#endif   
    9491092
    950   TT->rank = id_RankFreeModule(TT, R); 
     1093  TT->rank = id_RankFreeModule(TT, R);
     1094   
     1095  if( __TREEOUTPUT__ )
     1096    PrintS("\n]},");
    9511097}
    9521098
     
    10111157  if( __TREEOUTPUT__ )
    10121158  {
    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\": [");
    10151161  }
    10161162   
     
    10241170#if NOPRODUCT
    10251171    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    }
    10261177#else   
    10271178    poly aa = leadmonom(syz_lead, r); assume( aa != NULL); // :(
     
    10301181    if( __TREEOUTPUT__ )
    10311182    {
    1032       PrintS("\\CONSIDERTERM{"); dPrint(aa, r, r, 0); PrintS("}\n");
     1183      PrintS("{ \"nodelabel\": \""); writeLatexTerm(syz_2, r); PrintS("\", \"edgelable\": \""); writeLatexTerm(aa, r, false); PrintS("\" },");
    10331184    }
    10341185     
     
    10411192   
    10421193  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 );
    10501194
    10511195  assume( L != NULL );
     
    11061250      if( __TREEOUTPUT__ )
    11071251      {
    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("\" },");
    11101253      }
    11111254
     
    11301273  if( __TREEOUTPUT__ )
    11311274  {   
    1132     PrintS("\\ROOTRESULT{"); dPrint(result, r, r, 0); PrintS("}");     
    1133     PrintS("\\end{ROOTTREE}\n");
     1275    PrintS("]},");
    11341276  }
    11351277   
     
    11571299  // TODO: store (multiplier, tail) -.-^-.-^-.--> !
    11581300  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   }
    11661301   
    11671302  if ( top_itr != m_cache.end() )
     
    11751310     if( itr != T.end() ) // Yey - Reuse!!!
    11761311     {
    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       
    11781317       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       
    11791327       if( !n_Equal( pGetCoeff(multiplier), pGetCoeff(itr->first), r) ) // normalize coeffs!?
    11801328       {
    1181         number n = n_Div( pGetCoeff(multiplier), pGetCoeff(itr->first), r);
     1329        number n = n_Div( pGetCoeff(multiplier), pGetCoeff(itr->first), r);
    11821330         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
    11871336       {
    1188          PrintS("\\REUSEROOTRESULT{"); dPrint(p, r, r, 0); PrintS("}\n");
    1189          PrintS("\\end{ROOTTREE}\n");
     1337         if( __TREEOUTPUT__ )
     1338           Print("\", \"RESCALEDRESULT\": \"0\" },");
    11901339       }
    11911340       
    11921341       return p;
    11931342     }
     1343
     1344     if( __TREEOUTPUT__ )
     1345     {
     1346//        PrintS("{ \"nodelabel\": \""); writeLatexTerm(multiplier, r, false); Print(" \\\\cdot \\\\GEN{%d}\", \"children\": [", tail + 1);
     1347     }     
    11941348     
    11951349     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);
    11981354     
    11991355     if( __TREEOUTPUT__ )
    12001356     {
    1201        PrintS("\\STOREROOTRESULT{"); dPrint(p, r, r, 0); PrintS("}");   
    1202        PrintS("\\end{ROOTTREE}\n");
     1357//      PrintS("], \"storedResult\": \""); writeLatexTerm(p, r, true, false); PrintS("\" },");
    12031358     }
     1359     
    12041360     return p_Copy(p, r);
    12051361  }
     1362   
    12061363  CCacheCompare o(r); TP2PCache T(o);
    12071364
     1365  if( __TREEOUTPUT__ )
     1366  {
     1367//     PrintS("{ \"nodelabel\": \""); writeLatexTerm(multiplier, r, false); Print(" \\\\cdot \\\\GEN{%d}\", \"children\": [", tail + 1);
     1368  }
     1369   
     1370   
    12081371  const poly p = ComputeImage(multiplier, tail);
    12091372
     
    12121375  m_cache.insert( TCache::value_type(tail, T) );
    12131376
     1377//  if( p == NULL )
     1378//    return (NULL);
     1379   
    12141380  if( __TREEOUTPUT__ )
    12151381  {
    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   
    12191385  return p_Copy(p, r);
    12201386}
     
    13051471#if NOPRODUCT
    13061472    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   
    13071482#else   
    13081483    // NOTE: only LT(term4reduction) should be used in the following:
    13091484    poly product = pp_Mult_mm(multiplier, term4reduction, r);
    13101485    s = m_div.FindReducer(product, syztermCheck, m_checker);
     1486
     1487    if( s == NULL ) // No Reducer?
     1488     return s;
    13111489     
    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);
    13151493    }
    13161494     
     
    13211499  if( s == NULL ) // No Reducer?
    13221500    return s;
    1323 
    1324   if( __TREEOUTPUT__ )
    1325   {
    1326     PrintS("\\CHILDNODE{"); dPrint(s, r, r, 0); PrintS("}\n");
    1327   }
     1501   
    13281502
    13291503  poly b = leadmonom(s, r);
     
    13321506  assume( c >= 0 && c < IDELEMS(T) );
    13331507
     1508   
    13341509  if( __TREEOUTPUT__ )
    1335   {
    1336      PrintS("\\begin{ROOTTREE}{"); dPrint(s, r, r, 0); PrintS("}");
    1337   }
     1510     PrintS("\", \"children\": [");
    13381511   
    13391512  const poly t = TraverseTail(b, c); // T->m[c];
    13401513
    1341   if( __TREEOUTPUT__ )
    1342   {
    1343     PrintS("\\ROOTRESULT{"); dPrint(t, r, r, 0); PrintS("}");   
    1344     PrintS("\\end{ROOTTREE}\n");
    1345   }
    1346    
    13471514  if( t != NULL )
    13481515    s = p_Add_q(s, t, r);
    13491516
     1517  if( __TREEOUTPUT__ )
     1518  {
     1519       
     1520    PrintS("], \"noderesult\": \"");
     1521    writeLatexTerm(s, r, true, false);
     1522    PrintS("\" },");
     1523  }
     1524   
    13501525  return s;
    13511526}
     
    13641539END_NAMESPACE   
    13651540
     1541     
    13661542SchreyerSyzygyComputationFlags::SchreyerSyzygyComputationFlags(idhdl rootRingHdl):
    13671543#ifndef NDEBUG
     
    15041680  assume( p_GetComp(p, r) == p_GetComp(product, r) );
    15051681
    1506   const int k = m_label;
    1507 
     1682//  const int k = m_label;
    15081683//  assume( m_L->m[k] == p );
    15091684
  • dyn_modules/syzextra/syzextra.h

    rc760e25 r8152f7  
    9090
    9191  /// Syzygy level (within a resolution)
    92   const int __SYZNUMBER__;
     92  mutable int __SYZNUMBER__;
     93   
     94  inline void  nextSyzygyLayer() const
     95  {
     96     __SYZNUMBER__++;
     97  }
    9398
    9499  /// output lifting tree
Note: See TracChangeset for help on using the changeset viewer.