Changeset 4b2e47 in git for Singular/LIB/schreyer.lib


Ignore:
Timestamp:
May 7, 2012, 7:00:38 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
f3746721cf443ba4cbafcb32045986a9aa9ca197
Parents:
8f57c0f58364149bf1fbc74361c05edbe29a0b09
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-05-07 19:00:38+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-05-10 18:23:39+02:00
Message:
first iteration: mostly prototype in Singular Script... without
preliminary computation of 2nd syz. terms and any optimizations!

add: Mi (critical leading syzygy terms)
add: basic "Reduce"!
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/schreyer.lib

    r8f57c0 r4b2e47  
    457457}
    458458
    459 /* static */ proc SSinit(module M)
     459/* static */ proc SSinit(def M)
    460460{
    461461  if( (typeof(M) != "module") && (typeof(M) != "ideal") )
     
    472472    "SSinit::Input";
    473473    type(M);
    474     DetailedPrint(M);
     474//    DetailedPrint(M);
    475475    attrib(M);
    476476  }
     
    556556    attrib(M);
    557557    attrib(M, "isHomog");
    558     DetailedPrint(M);
     558//    DetailedPrint(M);
    559559  }
    560560
     
    580580  {
    581581    "SSinit::MRES";
    582     DetailedPrint(MRES);
     582    MRES;
     583//    DetailedPrint(MRES);
    583584    attrib(MRES, "isHomog");
    584585    attrib(S);
     
    627628    L;
    628629    "iCompShift: ", iCompShift;
    629 
    630630  }
    631631
     
    644644  {
    645645    a = L[i];
    646     "a: ", a;
     646//    "a: ", a;
    647647    c = leadcomp(a);
    648648    r = int(c);
    649     aa = a[r];
     649
     650    if(r > 0)
     651    {
     652      aa = a[r];
     653    } else
     654    {
     655      aa = a;
     656    }
    650657
    651658    M = 0;
     
    654661    {
    655662      b = L[j];
    656       "b: ", b;
     663//      "b: ", b;
    657664
    658665      if( leadcomp(b) == c )
    659666      {
    660         bb = b[r];
     667        if(r > 0)
     668        {
     669          bb = b[r];
     670        } else
     671        {
     672          bb = b;
     673        }
    661674
    662675        M[j] = (lcm(aa, bb) / aa);
    663676      }
    664677    }
     678   
     679    // TODO: add quotient relations here...
    665680
    666681    M = simplify(M, 1 + 2 + 32);
     
    682697  }
    683698
     699  attrib(S, "isSB", 1);
     700
    684701  return (S);
    685702
    686703}
    687704
    688 proc Traverse(mult, index, Leads, Tails, LSyz)
    689 {
    690 
    691 
    692 }
    693 
    694 
     705proc SSReduce(poly m, def t, def L, def T, module LS)
     706{
     707  int @DEBUG = !system("with", "ndebug");
     708
     709  if( @DEBUG )
     710  {
     711    "SSReduce::Input: ";
     712
     713    "mult: ", m;
     714    "term: ", t;
     715    "L: ", L;
     716    "T: ", T;
     717    "LS: ", LS;
     718  }
     719 
     720  vector s = 0;
     721
     722  if( t == 0 )
     723  {
     724    return (s);
     725  }
     726
     727  def product = m * t;
     728
     729  bigint c = leadcomp(t);
     730  int r = int(c);
     731
     732 
     733  def a, b, nf;
     734
     735  // looking for an appropriate reducer
     736  for( int k = ncols(L); k > 0; k-- )
     737  {
     738    a = L[k];
     739    // with the same mod. component
     740    if( leadcomp(a) == c )
     741    {
     742      b = - (leadmonomial(product) / leadmonomial(L[k]));
     743      // which divides the product
     744      if( b != 0 )
     745      {
     746//        "b: ", b;
     747        nf = NF(b * gen(k), LS);
     748
     749//        "NF: ", nf;
     750        // while the complement (the fraction) is not reducible by leading syzygies
     751        if( nf != 0 )
     752        {
     753          s = b * gen(k) + SSTraverse(b, k, L, T, LS);
     754          break;
     755        }
     756      }
     757    }
     758  } 
     759  if( @DEBUG )
     760  {
     761    "SSReduce::Output: ", s;
     762  }
     763  return (s);
     764}
     765
     766proc SSTraverse(poly m, int i, def L, def T, module LS)
     767{
     768  int @DEBUG = !system("with", "ndebug");
     769
     770  if( @DEBUG )
     771  {
     772    "SSTraverse::Input: ";
     773
     774    "index: ", i;
     775    "mult: ", m;
     776
     777    "lead: ", L[i];
     778    "tail: ", T[i];
     779
     780    "LSyz: ", LS;
     781  }
     782
     783  //  reduce the product m * ( L[i] + T[i] ):
     784//  SSReduce(m, L[i], L, T, LS);
     785
     786  def @tail = T[i]; def @l;
     787
     788  vector s = 0;
     789
     790  while( size(@tail) > 0 )
     791  {
     792    @l = lead(@tail);
     793    s = s + SSReduce(m, @l, L, T, LS);
     794    @tail = @tail - @l;
     795  }
     796
     797  if( @DEBUG )
     798  {
     799    "SSTraverse::Output: ", s;
     800  }
     801  return (s);
     802}
    695803
    696804// module (N, LL, TT) = SSComputeSyzygy(L, T, @RANK); // shift syz.comp by @RANK!
     
    712820  }
    713821
    714 
    715   // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //
    716   // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //
    717   // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //
    718   // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //
    719   // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //
    720   // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //
    721   // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //
    722 
    723822  def a; bigint c; int r, k; poly aa;
    724823 
    725   def LS = SSComputeLeadingSyzygyTerms(L, 0); // iCompShift // 0?
    726   for(k = ncols(LS); k >= 0; k-- )
    727   {
    728     a = LS[k];
    729     "A: ", a;
    730     c = leadcomp(a);
    731     r = int(c);
    732     aa = a[r];
    733 
    734     Traverse(aa, r, L, T, LS);
    735   }
    736 
    737 
     824  module LL = SSComputeLeadingSyzygyTerms(L, 0); // iCompShift // 0?
     825
     826  module TT, SYZ;
     827
     828  if( size(LL) > 0 )
     829  { 
     830    intvec iv_ds = sort(LL, "ds", 1)[2]; // ,1 => reversed!
     831    LL = LL[iv_ds];
     832
     833    vector @tail;
     834
     835    for(k = ncols(LL); k > 0; k-- )
     836    {
     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      }
     847  //    "A: ", a, " --->>>> ", aa, " **** [", r, "]: ";
     848      @tail = SSReduce(aa, L[r], L, T, LL) + SSTraverse(aa, r, L, T, LL);
     849      TT[k] = @tail;
     850      SYZ[k] = a + @tail;
     851    }
     852  }
     853
     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 
     860/* 
    738861  def opts = option(get); option(redSB); option(redTail);
    739862  module SYZ = std(syz(M)); // TODO: !!!!!!!!!!!
     
    742865  "SYZ: ";  SYZ;  print(SYZ);
    743866
    744   module Z; Z[iCompShift] = 0; Z = Z, transpose(SYZ); SYZ = transpose(Z);
    745 
    746867  "shifted SYZ: ";  SYZ;  print(SYZ);
    747868 
     
    750871  LL = lead(SYZ); // TODO: WRONG ORDERING!!!!!!!!
    751872  TT = Tail(SYZ);
    752 
    753 
    754   // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //
    755   // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //
    756   // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //
    757   // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //
    758   // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //
    759   // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //
    760   // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //
    761  
    762   intvec iv_ds = sort(LL, "ds", 1)[2]; // ,1 => reversed!
    763   LL = LL[iv_ds];
    764   TT = TT[iv_ds];
     873*/
    765874 
    766875  if( @DEBUG )
     
    786895    "SSstep::NextInducedRing";
    787896    "basering: ", basering; attrib(basering);
    788 //    DetailedPrint(basering);
    789897  }
    790898
     
    835943    @V;
    836944    @RANK;
    837     DetailedPrint(MRES);
     945//    DetailedPrint(MRES);
    838946    attrib(MRES, "isHomog");
    839947  }
     
    887995  {
    888996    "SSstep::NextSyzOutput: ";
    889     DetailedPrint(N);
     997//    DetailedPrint(N);
    890998    attrib(N);
    891999  }
     
    9601068
    9611069  module M = maxideal(1); M;
    962   def S = SSsyz(M); setring S; S;
     1070  def S = SSres(M, 0); setring S; S;
    9631071  "Only the first syzygy: ";
    9641072  RES; LRES; TRES;
     
    9721080  ideal M = w^2 - x*z,  w*x - y*z,  x^2 - w*y, x*y - z^2, y^2 - w*z;
    9731081 
    974   def S = SSsyz(M); setring S; S;
     1082  def S = SSres(M, 0); setring S; S;
    9751083  "Only the first syzygy: ";
    9761084  RES; LRES; TRES;
     
    10701178//      exportto(Schreyer, Syzextra::noop);
    10711179      exportto(Schreyer, Syzextra::DetailedPrint);
    1072 //      exportto(Schreyer, Syzextra::leadmonom);
     1180      exportto(Schreyer, Syzextra::leadmonomial);
    10731181      exportto(Schreyer, Syzextra::leadcomp);
    10741182//      exportto(Schreyer, Syzextra::leadrawexp);
     
    11021210//      exportto(Schreyer, Syzextra_g::noop);
    11031211      exportto(Schreyer, Syzextra_g::DetailedPrint);
    1104 //      exportto(Schreyer, Syzextra_g::leadmonom);
     1212      exportto(Schreyer, Syzextra_g::leadmonomial);
    11051213      exportto(Schreyer, Syzextra_g::leadcomp);
    11061214//      exportto(Schreyer, Syzextra_g::leadrawexp);
Note: See TracChangeset for help on using the changeset viewer.