Changeset 5bcb3f in git


Ignore:
Timestamp:
Oct 27, 2014, 3:44:39 PM (9 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
0b7fb89c0352a1d5f5996c80b66dbeae73a4a7ea
Parents:
e35d92b57a92eda11cfceda8863bc5aec0053766
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-10-27 15:44:39+01:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-10-31 17:55:06+01:00
Message:
Syzextra: minor changes / treeoutput
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/dyn_modules/syzextra/syzextra.cc

    re35d92b r5bcb3f  
    961961  if( __TREEOUTPUT__ )
    962962  {
    963      PrintS("{ \"nodelabel\": \""); writeLatexTerm(a, R); PrintS("\", \"children\": [");
    964   }
    965 
     963     PrintS("{ \"proc\": \"TraverseNF\", \"nodelabel\": \""); writeLatexTerm(a, R); PrintS("\", \"children\": [");
     964  }
    966965
    967966  poly aa = leadmonom(a, R); assume( aa != NULL); // :(
     
    983982    if( __TREEOUTPUT__ )
    984983    {
    985        PrintS("{ \"nodelabel\": \""); writeLatexTerm(a2, R); PrintS("\", \"children\": [");
     984       PrintS("{ \"proc\": \"TraverseNF2\", \"nodelabel\": \""); writeLatexTerm(a2, R); PrintS("\", \"children\": [");
    986985    }
    987986
     
    995994    p_Delete(&aa2, R);
    996995
    997     if( __TREEOUTPUT__ )
    998        PrintS("]},");
    999996
    1000997#ifndef SING_NDEBUG
     
    10051002    }
    10061003#endif
     1004
     1005    if( __TREEOUTPUT__ )
     1006      PrintS("], \"noderesult\": \""); writeLatexTerm(t, R, true, false); PrintS("\" },");
     1007   
    10071008  } else
    10081009    t = p_Add_q(t, ReduceTerm(aa, L->m[r], a), R);
     
    10101011  p_Delete(&aa, R);
    10111012
    1012   // TODO: print t???
    1013 
    10141013  if( __TREEOUTPUT__ )
    10151014  {
    1016     poly tt = pp_Add_qq( a, t, R);  // TODO: ADD a?
    1017     PrintS("], \"noderesult\": \""); writeLatexTerm(tt, R, true, false); PrintS("\", \"proc\": \"TraverseNF\" },");
     1015    poly tt = pp_Add_qq( a, t, R);   
     1016    PrintS("], \"noderesult\": \""); writeLatexTerm(tt, R, true, false); PrintS("\" },");
    10181017    p_Delete(&tt, R);
    10191018  }
     
    13421341}
    13431342
    1344 #define NOPRODUCT 0
     1343#define NOPRODUCT 1
    13451344
    13461345poly SchreyerSyzygyComputation::SchreyerSyzygyNF(const poly syz_lead, poly syz_2) const
     
    15451544         return (NULL);
    15461545
    1547        poly p = p_Copy(itr->second, r); // no copy???
    1548 
    15491546       if( __TREEOUTPUT__ )
    15501547       {
    15511548//         PrintS("{ \"nodelabel\": \""); writeLatexTerm(multiplier, r, false);
    15521549//         Print("  \\\\GEN{%d}\", \"children\": [ ", tail + 1);
    1553          PrintS("{ \"proc\": \"TraverseTail-lookup\", \"nodelabel\": \"");
    1554          writeLatexTerm(multiplier, r, false); Print(" \\\\GEN{%d}\", \"look-up-poly\": \"", tail + 1);
    1555          writeLatexTerm(p, r, true, false);
     1550         PrintS("{ \"proc\": \"TTLookup\", \"nodelabel\": \"");
     1551         writeLatexTerm(itr->first, r, false); Print(" \\\\GEN{%d}\", \"Lookup\": \"", tail + 1);
     1552         writeLatexTerm(itr->second, r, true, false);
    15561553         PrintS("\", ");
    15571554       }
     1555       
     1556       poly p = p_Copy(itr->second, r); // COPY!!!
     1557
    15581558
    15591559       if( !n_Equal( pGetCoeff(multiplier), pGetCoeff(itr->first), r) ) // normalize coeffs!?
    15601560       {
    1561          number n = n_Div( pGetCoeff(multiplier), pGetCoeff(itr->first), r);
    1562          p = p_Mult_nn(p, n, r);
     1561         number n = n_Div( pGetCoeff(multiplier), pGetCoeff(itr->first), r); // new number
     1562         
     1563         if( __TREEOUTPUT__ )
     1564         {
     1565           StringSetS("");
     1566           n_Write(n, r);
     1567           char* s = StringEndS();
     1568           Print("\"recale\": \"%s\", ", s);
     1569           omFree(s);
     1570         }
     1571         
     1572         p = p_Mult_nn(p, n, r); // !
    15631573         n_Delete(&n, r);
    1564 
    1565          if( __TREEOUTPUT__ )
    1566            PrintS("\"rescale\": \"1\", ");
    1567        } else
    1568        {
    1569          if( __TREEOUTPUT__ )
    1570            PrintS("\"rescale\": \"0\", ");
    15711574       }
    15721575
    15731576       if( __TREEOUTPUT__ )
    15741577       {
    1575          PrintS("\"noderesult\": \"");
    1576          writeLatexTerm(p, r, true, false);
    1577          PrintS("\" },");
     1578         PrintS("\"noderesult\": \"");         writeLatexTerm(p, r, true, false);         PrintS("\" },");
    15781579       }
    15791580
    15801581#ifndef SING_NDEBUG
    1581        if( __DEBUG__ )
    1582        {
    1583          m_div.Verify();
    1584          m_checker.Verify();
    1585        }
     1582       if( __DEBUG__ )       {         m_div.Verify();         m_checker.Verify();       }
    15861583#endif
    15871584       
     
    15921589     if( __TREEOUTPUT__ )
    15931590     {
    1594        PrintS("{ \"nodelabel\": \""); writeLatexTerm(multiplier, r, false); Print(" \\\\GEN{%d}\", \"children\": [", tail + 1);
     1591       Print("{ \"proc\": \"TTStore%d\", \"nodelabel\": \"", tail + 1); writeLatexTerm(multiplier, r, false); Print(" \\\\GEN{%d}\", \"children\": [", tail + 1);
    15951592     }
    15961593     
    15971594     const poly p = ComputeImage(multiplier, tail);
    15981595
     1596     if( __TREEOUTPUT__ )
     1597     {
     1598       PrintS("], \"noderesult\": \""); writeLatexTerm(p, r, true, false); PrintS("\" },");
     1599     }
     1600
    15991601     T.insert( TP2PCache::value_type(p_Copy(multiplier, r), p) ); //     T[ multiplier ] = p;
    16001602
    16011603//     if( p == NULL )
    16021604//        return (NULL);
    1603 
    1604      if( __TREEOUTPUT__ )
    1605      {
    1606        PrintS("], \"noderesult\": \""); writeLatexTerm(p, r, true, false); PrintS("\", \"proc\": \"TraverseTail-compute-and-store1\" },");
    1607      }
    16081605
    16091606#ifndef SING_NDEBUG
     
    16221619  if( __TREEOUTPUT__ )
    16231620  {
    1624     PrintS("{ \"nodelabel\": \""); writeLatexTerm(multiplier, r, false); Print(" \\\\GEN{%d}\", \"children\": [", tail + 1);
     1621    Print("{ \"proc\": \"TTStore%d\", \"nodelabel\": \"", 0); writeLatexTerm(multiplier, r, false); Print(" \\\\GEN{%d}\", \"children\": [", tail + 1);
    16251622  }
    16261623
     
    16281625  const poly p = ComputeImage(multiplier, tail);
    16291626
     1627  if( __TREEOUTPUT__ )
     1628  {
     1629    PrintS("], \"noderesult\": \""); writeLatexTerm(p, r, true, false); PrintS("\" },");
     1630  }
     1631 
    16301632  T.insert( TP2PCache::value_type(p_Copy(multiplier, r), p) );
    16311633
     
    16351637//    return (NULL);
    16361638
    1637   if( __TREEOUTPUT__ )
    1638   {
    1639     PrintS("], \"noderesult\": \""); writeLatexTerm(p, r, true, false); PrintS("\", \"proc\": \"TraverseTail-compute-and-store2\" },");
    1640   }
    1641 
    16421639#ifndef SING_NDEBUG
    16431640  if( __DEBUG__ )
     
    16531650poly SchreyerSyzygyComputation::ComputeImage(poly multiplier, const int tail) const
    16541651{
     1652  const ring& r = m_rBaseRing;
     1653
     1654  assume(m_idTails !=  NULL && m_idTails->m != NULL);
     1655  assume( tail >= 0 && tail < IDELEMS(m_idTails) );
     1656 
    16551657  const poly t = m_idTails->m[tail]; // !!!
    16561658
    16571659  if(t != NULL)
    1658     return TraverseTail(multiplier, t);
     1660  {
     1661    if( __TREEOUTPUT__ )
     1662    {
     1663      PrintS("{ \"proc\": \"ComputeImage\", \"nodelabel\": \"");
     1664      writeLatexTerm(multiplier, r, false);
     1665      Print(" \\\\GEN{%d}\", \"edgelabel\": \"", tail + 1);
     1666      writeLatexTerm(t, r, false);
     1667      PrintS("\", \"children\": [");
     1668    }
     1669   
     1670    const poly p = TraverseTail(multiplier, t);
     1671
     1672    if( __TREEOUTPUT__ )
     1673    {
     1674      PrintS("], \"noderesult\": \""); writeLatexTerm(p, r, true, false); PrintS("\" },");
     1675    }
     1676   
     1677    return p;
     1678   
     1679  }
    16591680
    16601681  return NULL;
     
    16831704  assume( T != NULL );
    16841705
    1685 
    16861706  if( (!__TAILREDSYZ__) || m_lcm.Check(multiplier) )
    16871707  {
     
    16951715//    CPolynomialSummator sum(r, bUsePolynomial);
    16961716//    poly s = NULL;
     1717
     1718    if( __TREEOUTPUT__ )
     1719    {
     1720      Print("{ \"proc\": \"TTPoly\", \"nodelabel\": \""); writeLatexTerm(multiplier, r, false); Print(" * \\\\ldots \", \"children\": [");
     1721    }
     1722   
    16971723    for(poly p = tail; p != NULL; p = pNext(p))   // iterate over the tail
    16981724    {
     
    17201746#endif
    17211747
     1748    if( __TREEOUTPUT__ )
     1749    {
     1750      PrintS("], \"noderesult\": \""); writeLatexTerm(s, r, true, false); PrintS("\" },");
     1751    }   
     1752
    17221753    return s;
    17231754  }
     
    17751806    {
    17761807      poly product = pp_Mult_mm(multiplier, term4reduction, r);
    1777       PrintS("{ \"proc\": \"ReduceTerm-NOPRODUCT\", \"nodelabel\": \""); writeLatexTerm(s, r); PrintS("\", \"edgelabel\": \""); writeLatexTerm(product, r, false);
     1808      PrintS("{ \"proc\": \"RdTrmNoP\", \"nodelabel\": \""); writeLatexTerm(s, r); PrintS("\", \"edgelabel\": \""); writeLatexTerm(product, r, false);
    17781809      p_Delete(&product, r);
    17791810    }
     
    17891820    if( __TREEOUTPUT__ )
    17901821    {
    1791       PrintS("{ \"proc\": \"ReduceTerm-PRODUCT\", \"nodelabel\": \""); writeLatexTerm(s, r); PrintS("\", \"edgelabel\": \""); writeLatexTerm(product, r, false);
     1822      PrintS("{ \"proc\": \"RdTrmP\", \"nodelabel\": \""); writeLatexTerm(s, r); PrintS("\", \"edgelabel\": \""); writeLatexTerm(product, r, false);
    17921823    }
    17931824
     
    18041835#endif
    18051836
    1806 #ifndef SING_NDEBUG
    1807   if( __DEBUG__ )
    1808   {
    1809     m_div.Verify();
    1810     m_checker.Verify();
    1811   }
    1812 #endif
    1813  
    18141837  if( s == NULL ) // No Reducer?
    18151838    return s;
    1816 
    1817 
     1839 
    18181840  poly b = leadmonom(s, r);
    18191841
     
    18351857    PrintS("], \"noderesult\": \"");
    18361858    writeLatexTerm(s, r, true, false);
    1837     PrintS("\" },");
    1838   }
    1839 
     1859    PrintS("\"");
     1860
     1861    if( syztermCheck != NULL )
     1862    {
     1863      PrintS(", \"syztermCheck\":\"" );
     1864      writeLatexTerm(syztermCheck, r, true, false);
     1865      PrintS("\" },");     
     1866    } else
     1867      PrintS(" },");
     1868  }
     1869
     1870 
    18401871#ifndef SING_NDEBUG
    18411872  if( __DEBUG__ )
Note: See TracChangeset for help on using the changeset viewer.