Changeset 14e93b in git for Singular/LIB/schreyer.lib


Ignore:
Timestamp:
Jun 14, 2012, 10:18:24 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
ff7993e279b46dbac09bfb1762c976061c50eb24
Parents:
2c16b81352589f222e0e327ed8ce64db62736728
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-06-14 22:18:24+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:45+02:00
Message:
moved the main driver function ComputeSyzygy to the dyn.module

TODO: preprocessing
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/schreyer.lib

    r2c16b8 r14e93b  
    15781578  }
    15791579
    1580   def a; bigint c; int r, k; poly aa;
    1581 
    1582   int @LEAD2SYZ = 0;
    1583   if( typeof( attrib(basering, "LEAD2SYZ") ) == "int" )
    1584   {
    1585     @LEAD2SYZ = attrib(basering, "LEAD2SYZ");
    1586   }
    1587 
    1588   int @TAILREDSYZ = 1;
    1589   if( typeof( attrib(basering, "TAILREDSYZ") ) == "int" )
    1590   {
    1591     @TAILREDSYZ = attrib(basering, "TAILREDSYZ");
    1592   }
    1593 
    1594   int @HYBRIDNF = 0;
    1595   if( typeof( attrib(basering, "HYBRIDNF") ) == "int" )
    1596   {
    1597     @HYBRIDNF = attrib(basering, "HYBRIDNF");
    1598   }
    1599 
    1600   module LL;
    1601   def a2; int r2; poly aa2; 
    1602 
    1603   /// Get the critical leading syzygy terms
    1604   if( @LEAD2SYZ ) // & 2nd syz. term
    1605   {
    1606     module LL2;
    1607     (LL, LL2) = SSCompute2LeadingSyzygyTerms(L); // ++
    1608   } else
    1609   {
    1610     LL = SSComputeLeadingSyzygyTerms(L);
    1611   }
    1612 
    1613   module TT, SYZ; def spoly;
    1614 
    1615   if( size(LL) > 0 )
    1616   {
    1617     list LS;
    1618 
    1619     if( @TAILREDSYZ)
    1620     {
    1621       LS = list(LL);
    1622     }
    1623 
    1624     vector @tail;
    1625 
    1626     for(k = ncols(LL); k > 0; k-- )
    1627     {
    1628       // leading syz. term:
    1629       a = LL[k]; c = leadcomp(a); r = int(c); aa = leadmonomial(a);
    1630       //    "A: ", a, " --->>>> ", aa, " **** [", r, "]: ";
    1631 
    1632       // NF reduction:
    1633       if( !@HYBRIDNF )
     1580  list @res = ComputeSyzygy(L, T);
     1581
     1582  module @LL = @res[1]; module @TT = @res[2];
     1583
     1584  if( @KERCHECK )
     1585  {
     1586    if( typeof( attrib(basering, "SYZCHECK") ) == "int" )
     1587    {
     1588      int @SYZCHECK = attrib(basering, "SYZCHECK");
     1589    } else
     1590    {
     1591      int @SYZCHECK = @DEBUG;
     1592    }
     1593
     1594    int @LEAD2SYZ = 1;
     1595    if( typeof( attrib(basering, "LEAD2SYZ") ) == "int" )
     1596    {
     1597      @LEAD2SYZ = attrib(basering, "LEAD2SYZ");
     1598    }
     1599
     1600    int @TAILREDSYZ = 1;
     1601    if( typeof( attrib(basering, "TAILREDSYZ") ) == "int" )
     1602    {
     1603      @TAILREDSYZ = attrib(basering, "TAILREDSYZ");
     1604    }
     1605
     1606    int @HYBRIDNF = 0;
     1607    if( typeof( attrib(basering, "HYBRIDNF") ) == "int" )
     1608    {
     1609      @HYBRIDNF = attrib(basering, "HYBRIDNF");
     1610    }
     1611
     1612    module LL;
     1613
     1614    /// Get the critical leading syzygy terms
     1615    if( @LEAD2SYZ ) // & 2nd syz. term
     1616    {
     1617      module LL2;
     1618      (LL, LL2) = SSCompute2LeadingSyzygyTerms(L);
     1619    } else
     1620    {
     1621      LL = SSComputeLeadingSyzygyTerms(L);
     1622    }
     1623
     1624    module TT, SYZ;
     1625
     1626    vector a, a2; bigint c; int r; poly aa;
     1627
     1628    if( size(LL) > 0 )
     1629    {
     1630      list LS;
     1631
     1632      if( @TAILREDSYZ)
    16341633      {
    1635         /// TODO: save shortcut (aa) * T[r] -> ?
    1636         @tail = SSTraverseTail(aa, T[r], L, T, LS);
    1637   // //      @tail = SSTraverseTail(a, L, T, LS);
    1638 
    1639         // get the 2nd syzygy term...
    1640 
    1641         if( @LEAD2SYZ ) // with the 2nd syz. term:
    1642         {     
    1643           a2 = LL2[k]; c = leadcomp(a2); r2 = int(c); aa2 = leadmonomial(a2);
    1644 
    1645           @tail = @tail + a2 +
    1646                /// TODO: save shortcut (aa2) * T[r2] -> ?
    1647                SSTraverseTail(aa2, T[r2], L, T, LS);
    1648   // //               SSTraverseTail(a2, L, T, LS);
    1649         } else
     1634        LS = list(LL);
     1635      }
     1636
     1637      vector @tail;
     1638
     1639      for(int k = ncols(LL); k > 0; k-- )
     1640      {
     1641        // leading syz. term:
     1642        a = LL[k]; c = leadcomp(a); r = int(c); aa = leadmonomial(a);
     1643
     1644        // NF reduction:
     1645        if( !@HYBRIDNF ) // Traverse approach:
     1646        {       
     1647          @tail = SSTraverseTail(aa, T[r], L, T, LS);
     1648
     1649          // get the 2nd syzygy term...
     1650          if( @LEAD2SYZ ) // with the 2nd syz. term:
     1651          {     
     1652            a2 = LL2[k]; c = leadcomp(a2); r = int(c); aa = leadmonomial(a2);
     1653
     1654            @tail = a2 + @tail + SSTraverseTail(aa, T[r], L, T, LS);
     1655          } else
     1656          {
     1657            @tail = @tail + SSReduceTerm(aa, L[r], a, L, T, LS);
     1658          }
     1659
     1660        } else // Hybrid approach:
    16501661        {
    1651           @tail = @tail +
    1652                   SSReduceTerm(aa, L[r], a, L, T, LS);
    1653   // //                  SSReduceTerm(a, L, T, LS);
     1662
     1663          // get the 2nd syzygy term...
     1664          if( @LEAD2SYZ )
     1665          {
     1666            a2 = LL2[k];
     1667          } else
     1668          {
     1669            a2 = SSFindReducer( aa * L[r], a, L, LS);
     1670          }
     1671
     1672          if ( (@SYZCHECK || @DEBUG) )
     1673          {
     1674            if( size(a2) == 0 ) // if syzterm == 0!!!!
     1675            {
     1676              "ERROR in SSComputeSyzygy: could not find the 2nd syzygy term during the hybrid NF!!!";
     1677              $
     1678            }
     1679          }
     1680
     1681          @tail = SSSchreyerSyzygyNF(a, a2, L, T, LS);
    16541682        }
    1655       } else
    1656       {
    1657         if( @LEAD2SYZ )
    1658         {
    1659           a2 = LL2[k];
    1660         } else
    1661         {
    1662           a2 = SSFindReducer( aa * L[r], a, L, LS);
    1663         }
    1664 
    1665         if ( (@SYZCHECK || @DEBUG) )
    1666         {
    1667           if( size(a2) == 0 ) // if syzterm == 0!!!!
    1668           {
    1669             "ERROR: could not find the 2nd syzygy term during the hybrid NF!!!";
    1670             $
    1671           }
    1672         }
    1673 
    1674         @tail = SSSchreyerSyzygyNF(a, a2, L, T, LS);
     1683
     1684        TT[k] = @tail;
     1685        SYZ[k] = a + @tail;
    16751686      }
    1676      
    1677       TT[k] = @tail;
    1678       SYZ[k] = a + @tail;
    1679     }
    1680   }
    1681 
     1687    }
     1688
     1689    if( ncols(LL) != ncols(@LL) )
     1690    {
     1691      "ERROR in SSComputeSyzygy: wrong leading syzygies!?";
     1692      "";
     1693      L; T;
     1694      "";
     1695      type(LL);
     1696      type(@LL);
     1697      $
     1698    }
     1699
     1700    if( ncols(TT) != ncols(@TT) )
     1701    {
     1702      "ERROR in SSComputeSyzygy: wrong tail syzygies!?";
     1703      "";
     1704      L; T;
     1705      "";
     1706      type(LL);
     1707      type(@LL);
     1708      "";
     1709      type(TT);
     1710      type(@TT);
     1711      $
     1712    }
     1713   
     1714    if( size( module( matrix(LL) - matrix(@LL) ) ) != 0 )
     1715    {
     1716      "ERROR in SSComputeSyzygy: wrong leading syzygies!?";
     1717      "";
     1718      L; T;
     1719      "";
     1720      type(LL);
     1721      type(@LL);
     1722      $
     1723    }
     1724
     1725
     1726    if( size( module( matrix(TT) - matrix(@TT) ) ) != 0 )
     1727    {
     1728      "ERROR in SSComputeSyzygy: wrong tail syzygies!?";
     1729      TT; @TT;
     1730      L; T;
     1731      $
     1732    }   
     1733   
     1734  }
     1735
     1736  module @SYZ;
     1737 
     1738  for(int @k = ncols(@LL); @k > 0; @k-- )
     1739  {
     1740    @SYZ[@k] = @LL[@k] + @TT[@k];
     1741  }
     1742 
    16821743  if( @DEBUG )
    16831744  {
    16841745    "SSComputeSyzygy::Output";
    16851746
    1686     "SYZ: "; SYZ;
    1687     "LL: "; LL;
    1688     "TT: "; TT;
    1689   }
    1690 
    1691   return (SYZ, LL, TT);
     1747//    "SYZ: "; @SYZ;
     1748    "LL: "; @LL;
     1749    "TT: "; @TT;
     1750  }
     1751
     1752  return (@SYZ, @LL, @TT);
    16921753}
    16931754
     
    20502111
    20512112      exportto(Schreyer, Syzextra::SchreyerSyzygyNF);
     2113      exportto(Schreyer, Syzextra::ComputeSyzygy);
    20522114    }
    20532115/*
     
    21012163
    21022164      exportto(Schreyer, Syzextra_g::SchreyerSyzygyNF);
     2165      exportto(Schreyer, Syzextra_g::ComputeSyzygy);
    21032166    }
    21042167*/
Note: See TracChangeset for help on using the changeset viewer.