Changeset fdde6ce in git for Singular


Ignore:
Timestamp:
May 10, 2012, 5:56:36 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
b0ca43c93260d239fb0b76a8aa762b1ea55d09a2
Parents:
f3746721cf443ba4cbafcb32045986a9aa9ca197
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-05-10 17:56:36+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-05-10 18:23:40+02:00
Message:
Further SingularC Schreyer Syzygy/Resolution computation

add: options as basering attributes:
add: option for tail-reduced output (experimentall!)
add: option for the computation of leading syzygy with OR without 2nd syz. term
chg: renamed main recursive procedures
chg: SSTraverseTail (SSTraverse) takes an element itself now (instead of taking index i and looking up Tail[i])
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/schreyer.lib

    rf37467 rfdde6ce  
    532532  if( @DEBUG )
    533533  {
    534     "SSinit::StartingISRing";
     534    "SSinit::NewRing(C, lex)";
    535535    basering;
    536536//    DetailedPrint(basering);
     
    588588 
    589589  attrib(S, "InducionStart", @RANK);
     590  attrib(S, "LEAD2SYZ", 1);
     591  attrib(S, "TAILREDSYZ", 0);
     592  attrib(S, "DEBUG", @DEBUG);
    590593 
    591594  if( @DEBUG )
     
    635638proc SSComputeLeadingSyzygyTerms(def L)
    636639{
    637   int @DEBUG = !system("with", "ndebug");
     640  if( typeof( attrib(basering, "DEBUG") ) == "int" )
     641  {
     642    int @DEBUG = attrib(basering, "DEBUG");
     643  } else
     644  {
     645    int @DEBUG = !system("with", "ndebug");
     646  }
    638647
    639648  if( @DEBUG )
     
    717726
    718727/// Compute Syz(L), where L is a monomial (leading) module
    719 proc SSCompute2LeadingSyzygyTerms(def L)
    720 {
    721   int @DEBUG = !system("with", "ndebug");
     728proc SSCompute2LeadingSyzygyTerms(def L, int @TAILREDSYZ)
     729{
     730  if( typeof( attrib(basering, "DEBUG") ) == "int" )
     731  {
     732    int @DEBUG = attrib(basering, "DEBUG");
     733  } else
     734  {
     735    int @DEBUG = !system("with", "ndebug");
     736  }
    722737
    723738  if( @DEBUG )
     
    725740    "SSCompute2LeadingSyzygyTerms::Input: ";
    726741    L;
     742    "@TAILREDSYZ: ", @TAILREDSYZ;
    727743  }
    728744
     
    770786  }
    771787
    772   // Make sure that 2nd syzygy terms are not reducible by 1st
    773   def opts = option(get);
    774   option(redSB); option(redTail);
    775   S = std(S); // binomial module
    776   option(set, opts);
    777 //  kill opts; 
     788  if( @TAILREDSYZ )
     789  {
     790    // Make sure that 2nd syzygy terms are not reducible by 1st
     791    def opts = option(get);
     792    option(redSB); option(redTail);
     793    S = std(S); // binomial module
     794    option(set, opts);
     795    //  kill opts;
     796  } else
     797  {
     798    S = simplify(S, 2 + 32);
     799  }
    778800
    779801  S = sort(S, "ds", 1)[1]; // ,1 => reversed!
     
    810832
    811833/// TODO: save shortcut LM(m) * "t" -> ?
    812 proc SSReduce(poly m, def t, def L, def T, def LS)
    813 {
    814   int @DEBUG = !system("with", "ndebug");
     834proc SSReduceTerm(poly m, def t, def L, def T, list #)
     835{
     836  if( typeof( attrib(basering, "DEBUG") ) == "int" )
     837  {
     838    int @DEBUG = attrib(basering, "DEBUG");
     839  } else
     840  {
     841    int @DEBUG = !system("with", "ndebug");
     842  }
    815843
    816844  if( @DEBUG )
     
    822850    "L: ", L;
    823851    "T: ", T;
    824     "LS: ", LS;
     852    if( size(#) > 0 )
     853    {
     854      "LSyz: ", #;
     855    }
    825856//    "attrib(LS, 'isSB')", attrib(LS, "isSB");
    826857  }
     
    837868  bigint c = leadcomp(t);
    838869  int r = int(c);
    839 
    840870 
    841871  def a, b, nf, bb;
     
    855885//        "b: ", b;
    856886        bb = b * gen(k);
    857         nf = NF(bb, LS);
    858 
     887        nf = bb;
     888
     889        if( size(#) > 0 )
     890        {
     891          if( typeof(#[1]) == "module" )
     892          {
     893            nf = NF(bb, #[1]);
    859894//        "NF: ", nf;
     895          }
     896        }
     897
    860898        // while the complement (the fraction) is not reducible by leading syzygies
    861899        if( nf != 0 )
    862900        {
    863           s = bb + SSTraverse(b, k, L, T, LS);
     901          /// TODO: save shortcut LM(m) * T[i] -> ?
     902
     903          // choose ANY such reduction... (with the biggest index?)
     904          s = bb + SSTraverseTail(b, T[k], L, T, #);
    864905          break;
    865906        }
     
    869910  if( @DEBUG )
    870911  {
    871     "SSReduce::Output: ", s;
     912    "SSReduceTerm::Output: ", s;
    872913  }
    873914  return (s);
    874915}
    875916
    876 /// TODO: save shortcut LM(m) * T[i] -> ?
    877 proc SSTraverse(poly m, int i, def L, def T, def LS)
    878 {
    879   int @DEBUG = !system("with", "ndebug");
     917// TODO: store m * @tail -.-^-.-^-.--> ?
     918proc SSTraverseTail(poly m, def @tail, def L, def T, list #)
     919{
     920  if( typeof( attrib(basering, "DEBUG") ) == "int" )
     921  {
     922    int @DEBUG = attrib(basering, "DEBUG");
     923  } else
     924  {
     925    int @DEBUG = !system("with", "ndebug");
     926  }
    880927
    881928  if( @DEBUG )
     
    883930    "SSTraverse::Input: ";
    884931
    885     "index: ", i;
    886932    "mult: ", m;
    887 
    888     "lead: ", L[i];
    889     "tail: ", T[i];
    890 
    891     "LSyz: ", LS;
    892 //    "attrib(LS, 'isSB')", attrib(LS, "isSB");
    893   }
    894 
    895   //  reduce the product m * ( L[i] + T[i] ):
    896 //  SSReduce(m, L[i], L, T, LS);
    897 
    898   def @tail = T[i]; def @l;
     933    "tail: ", @tail; // T[i];
     934
     935    if( size(#) > 0 )
     936    {
     937      "LSyz: "; #[1];
     938    }
     939  }
    899940
    900941  vector s = 0;
    901942
     943  def @l;
     944
     945  // iterate tail-terms in ANY order!
    902946  while( size(@tail) > 0 )
    903947  {
    904948    @l = lead(@tail);
    905     s = s + SSReduce(m, @l, L, T, LS);
     949    s = s + SSReduceTerm(m, @l, L, T, #);
    906950    @tail = @tail - @l;
    907951  }
     
    909953  if( @DEBUG )
    910954  {
    911     "SSTraverse::Output: ", s;
     955    "SSTraverseTail::Output: ", s;
    912956  }
    913957  return (s);
     
    918962// module (N, LL, TT) = SSComputeSyzygy(L, T);
    919963// Compute Syz(L ++ T) = N = LL ++ TT
    920 proc SSComputeSyzygy(/*def M, */ def L, def T)
    921 {
    922   int @DEBUG = !system("with", "ndebug");
    923 
     964proc SSComputeSyzygy(def L, def T)
     965{
     966  if( typeof( attrib(basering, "DEBUG") ) == "int" )
     967  {
     968    int @DEBUG = attrib(basering, "DEBUG");
     969  } else
     970  {
     971    int @DEBUG = !system("with", "ndebug");
     972  }
     973 
    924974  if( @DEBUG )
    925975  {
     
    930980//    "iCompShift: ", iCompShift;
    931981
    932 //    "M: "; M;
    933982    "L: "; L;
    934983    "T: "; T;
    935984  }
    936985
    937   def a, a2; bigint c; int r, r2, k; poly aa, aa2;
    938 
     986  def a; bigint c; int r, k; poly aa;
     987
     988  int @LEAD2SYZ = 0;
     989  if( typeof( attrib(basering, "LEAD2SYZ") ) == "int" )
     990  {
     991    @LEAD2SYZ = attrib(basering, "LEAD2SYZ");
     992  }
     993
     994  int @TAILREDSYZ = 1;
     995  if( typeof( attrib(basering, "TAILREDSYZ") ) == "int" )
     996  {
     997    @TAILREDSYZ = attrib(basering, "TAILREDSYZ");
     998//    @TAILREDSYZ;
     999  }
     1000 
    9391001  /// Get the critical leading syzygy terms
    940   // module LL = SSComputeLeadingSyzygyTerms(L);
    941 
    942   module LL, LL2; (LL, LL2) = SSCompute2LeadingSyzygyTerms(L);
     1002  if( @LEAD2SYZ ) // & 2nd syz. term
     1003  {
     1004    def a2; int r2; poly aa2; 
     1005    module LL, LL2;
     1006    (LL, LL2) = SSCompute2LeadingSyzygyTerms(L, @TAILREDSYZ); // ++
     1007  } else
     1008  {
     1009    module LL = SSComputeLeadingSyzygyTerms(L);
     1010  }
    9431011
    9441012  module TT, SYZ;
    9451013
    9461014  if( size(LL) > 0 )
    947   { 
     1015  {
     1016    list LS;
     1017
     1018    if( @TAILREDSYZ )
     1019    {
     1020      LS = list(LL);
     1021    }
     1022   
    9481023    vector @tail;
    9491024
     
    9521027      // leading syz. term:
    9531028      a = LL[k]; c = leadcomp(a); r = int(c); aa = leadmonomial(a);
    954 
    955       // 2nd syz. term:
    956       a2 = LL2[k]; c = leadcomp(a2); r2 = int(c); aa2 = leadmonomial(a2);
     1029      //    "A: ", a, " --->>>> ", aa, " **** [", r, "]: ";
     1030
     1031      /// TODO: save shortcut (aa) * T[r] -> ?
     1032      @tail = SSTraverseTail(aa, T[r], L, T, LS);
     1033             
     1034      // get the 2nd syzygy term...
     1035     
     1036      if( @LEAD2SYZ ) // with the 2nd syz. term:
     1037      {     
     1038        a2 = LL2[k]; c = leadcomp(a2); r2 = int(c); aa2 = leadmonomial(a2);
     1039        @tail = @tail +
     1040             /// TODO: save shortcut (aa2) * T[r2] -> ?
     1041             a2 + SSTraverseTail(aa2, T[r2], L, T, LS);
     1042      } else
     1043      {
     1044        @tail = @tail + SSReduceTerm(aa, L[r], L, T, LS);
     1045      }
    9571046     
    9581047     
    959   //    "A: ", a, " --->>>> ", aa, " **** [", r, "]: ";
    960       @tail = a2 + 
    961              SSTraverse(aa, r, L, T, LL) +
    962              SSTraverse(aa2, r2, L, T, LL)
    963 //                SSReduce(aa, L[r], L, T, LL) // get the 2nd syzygy term...
    964              ;
    9651048      TT[k] = @tail;
    9661049      SYZ[k] = a + @tail;
     
    9681051  }
    9691052
    970 /* 
     1053/*
    9711054  def opts = option(get); option(redSB); option(redTail);
    972   module SYZ = std(syz(M)); // TODO: !!!!!!!!!!!
     1055  module SYZ = std(syz(M));
    9731056  option(set, opts); kill opts;
    974 
    975   "SYZ: ";  SYZ;  print(SYZ);
    976 
    977   "shifted SYZ: ";  SYZ;  print(SYZ);
    978  
    979   module LL, TT;
    980 
    981   LL = lead(SYZ); // TODO: WRONG ORDERING!!!!!!!!
    982   TT = Tail(SYZ);
     1057 
     1058  module LL = lead(SYZ); // TODO: WRONG ORDERING!!!!!!!!
     1059  module TT = Tail(SYZ);
    9831060*/
    9841061 
Note: See TracChangeset for help on using the changeset viewer.