Changeset 29984b in git


Ignore:
Timestamp:
Nov 13, 2008, 11:50:17 AM (15 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
8d7d31344f54dfddec02ace97e4ac1e437701713
Parents:
5bc1975ec489442590dc59f82d1fd24d952eb3c8
Message:
*hannes: interred/redSB


git-svn-id: file:///usr/local/Singular/svn/trunk@11198 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular/LIB
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/elim.lib

    r5bc197 r29984b  
    1 // $Id: elim.lib,v 1.24 2008-10-31 15:33:07 Singular Exp $
    2 ///////////////////////////////////////////////////////////////////////////////
    3 version="$Id: elim.lib,v 1.24 2008-10-31 15:33:07 Singular Exp $";
     1// $Id: elim.lib,v 1.25 2008-11-13 10:50:17 Singular Exp $
     2///////////////////////////////////////////////////////////////////////////////
     3version="$Id: elim.lib,v 1.25 2008-11-13 10:50:17 Singular Exp $";
    44category="Commutative Algebra";
    55info="
     
    88PROCEDURES:
    99 blowup0(j[,s1,s2]);   create presentation of blownup ring of ideal j
     10 elimRing(p);          create ring with block ordering for elimating vars in p
    1011 elim(id,..);          variables .. eliminated from id (ideal/module)
    1112 elim1(id,p);          p=product of vars to be eliminated from id
     13 elim2(id,..);         variables .. eliminated from id (ideal/module)
    1214 nselect(id,v);        select generators not containing variables given by v
    1315 sat(id,j);            saturated quotient of ideal/module id by ideal j
     
    183185 }
    184186///////////////////////////////////////////////////////////////////////////////
    185 
    186 
    187 ///////////////////////////////////////////////////////////////////////////////
    188 
    189 proc elim (id, intvec va)
    190 "USAGE:   elim(id,v);  id ideal/module, v intvec
     187proc elimRing ( poly vars, list #)
     188"USAGE:   elimRing(vars [,w]); vars = product of variables to be eliminated
     189         (type poly), w = intvec (specifying weights for all variables)
     190RETURN:  a ring, say R, s.t. the monomial ordering of R has 2 blocks.
     191         The first block corresponds to the (given) variables to be eliminated
     192         and has ordering dp if these variables have weight all 1; if w is
     193         given or if not all variables in vars have weight 1 the ordering is
     194         wp(w1) where w1 is the intvec of weights of the variables to be
     195         eliminated.
     196         The second block corresponds to variables not to be eliminated.
     197@*       If the first variable not to be eliminated is global (i.e. > 1),
     198         resp. local (i.e. < 1), the second block has ordering dp, resp. ds,
     199         (or wp(w2), resp. ws(w2), where w2 is the intvec of weights of the
     200         variables not to be eliminated).
     201@*       If the basering is a quotient ring P/Q, then R a quotient ring
     202         with Q replaced by a standard basis of Q w.r.t. the new ordering
     203         (parameters are not touched).
     204NOTE:    The ordering in R is an elimination ordering for the variables
     205         appearing in vars.
     206PURPOSE: Prepare a ring for eliminating vars from an ideal/moduel by
     207         computing a standard basis in R with a fast monomial ordering.
     208         This procedure is used by the procedure elim.
     209EXAMPLE: example elimRing; shows an example
     210"
     211{
     212  def BR = basering;
     213  int nvarBR = nvars(BR);
     214  list BRlist = ringlist(BR);
     215  intvec @w;                   //to store weights of all variables
     216  @w[nvarBR] = 0;
     217  @w = @w + 1;                 //initialize @w as 1..1
     218  if (size(#) == 1)
     219  {
     220    if ( typeof(#[1]) == "intvec" )
     221    { 
     222       @w = #[1];              //take the given weights
     223    }
     224  }
     225  else
     226  {
     227     @w = ringweights(BR);     //compute the ring weights (proc from ring.lib)
     228  }
     229
     230  //--- get variables to be eliminated and ringweights:
     231  intvec w1,w2;  //for ringweights of first (w1) and second (w2) block
     232  list v1,v2;    //for variables of first (to be liminated) and second block
     233
     234  int ii;
     235  for( ii=1; ii<=nvarBR; ii++ )
     236  {
     237     if( vars/var(ii)==0 )    //treat variables not to be eliminated
     238     {
     239        w2 = w2,@w[ii];
     240        v2 = v2+list(string(var(ii)));
     241        if ( defined(local) == 0 )
     242        {
     243           int local = (var(ii) < 1);
     244         }
     245     }
     246     else
     247     {
     248        w1 = w1,@w[ii];
     249        v1 = v1+list(string(var(ii)));
     250     }
     251  }
     252
     253  int l1, l2 = size(w1), size(w2);
     254  if ( l1 <= 1 )
     255  {
     256    ERROR("no elimination ?");
     257    //return(BR);
     258  }
     259  if ( l2 <= 1 )
     260  {
     261    ERROR("## elimination of all variables is not possible");
     262  }
     263
     264  w1 = w1[2..size(w1)];
     265  w2 = w2[2..size(w2)];
     266
     267  //--- put variables to be eliminated in front:
     268  BRlist[2] = v1 + v2; 
     269             
     270  //--- create a block ordering with two blocks and weights:
     271  int nblock = size(BRlist[3]);      //number of blocks
     272  list BR3 =  BRlist[3];             //save ordering
     273  BRlist[3] = list();
     274  list B3;
     275
     276  if( w1==1 )
     277  {
     278     B3[1] = list("dp", w1);
     279  }
     280  else
     281  {
     282     B3[1] = list("wp", w1);
     283  }
     284
     285  if( w2==1 )
     286  {
     287     if ( local==1 )
     288     {
     289        B3[2] = list("ds", w2);
     290     }
     291     else
     292     {
     293        B3[2] = list("dp", w2);
     294     }
     295  }
     296  else
     297  {
     298     if ( local==1 )
     299     {
     300        B3[2] = list("ws", w2);
     301     }
     302     else
     303     {
     304        B3[2] = list("wp", w2);
     305     }
     306  }
     307
     308  BRlist[3] = B3;
     309
     310  //Module ordering stays in front resp. at the end:
     311  if( BR3[nblock][1] =="c" || BR3[nblock][1] =="C" )
     312  {
     313    BRlist[3] = insert(BRlist[3],BR3[nblock],size(B3));
     314  }
     315  else
     316  {
     317    BRlist[3] = insert(BRlist[3],BR3[1]);
     318  }
     319
     320  def eRing = ring(quotientList(BRlist));
     321  return (eRing);
     322}
     323example
     324{ "EXAMPLE:"; echo = 2;
     325   ring R = 0,(x,y,z,u,v),(c,lp);
     326   def P = elimRing(yu);  P;
     327   intvec w = 1,1,3,4,5;
     328   elimRing(yu,w);
     329 
     330   ring S =  (0,a),(x,y,z,u,v),ws(1,2,3,4,5);
     331   minpoly = a2+1;
     332   qring T = std(ideal(x+y2+v3,(x+v)^2));
     333   def Q = elimRing(yv); 
     334   setring Q; Q;
     335}
     336///////////////////////////////////////////////////////////////////////////////
     337
     338proc elim (id, list #)
     339"USAGE:   elim(id,arg[,\"withWeights\"]);  id ideal/module, arg can be either
     340        an intvec vor a product p of variables (type poly)
     341RETURN: ideal/module obtained from id by eliminating either the variables
     342        with indices appearing in v or the variables appearing in p.
     343        Works also in a qring.
     344METHOD: elim uses elimRing to create a ring with block ordering with two
     345        blocks where the first block contains the variables to be eliminated
     346        and then uses groebner. If the variables in the basering have weights
     347        these weights are used in elimRing.
     348@*      If a string \"withWeigts\" as second, optional argument is given,
     349        Singular computes weights for the variables to make the input as
     350        homogeneous as possible.
     351@*      The method is different from that used by eliminate and elim1;
     352        in some examples elim can be significantly faster.
     353NOTE:   No special monomial ordering is required, i.e. the ordering can be
     354        local or mixed. The result is a SB with respect to the ordering of
     355        the second block used by elimRing. E.g. if the first var not to be
     356        eliminated is global, resp. local, this ordering is dp, resp. ds
     357        (or wp, resp. ws, with the given weights for these variables).
     358        If printlevel > 0 the ring for which the output is a SB is shown.
     359SEE ALSO: eliminate, elim1
     360EXAMPLE: example elim; shows an example
     361"
     362
     363  if (size(#) == 0)
     364  {
     365    ERROR("## specify variables to be eliminated");
     366  }
     367  int pr = printlevel - voice + 2;   //for ring display if printlevel > 0
     368  def BR = basering;
     369//-------------------------------- check input -------------------------------
     370  poly vars;
     371  int ii;
     372  if (size(#) > 0)
     373  {
     374    if ( typeof(#[1]) == "poly" )
     375    { 
     376      vars = #[1];
     377    }
     378    if ( typeof(#[1]) == "intvec")
     379    { 
     380      vars=1;
     381      for( ii=1; ii<=size(#[1]); ii++ )
     382      { 
     383        vars=vars*var(#[1][ii]);
     384      }
     385    }
     386  }
     387  if (size(#) == 2)
     388  {
     389    if ( typeof(#[2]) == "string" )
     390    { 
     391       if ( #[2] == "withWeights" )
     392       {
     393         intvec @w = weight(id);
     394       }
     395    }
     396  }
     397
     398//-------------- create new ring and map objects to new ring ------------------
     399  if ( defined(@w) )
     400  {
     401     def ER = elimRing(vars,@w);
     402  }
     403  else
     404  {
     405     def ER = elimRing(vars);
     406  }
     407  setring ER;
     408  def id = imap(BR,id);
     409  poly vars = imap(BR,vars);
     410//---------- now eliminate in new ring and map back to old ring ---------------
     411  id = groebner(id);
     412  id = nselect(id,1..size(ringlist(ER)[3][1][2]));
     413  if ( pr > 0 )
     414  {
     415     "// result is a SB in the following ring:";
     416     ER;
     417  }
     418  setring BR;
     419  return(imap(ER,id));
     420}
     421example
     422{ "EXAMPLE:"; echo = 2;
     423   ring r=0,(x,y,u,v,w),dp;
     424   ideal i=x-u,y-u2,w-u3,v-x+y3;
     425   elim(i,3..4);
     426   elim(i,uv);
     427   int p = printlevel;
     428   printlevel = 2;
     429   elim(i,uv,"withWeights");
     430   printlevel = p;
     431
     432   ring S =  (0,a),(x,y,z,u,v),ws(1,2,3,4,5);
     433   minpoly = a2+1;
     434   qring T = std(ideal(ax+y2+v3,(x+v)^2));
     435   ideal i=x-u,y-u2,az-u3,v-x+ay3;
     436   module m=i*gen(1)+i*gen(2);
     437   m=elim(m,xy);
     438   show(m);
     439}
     440///////////////////////////////////////////////////////////////////////////////
     441
     442proc elim2 (id, intvec va)
     443"USAGE:   elim2(id,v);  id ideal/module, v intvec
    191444RETURNS: ideal/module obtained from id by eliminating variables in v
    192445NOTE:    no special monomial ordering is required, result is a SB with
     
    194447         eliminated belongs to a -p (resp. -s) blockordering
    195448         This proc uses 'execute' or calls a procedure using 'execute'.
    196 SEE ALSO: elim1, eliminate
    197 EXAMPLE: example elim; shows examples
     449SEE ALSO: elim1, eliminate, elim
     450EXAMPLE: example elim2; shows examples
    198451"
    199452{
     
    220473   ring r=0,(x,y,u,v,w),dp;
    221474   ideal i=x-u,y-u2,w-u3,v-x+y3;
    222    elim(i,3..4);
     475   elim2(i,3..4);
    223476   module m=i*gen(1)+i*gen(2);
    224    m=elim(m,3..4);show(m);
     477   m=elim2(m,3..4);show(m);
    225478}
    226479///////////////////////////////////////////////////////////////////////////////
  • Singular/LIB/finvar.lib

    r5bc197 r29984b  
    11///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: finvar.lib,v 1.78 2008-10-31 15:32:45 Singular Exp $"
     2version="$Id: finvar.lib,v 1.79 2008-11-13 10:50:17 Singular Exp $"
    33category="Invariant theory";
    44info="
     
    71067106    }
    71077107  }
    7108   M=elim(module(M),1..n);   // eliminating x(1..n), std-calculation
     7108  M=elim2(module(M),1..n);   // eliminating x(1..n), std-calculation
    71097109                            // is done internally -
    71107110  //M=std(module(M));                // we have already an elimination ordering
Note: See TracChangeset for help on using the changeset viewer.