Changeset f37467 in git


Ignore:
Timestamp:
May 9, 2012, 7:34:48 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '8d54773d6c9e2f1d2593a28bc68b7eeab54ed529')
Children:
fdde6cefc2a23bb663a3fe197b2e24bffacac361
Parents:
4b2e47d69832168747120de4721b9900101c96c7
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-05-09 19:34:48+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-05-10 18:23:40+02:00
Message:
Compute the whole inter-reduced & tail-reduced Syz(lead) instead of L(Syz(lead))!

add: SSCompute2LeadingSyzygyTerms
chg: test the syz. property only in @DEBUG mode
fix: removed no SB warning during NF
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/schreyer.lib

    r4b2e47 rf37467  
    144144 
    145145  module M = imap(@save, M);
     146 
    146147  attrib(M, "isHomog", @V);
    147148  attrib(M, "isSB", 1);
     
    157158  }
    158159
    159   // 0^th syz. property
    160   if( size(module(transpose( transpose(M) * transpose(MRES) ))) > 0 )
    161   {
    162     transpose( transpose(M) * transpose(MRES) );
    163     "transpose( transpose(M) * transpose(MRES) ) != 0!!!";
    164     $
     160  if( @DEBUG )
     161  {
     162    // 0^th syz. property
     163    if( size(module(transpose( transpose(M) * transpose(MRES) ))) > 0 )
     164    {
     165      transpose( transpose(M) * transpose(MRES) );
     166      "transpose( transpose(M) * transpose(MRES) ) != 0!!!";
     167      $
     168    }
    165169  }
    166170
     
    278282//  N;
    279283 
    280   if( size(N) > 0 )
    281   {
    282     // next syz. property
    283     if( size(module(transpose( transpose(N) * transpose(MRES) ))) > 0 )
    284     {
    285       MRES;
    286 
    287       "N: "; N; DetailedPrint(N, 10);
    288 
    289       "K:"; K; DetailedPrint(K, 10);
    290 
    291       "RANKS: ", @RANK;
    292 
    293       "transpose( transpose(N) * transpose(MRES) ) != 0!!!";
    294       transpose( transpose(N) * transpose(MRES) );
    295 
    296       "transpose(N) * transpose(MRES): ";
    297       transpose(N) * transpose(MRES);
    298       DetailedPrint(module(_), 2);
    299       $
     284  if( @DEBUG )
     285  {
     286    if( size(N) > 0 )
     287    {
     288      // next syz. property
     289      if( size(module(transpose( transpose(N) * transpose(MRES) ))) > 0 )
     290      {
     291        MRES;
     292
     293        "N: "; N; DetailedPrint(N, 10);
     294
     295        "K:"; K; DetailedPrint(K, 10);
     296
     297        "RANKS: ", @RANK;
     298
     299        "transpose( transpose(N) * transpose(MRES) ) != 0!!!";
     300        transpose( transpose(N) * transpose(MRES) );
     301
     302        "transpose(N) * transpose(MRES): ";
     303        transpose(N) * transpose(MRES);
     304        DetailedPrint(module(_), 2);
     305        $
     306      }
    300307    }
    301308  }
     
    468475 
    469476  int @DEBUG = !system("with", "ndebug");
     477 
    470478  if( @DEBUG )
    471479  {
     
    539547 
    540548  def M = imap(@save, M);
     549
    541550  attrib(M, "isHomog", @V);
    542551  attrib(M, "isSB", 1);
    543 
    544552  attrib(M, "degrees", @DEGS); 
    545553 
    546554  def LEAD = imap(@save, LEAD);
     555 
    547556  attrib(LEAD, "isHomog", @V);
    548557  attrib(LEAD, "isSB", 1); 
     
    559568  }
    560569
    561   // 0^th syz. property
    562   if( size(module(transpose( transpose(M) * transpose(MRES) ))) > 0 )
    563   {
    564     transpose( transpose(M) * transpose(MRES) );
    565     "ERROR: transpose( transpose(M) * transpose(MRES) ) != 0!!!";
    566     $
     570  if( @DEBUG )
     571  {
     572    // 0^th syz. property
     573    if( size(module(transpose( transpose(M) * transpose(MRES) ))) > 0 )
     574    {
     575      transpose( transpose(M) * transpose(MRES) );
     576      "ERROR: transpose( transpose(M) * transpose(MRES) ) != 0!!!";
     577      $
     578    }
    567579  }
    568580
     
    573585  MRES = MRES, M; //?
    574586
    575   attrib(MRES, "isHomog", @V); 
    576 
     587  attrib(MRES, "isHomog", @V);
     588 
    577589  attrib(S, "InducionStart", @RANK);
    578590 
     
    619631
    620632
    621 proc SSComputeLeadingSyzygyTerms(def L, int iCompShift)
     633
     634/// Compute L(Syz(L))
     635proc SSComputeLeadingSyzygyTerms(def L)
    622636{
    623637  int @DEBUG = !system("with", "ndebug");
     
    627641    "SSComputeLeadingSyzygyTerms::Input: ";
    628642    L;
    629     "iCompShift: ", iCompShift;
    630643  }
    631644
     
    685698    M = M[iv_ds];
    686699   
    687     S = S, M * gen(i + iCompShift);
     700    S = S, M * gen(i);
    688701  }
    689702
    690703  S = simplify(S, 2);
    691704
     705  S = sort(S, "ds", 1)[1]; // ,1 => reversed! // TODO: not needed?
    692706 
    693707  if( @DEBUG )
     
    695709    "SSComputeLeadingSyzygyTerms::Output: ";
    696710    S;
    697   }
     711  } 
    698712
    699713  attrib(S, "isSB", 1);
    700714
    701715  return (S);
    702 
    703 }
    704 
    705 proc SSReduce(poly m, def t, def L, def T, module LS)
     716}
     717
     718/// Compute Syz(L), where L is a monomial (leading) module
     719proc SSCompute2LeadingSyzygyTerms(def L)
     720{
     721  int @DEBUG = !system("with", "ndebug");
     722
     723  if( @DEBUG )
     724  {
     725    "SSCompute2LeadingSyzygyTerms::Input: ";
     726    L;
     727  }
     728
     729  int i, j, r;
     730  int N = ncols(L);
     731  def a, b;
     732
     733  poly aa, bb, @lcm;
     734
     735  bigint c;
     736
     737  module M;
     738
     739  module S = 0;
     740
     741  for(i = 1; i <= N; i++)
     742  {
     743    a = L[i];
     744//    "a: ", a;
     745    c = leadcomp(a);
     746    r = int(c);
     747
     748    aa = leadmonomial(a);
     749
     750    M = 0;
     751
     752    for(j = i-1; j > 0; j--)
     753    {
     754      b = L[j];
     755//      "b: ", b;
     756
     757      if( leadcomp(b) == c )
     758      {
     759        bb = leadmonomial(b);
     760        @lcm = lcm(aa, bb);
     761
     762        M[j] = (@lcm / aa)* gen(i) - (@lcm / bb)* gen(j);
     763      }
     764    }
     765   
     766    M = simplify(M, 2);
     767
     768    // TODO: add quotient relations here...
     769    S = S, M;
     770  }
     771
     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; 
     778
     779  S = sort(S, "ds", 1)[1]; // ,1 => reversed!
     780
     781  if( @DEBUG )
     782  {
     783    "SSCompute2LeadingSyzygyTerms::Syz(LEAD): "; S;
     784
     785    if( size(S) > 0 and size(L) > 0 )
     786    {
     787      if( size(module(transpose( transpose(S) * transpose(L) ))) > 0 )
     788      {
     789        transpose( transpose(S) * transpose(L) );
     790        "ERROR: transpose( transpose(S) * transpose(L) ) != 0!!!";
     791        $
     792      }
     793    }
     794  }
     795
     796  module S2 = Tail(S);
     797  S = lead(S); // (C,lp) on base ring!
     798             
     799  if( @DEBUG )
     800  {
     801    "SSCompute2LeadingSyzygyTerms::Output: "; S; S2;
     802  } 
     803 
     804  attrib(S, "isSB", 1);
     805
     806  return (S, S2);
     807}
     808
     809// -------------------------------------------------------- //
     810
     811/// TODO: save shortcut LM(m) * "t" -> ?
     812proc SSReduce(poly m, def t, def L, def T, def LS)
    706813{
    707814  int @DEBUG = !system("with", "ndebug");
     
    716823    "T: ", T;
    717824    "LS: ", LS;
     825//    "attrib(LS, 'isSB')", attrib(LS, "isSB");
    718826  }
    719827 
     
    731839
    732840 
    733   def a, b, nf;
     841  def a, b, nf, bb;
    734842
    735843  // looking for an appropriate reducer
     
    741849    {
    742850      b = - (leadmonomial(product) / leadmonomial(L[k]));
     851     
    743852      // which divides the product
    744853      if( b != 0 )
    745854      {
    746855//        "b: ", b;
    747         nf = NF(b * gen(k), LS);
     856        bb = b * gen(k);
     857        nf = NF(bb, LS);
    748858
    749859//        "NF: ", nf;
     
    751861        if( nf != 0 )
    752862        {
    753           s = b * gen(k) + SSTraverse(b, k, L, T, LS);
     863          s = bb + SSTraverse(b, k, L, T, LS);
    754864          break;
    755865        }
     
    764874}
    765875
    766 proc SSTraverse(poly m, int i, def L, def T, module LS)
     876/// TODO: save shortcut LM(m) * T[i] -> ?
     877proc SSTraverse(poly m, int i, def L, def T, def LS)
    767878{
    768879  int @DEBUG = !system("with", "ndebug");
     
    779890
    780891    "LSyz: ", LS;
     892//    "attrib(LS, 'isSB')", attrib(LS, "isSB");
    781893  }
    782894
     
    802914}
    803915
    804 // module (N, LL, TT) = SSComputeSyzygy(L, T, @RANK); // shift syz.comp by @RANK!
    805 proc SSComputeSyzygy(def M, def L, def T, int iCompShift)
     916// -------------------------------------------------------- //
     917
     918// module (N, LL, TT) = SSComputeSyzygy(L, T);
     919// Compute Syz(L ++ T) = N = LL ++ TT
     920proc SSComputeSyzygy(/*def M, */ def L, def T)
    806921{
    807922  int @DEBUG = !system("with", "ndebug");
     
    813928//    DetailedPrint(basering);
    814929
    815     "iCompShift: ", iCompShift;
    816 
    817     "M: "; M;
     930//    "iCompShift: ", iCompShift;
     931
     932//    "M: "; M;
    818933    "L: "; L;
    819934    "T: "; T;
    820935  }
    821936
    822   def a; bigint c; int r, k; poly aa;
    823  
    824   module LL = SSComputeLeadingSyzygyTerms(L, 0); // iCompShift // 0?
     937  def a, a2; bigint c; int r, r2, k; poly aa, aa2;
     938
     939  /// Get the critical leading syzygy terms
     940  // module LL = SSComputeLeadingSyzygyTerms(L);
     941
     942  module LL, LL2; (LL, LL2) = SSCompute2LeadingSyzygyTerms(L);
    825943
    826944  module TT, SYZ;
     
    828946  if( size(LL) > 0 )
    829947  { 
    830     intvec iv_ds = sort(LL, "ds", 1)[2]; // ,1 => reversed!
    831     LL = LL[iv_ds];
    832 
    833948    vector @tail;
    834949
    835950    for(k = ncols(LL); k > 0; k-- )
    836951    {
    837       a = LL[k];
    838       c = leadcomp(a); r = int(c);
    839 
    840       if (r > 0)
    841       {
    842         aa = a[r];
    843       } else
    844       {
    845         aa = a;
    846       }
     952      // leading syz. term:
     953      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);
     957     
     958     
    847959  //    "A: ", a, " --->>>> ", aa, " **** [", r, "]: ";
    848       @tail = SSReduce(aa, L[r], L, T, LL) + SSTraverse(aa, r, L, T, LL);
     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             ;
    849965      TT[k] = @tail;
    850966      SYZ[k] = a + @tail;
     
    852968  }
    853969
    854   module Z;
    855   Z = 0; Z[iCompShift] = 0; Z = Z, transpose(LL);   LL = transpose(Z);
    856   Z = 0; Z[iCompShift] = 0; Z = Z, transpose(TT);   TT = transpose(Z);
    857   Z = 0; Z[iCompShift] = 0; Z = Z, transpose(SYZ); SYZ = transpose(Z);
    858 
    859  
    860970/* 
    861971  def opts = option(get); option(redSB); option(redTail);
     
    9491059     
    9501060  // TODO: N  = SYZ( M )!!!
    951   module N, LL, TT; (N, LL, TT) = SSComputeSyzygy(M, L, T, @RANK); // shift syz.comp by @RANK!
     1061  module N, LL, TT;
     1062  (N, LL, TT) = SSComputeSyzygy(/*M, */L, T/*, @RANK*/);
     1063
     1064  // shift syz.comp by @RANK:
     1065  module Z;
     1066  Z = 0; Z[@RANK] = 0; Z = Z, transpose(LL);   LL = transpose(Z);
     1067  Z = 0; Z[@RANK] = 0; Z = Z, transpose(TT);   TT = transpose(Z);
     1068  Z = 0; Z[@RANK] = 0; Z = Z, transpose(N);     N = transpose(Z);
     1069
     1070
     1071  if( size(N) > 0 )
     1072  {
     1073    if( @DEBUG )
     1074    {
     1075      // next syz. property
     1076      if( size(module(transpose( transpose(N) * transpose(MRES) ))) > 0 )
     1077      {
     1078        "MRES", MRES;
     1079
     1080        "N: "; N; // DetailedPrint(N, 2);
     1081
     1082        "LL:"; LL; // DetailedPrint(LL, 1);
     1083        "TT:"; TT; // DetailedPrint(TT, 10);
     1084
     1085        "RANKS: ", @RANK;
     1086
     1087        "transpose( transpose(N) * transpose(MRES) ) != 0!!!";
     1088        transpose( transpose(N) * transpose(MRES) );
     1089
     1090        "transpose(N) * transpose(MRES): ";
     1091        transpose(N) * transpose(MRES);
     1092        // DetailedPrint(module(_), 2);
     1093        $
     1094      }
     1095    }
     1096  }
    9521097
    9531098  attrib(N, "isHomog", @V);
     
    9551100  // TODO: correct the following:
    9561101  intvec @DEGS = deg(N[1..ncols(N)]); // no mod. comp. weights :(
    957   attrib(N, "degrees", @DEGS); 
    958  
    959   if( size(N) > 0 )
    960   {
    961     N;
    962     MRES;
    963     // next syz. property
    964     if( size(module(transpose( transpose(N) * transpose(MRES) ))) > 0 )
    965     {
    966       MRES;
    967 
    968       "N: "; N; // DetailedPrint(N, 2);
    969 
    970       "LL:"; LL; // DetailedPrint(LL, 1);
    971       "TT:"; TT; // DetailedPrint(TT, 10);
    972 
    973       "RANKS: ", @RANK;
    974 
    975       "transpose( transpose(N) * transpose(MRES) ) != 0!!!";
    976       transpose( transpose(N) * transpose(MRES) );
    977 
    978       "transpose(N) * transpose(MRES): ";
    979       transpose(N) * transpose(MRES);
    980       // DetailedPrint(module(_), 2);
    981       $
    982     }
    983   }
     1102
     1103 
     1104  attrib(N, "degrees", @DEGS);
    9841105 
    9851106   RES[@l + 1] = N; // list of all syzygy modules
     
    9881109
    9891110  MRES = MRES, N;
     1111 
    9901112  attrib(MRES, "isHomog", @V);
    9911113
     
    9951117  {
    9961118    "SSstep::NextSyzOutput: ";
     1119    N;
    9971120//    DetailedPrint(N);
    9981121    attrib(N);
     
    10691192  module M = maxideal(1); M;
    10701193  def S = SSres(M, 0); setring S; S;
    1071   "Only the first syzygy: ";
    1072   RES; LRES; TRES;
    10731194  MRES;
     1195  RES;
     1196  "";
     1197  LRES;
     1198  "";
     1199  TRES;
    10741200
    10751201  kill S; setring r; kill M;
     
    10811207 
    10821208  def S = SSres(M, 0); setring S; S;
    1083   "Only the first syzygy: ";
    1084   RES; LRES; TRES;
    10851209  MRES;
     1210  RES;
     1211  "";
     1212  LRES;
     1213  "";
     1214  TRES;
    10861215}
    10871216
Note: See TracChangeset for help on using the changeset viewer.