Changeset 237a06 in git for Singular


Ignore:
Timestamp:
May 6, 2015, 10:00:06 PM (9 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
52b3cf72ab7fa42d230232612144a2dd8a99aff0a817084b5284694230319ae82cddc45954052311
Parents:
b474f1f0a8fd7631ec5bebf5b5158c575cb79c09
Message:
Starting preparations for ZERO objects (e.g. matrices with 0-columns)

NOPE: convertion into module is wrong!!! :(
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/gradedModules.lib

    rb474f1 r237a06  
    8282  int n = size(v);
    8383
    84   if (n == 0) { return (R); }
     84  if (n == 0) { return ("0"); }
    8585
    8686  ASSUME(0, n > 0 );
     
    180180  if( typeof( N ) == "list" )
    181181  {
    182     msg = msg + " resolution";
     182    msg = msg + " resolution";  // TODO: what about chain maps?
    183183    if( size(R) >= 2 )
    184184    {
     
    212212//  typeof( N ) ;  attrib( N );  grrange(N);
    213213
    214   ASSUME(1, grtest(N) );
    215 
    216   intvec G = grdeg(N);
    217   matrix M = module(N);
    218 
    219   int nc = ncols(M); int nr = nrows(M);
    220   int r,c;
    221   int d = 1; // number of extra cols/rows for extra info around the central degree(N) block in D
    222   intmat D[nr+2*d][nc+2*d];
    223 
    224   for( c = nc; c > 0; c-- )
    225   {
    226     D[1, c+d] = c; // top row indeces
    227     D[nr+2*d, c+d] = G[c]; // deg(v) + gr[ leadexp(v)[m] ]; // bottom row with computed column induced degrees
    228   }
    229 
    230   intvec gr = grrange(N); // grading weights?
    231 
    232   for( r = nr; r > 0; r-- )
    233   {
    234     D[r+d, 1] = gr[r]; // left-most column with grading data
    235     for( c = nc; c > 0; c-- )
    236     {
    237       D[r+d, c+d] = deg(M[r, c]); // central block with degrees (-1 means zero entry)
    238     }
    239     D[r+d, nc+2*d] = r; // right-most block with indeces
    240   }
    241 
     214  ASSUME(1, grtest(N) );
     215 
    242216  msg = msg + " homomorphism";
    243217  if( size(R) >= 2 )
     
    246220    R = "R";
    247221  }
    248    
     222
    249223  msg = msg + ": ";
    250224
     225  intvec gr = grrange(N); // grading weights?
    251226  string dst = grsumstr(R, gr);
     227 
     228  intvec G = grdeg(N);
    252229  string src = grsumstr(R, G);
     230 
     231  if( ncols(N) == 0 )
     232  {
     233    src = "0";
     234  }
    253235
    254236  lst = msg;
     
    274256  msg = msg + ", given by ";
    275257//  lst = lst + ", given by ";
     258
     259 
     260  int nc = ncols(N); int nr = nrows(N);
    276261
    277262  if( size(N) == 0 )
     
    282267  } else
    283268  {
     269    ASSUME(0, nc > 0);
     270   
     271    matrix M = module(N);
     272   
     273    int r,c;
     274    int d = 1; // number of extra cols/rows for extra info around the central degree(N) block in D
     275    intmat D[nr+2*d][nc+2*d];
     276
     277    for( c = nc; c > 0; c-- )
     278    {
     279      D[1, c+d] = c; // top row indeces
     280      D[nr+2*d, c+d] = G[c]; // deg(v) + gr[ leadexp(v)[m] ]; // bottom row with computed column induced degrees
     281    }
     282
     283    for( r = nr; r > 0; r-- )
     284    {
     285      D[r+d, 1] = gr[r]; // left-most column with grading data
     286      for( c = nc; c > 0; c-- )
     287      {
     288        D[r+d, c+d] = deg(M[r, c]); // central block with degrees (-1 means zero entry)
     289      }
     290      D[r+d, nc+2*d] = r; // right-most block with indeces
     291    }
     292
    284293    if( nr == nc) // square matrix // detect diagonal?
    285294    {
     
    301310      msg = msg + "a matrix";
    302311    }
    303    
    304     print(msg + ", with degrees: " );
     312
     313    print(msg + ", with degrees: " );   
    305314    draw(D, d); // print it nicely!   
    306315  }
     
    408417"
    409418{
    410   ASSUME(1, grtest(M) );
    411 
     419  ASSUME(1, grtest(M) ); 
     420 
    412421  if ( typeof(attrib(M, "degHomog")) == "intvec" )
    413422  {
    414     intvec t = attrib(M, "degHomog"); // graded degrees
     423    def t = attrib(M, "degHomog"); // graded degrees
     424
     425    if( ncols(M) == 0 )    {     return (t);    } // for now
     426   
    415427    ASSUME(0, ncols(M) == size(t) );
    416 
    417428    return (t);
    418429  }
     430 
     431  ASSUME(0, ncols(M) > 0);
    419432
    420433  ASSUME(0, ncols(M) == size(M) );
     
    956969"
    957970{
     971  if( ncols(A) == 0 )
     972  {
     973    ASSUME(0, size(w) == nrows(A) );
     974    attrib(A, "isHomog", w);
     975    attrib(A, "degHomog", intvec(0)); // FIXME: just for now: no intvec of 0-size :(
     976    ASSUME(0, grtest(A) );
     977    return (A);
     978  }
     979 
    958980  module M = module(A);
    959981  ASSUME(0, size(w) >= nrows(M) );
     
    9821004  ring r=32003,(x,y,z),dp;
    9831005
    984   module A = grobj( module([x+y, x, 0, 0], [0, x+y, y, 0]), intvec(0,0,0,1) );
     1006  def A = grobj( module([x+y, x, 0, 0], [0, x+y, y, 0]), intvec(0,0,0,1) );
    9851007  grview(A);
    9861008
    987   module F = grobj( module([x,y,0]), intvec(1,1,5) );
     1009  def F = grobj( module([x,y,0]), intvec(1,1,5) );
    9881010  grview(F);
    9891011
    9901012  int d = 666; // zero can have any degree...
    991   module Z = grobj( module([x,0], [0,0,0], [0, y]), intvec(1,2,3), intvec(2, d, 3) );
     1013  def Z = grobj( module([x,0], [0,0,0], [0, y]), intvec(1,2,3), intvec(2, d, 3) );
    9921014  grview(Z);
    9931015
     
    9961018  grrange(Z); // module weights
    9971019  attrib(Z, "degHomog"); // total degrees
     1020
     1021  // Zero object:
     1022  matrix z[3][0];
     1023  def zz = grobj( z, intvec(1,2,3) ); // intvec() ??
     1024  grview(zz); 
    9981025
    9991026}
     
    10171044  };
    10181045
    1019   if ( typeof(grrange(N)) != "intvec" )
     1046  if ( typeof(attrib(N,"isHomog")) != "intvec" )
    10201047  {
    10211048    if(b) { type(N); attrib(N); "   ? grtest: Input must be graded!";  };
     
    10301057  };
    10311058
     1059  if( ncols(N) == 0 ) // zero-column matrix?
     1060  {
     1061    return(1);
     1062  }
     1063 
    10321064//  if( attrib(N, "rank") != size(gr) ){ return (0); } // wrong rank :(
    10331065
     
    11021134"
    11031135{
     1136  ASSUME(0, d >= 0 );
     1137 
     1138  if( d == 0 ) { return (A); }
     1139 
     1140  if( ncols(A) == 0 )
     1141  {
     1142    matrix B[nrows(A) + d][0];
     1143    return (B);   
     1144  }
     1145
     1146 
    11041147  module T; T[d] = 0;
    11051148  T = T, module(transpose(A));
    11061149  return( module(transpose(T)) );
    11071150}
     1151example
     1152{ "EXAMPLE:"; echo = 2;
     1153  ring r;
     1154  matrix m[1][0];
     1155  align(m, 3);
     1156
     1157
    11081158
    11091159proc grgroebner(A)
Note: See TracChangeset for help on using the changeset viewer.