Changeset a19255 in git


Ignore:
Timestamp:
Jan 15, 2009, 11:57:51 AM (15 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c5facdfddea2addfd91babd8b9019161dea4b695')
Children:
a3bd0b4110d9421ff0cc3528479db22659011909
Parents:
81733986448f9a0d2629201f6509a9ea8f70fb38
Message:
*hannes: GMGs new version


git-svn-id: file:///usr/local/Singular/svn/trunk@11311 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/elim.lib

    r817339 ra19255  
    1 // $Id: elim.lib,v 1.26 2009-01-14 16:07:04 Singular Exp $
    2 ///////////////////////////////////////////////////////////////////////////////
    3 version="$Id: elim.lib,v 1.26 2009-01-14 16:07:04 Singular Exp $";
     1// $Id: elim.lib,v 1.27 2009-01-15 10:57:51 Singular Exp $
     2// (GMG, modified 22.06.96)
     3// GMG, last modified 30.10.08: new procedure elimRing;
     4// elim changes now to ring with elimination ordering (extra weight vector
     5// a(...)), works now in qring, new examples have been added;
     6// syntax of elim, nselect, select and select1 changed: instead of two
     7// integers an intvec can be given. Bug in nselect fixed which occured
     8// in connectin with type conversion from matrix to module.
     9// GMG, last modified 5.01.09: elim uses now stdhilb(id,@w) instead of std(id)
     10// and can now choose as method slimgb or std.
     11///////////////////////////////////////////////////////////////////////////////
     12version="$Id: elim.lib,v 1.27 2009-01-15 10:57:51 Singular Exp $";
    413category="Commutative Algebra";
    514info="
     
    1019 elimRing(p);          create ring with block ordering for elimating vars in p
    1120 elim(id,..);          variables .. eliminated from id (ideal/module)
    12  elim1(id,p);          p=product of vars to be eliminated from id
    13  elim2(id,..);         variables .. eliminated from id (ideal/module)
     21 elim1(id,p);          variables .. eliminated from id (different algorithm)
     22 elim2(id,..);         variables .. eliminated from id (different algorithm)
    1423 nselect(id,v);        select generators not containing variables given by v
    1524 sat(id,j);            saturated quotient of ideal/module id by ideal j
     
    2231LIB "general.lib";
    2332LIB "poly.lib";
    24 
     33LIB "ring.lib";
    2534///////////////////////////////////////////////////////////////////////////////
    2635
     
    108117   //---- change l[3]:
    109118   l[3][s+1] = l[3][s];         // save the module ordering of the basering
    110    intvec w;
    111    w[k]=0; w=w+1;
     119   intvec w=1:k;
    112120   intvec v;                    // containing the weights for the varibale
    113121   if( homog(C) )
     
    184192   //Note that the different affine charts are {y(i)=1}
    185193 }
    186 ///////////////////////////////////////////////////////////////////////////////
     194
     195//////////////////////////////////////////////////////////////////////////////
    187196proc 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)
    190 RETURN:  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
     197"USAGE:   elimRing(vars [,w,str]); vars = product of variables to be eliminated
     198         (type poly), w = intvec (specifying weights for all variables),
     199         str = string either \"a\" or \"b\" (default: w=ringweights, str=\"a\")
     200RETURN:  a list, say L, with R:=L[1] a ring and L[2] an intvec.
     201         The ordering in R is an elimination ordering for the variables
     202         appearing in vars depending on \"a\" resp. \"b\". Let w1 (resp. w2)
     203         be the intvec of weights of the variables to be eliminated (resp. not
     204         to be eliminated).
     205         The monomial ordering of R has always 2 blocks, the first
     206         block corresponds to the (given) variables to be eliminated.
     207@*       If str = \"a\" the first block is a(w1,0..0) and the second block is
     208         wp(w) resp. ws(w) if the first variable not to be eliminated is local.
     209@*       If str = \"b\" the 1st block has ordering wp(w1) and the 2nd block
     210         is wp(w2) resp. ws(w2) if the first variable not to be eliminated is
     211         local.
     212@*       If the basering is a quotient ring P/Q, then R is also a quotient ring
    202213         with Q replaced by a standard basis of Q w.r.t. the new ordering
    203214         (parameters are not touched).
    204 NOTE:    The ordering in R is an elimination ordering for the variables
    205          appearing in vars.
     215@*       The intvec L[2] is the intvec of variable weights (or the given w)
     216         with weights <= 0 replaced by 1.
    206217PURPOSE: Prepare a ring for eliminating vars from an ideal/moduel by
    207218         computing a standard basis in R with a fast monomial ordering.
     
    213224  int nvarBR = nvars(BR);
    214225  list BRlist = ringlist(BR);
    215   intvec @w;                   //to store weights of all variables
     226  //------------------ set resp. compute ring weights ----------------------
     227  int ii;
     228  intvec @w;              //to store weights of all variables
    216229  @w[nvarBR] = 0;
    217   @w = @w + 1;                 //initialize @w as 1..1
     230  @w = @w + 1;            //initialize @w as 1..1
     231  string str = "a";       //default for specifying elimination ordering
     232  if (size(#) == 0)       //default values
     233  {
     234     @w = ringweights(BR);     //compute the ring weights (proc from ring.lib)
     235  }
     236
    218237  if (size(#) == 1)
    219238  {
     
    222241       @w = #[1];              //take the given weights
    223242    }
    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:
     243    if ( typeof(#[1]) == "string" )
     244    {
     245       str = #[1];             //string for specifying elimination ordering
     246    }
     247  }
     248
     249  if (size(#) >= 2)
     250  {
     251    if ( typeof(#[1]) == "intvec" and typeof(#[2]) == "string" )
     252    {
     253       @w = #[1];              //take the given weights
     254       str = #[2];             //string for specifying elimination ordering
     255
     256    }
     257    if ( typeof(#[1]) == "string" and typeof(#[2]) == "intvec" )
     258    {
     259       str = #[1];             //string for specifying elimination ordering
     260       @w = #[2];              //take the given weights
     261    }
     262  }
     263
     264  for ( ii=1; ii<=size(@w); ii++ )
     265  {
     266    if ( @w[ii] <= 0 )
     267    {
     268       @w[ii] = 1;             //replace non-positive weights by 1
     269    }
     270  }
     271
     272  //------ get variables to be eliminated together with their weights -------
    231273  intvec w1,w2;  //for ringweights of first (w1) and second (w2) block
    232274  list v1,v2;    //for variables of first (to be liminated) and second block
    233275
    234   int ii;
    235276  for( ii=1; ii<=nvarBR; ii++ )
    236277  {
     
    251292  }
    252293
    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 )
     294  if ( size(w1) <= 1 )
     295  {
     296    return(BR);
     297  }
     298  if ( size(w2) <= 1 )
    260299  {
    261300    ERROR("## elimination of all variables is not possible");
     
    264303  w1 = w1[2..size(w1)];
    265304  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   }
     305  BRlist[2] = v1 + v2;         //put variables to be eliminated in front
     306
     307  //-------- create elimination ordering with two blocks and weights ---------
     308  //Assume that the first r of the n variables are to be eliminated.
     309  //Then, in case of an a-ordering (default), the new ring ordering will be
     310  //of the form (a(1..1,0..0),dp) with r 1's and n-r 0's or (a(w1,0..0),wp(@w))
     311  //if there are varaible weights which are not 1.
     312  //In the case of a b-ordering the ordering will be a block ordering with two
     313  //blocks of the form (dp(r),dp(n-r))  resp. (wp(w1),dp(w2))
     314
     315  list B3;                     //this will become the list for new ordering
     316
     317  //----- b-ordering case:
     318  if ( str == "b" )
     319  {
     320    if( w1==1 )              //weights for vars to be eliminated are all 1
     321    {
     322       B3[1] = list("dp", w1);
     323    }
     324    else
     325    {
     326       B3[1] = list("wp", w1);
     327    }
     328
     329    if( w2==1 )              //weights for vars not to be eliminated are all 1
     330    {
     331       if ( local==1 )
     332       {
     333          B3[2] = list("ds", w2);
     334       }
     335       else
     336       {
     337          B3[2] = list("dp", w2);
     338       }
     339    }
     340    else
     341    {
     342       if ( local==1 )
     343       {
     344          B3[2] = list("ws", w2);
     345       }
     346       else
     347       {
     348          B3[2] = list("wp", w2);
     349       }
     350    }
     351  }
     352
     353  //----- a-ordering case:
    280354  else
    281355  {
    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 
     356    //define first the second block
     357    if( @w==1 )              //weights for all vars are 1
     358    {
     359       if ( local==1 )
     360       {
     361          B3[2] = list("ls", @w);
     362       }
     363       else
     364       {
     365          B3[2] = list("dp", @w);
     366       }
     367    }
     368    else
     369    {
     370       if ( local==1 )
     371       {
     372          B3[2] = list("ws", @w);
     373       }
     374       else
     375       {
     376          B3[2] = list("wp", @w);
     377       }
     378    }
     379
     380    //define now the first a-block of the form a(w1,0..0)
     381    intvec @v;
     382    @v[nvarBR] = 0;
     383    @v = @v+w1;
     384    B3[1] = list("a", @v);
     385  }
    308386  BRlist[3] = B3;
    309387
    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   }
     388  //----------- put module ordering always at the end and return -------------
     389
     390  BRlist[3] = insert(BRlist[3],list("C",intvec(0)),size(B3));
    319391
    320392  def eRing = ring(quotientList(BRlist));
    321   return (eRing);
     393  list result = eRing, @w;
     394  return (result);
    322395}
    323396example
     
    331404   minpoly = a2+1;
    332405   qring T = std(ideal(x+y2+v3,(x+v)^2));
    333    def Q = elimRing(yv);
     406   def Q = elimRing(yv)[1];
    334407   setring Q; Q;
    335408}
     
    337410
    338411proc 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)
     412"USAGE:   elim(id,arg[,s]);  id ideal/module, arg can be either an intvec v or
     413         a product p of variables (type poly), s a string determining the
     414         method which can be \"slimgb\" or \"std\" or, additionally,
     415         \"withWeigts\".
    341416RETURN: ideal/module obtained from id by eliminating either the variables
    342417        with indices appearing in v or the variables appearing in p.
    343418        Works also in a qring.
    344 METHOD: 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,
     419METHOD: elim uses elimRing to create a ring with an elimination ordering for
     420        the variables to be eliminated and then applies std if \"std\"
     421        is given, or slimgb if \"slimgb\" is given, or a heuristically choosen
     422        method.
     423@*      If the variables in the basering have weights these weights are used
     424        in elimRing. If a string \"withWeigts\" as (optional) argument is given
    349425        Singular computes weights for the variables to make the input as
    350426        homogeneous as possible.
    351427@*      The method is different from that used by eliminate and elim1;
    352         in some examples elim can be significantly faster.
     428        depending on the example, any of these commands can be faster.
    353429NOTE:   No special monomial ordering is required, i.e. the ordering can be
    354430        local or mixed. The result is a SB with respect to the ordering of
     
    367443  int pr = printlevel - voice + 2;   //for ring display if printlevel > 0
    368444  def BR = basering;
     445  list lER;                          //for list returned by elimRing
    369446//-------------------------------- check input -------------------------------
    370447  poly vars;
     448  int ne;                           //for number of vars to be eliminated
    371449  int ii;
    372450  if (size(#) > 0)
     
    375453    {
    376454      vars = #[1];
    377     }
    378     if ( typeof(#[1]) == "intvec")
    379     {
     455      for( ii=1; ii<=nvars(BR); ii++ )
     456      {
     457        if ( vars/var(ii) != 0)
     458        { ne++; }
     459      }
     460    }
     461    if ( typeof(#[1]) == "intvec" or typeof(#[1]) == "int")
     462    {
     463      ne = size(#[1]);
    380464      vars=1;
    381       for( ii=1; ii<=size(#[1]); ii++ )
     465      for( ii=1; ii<=ne; ii++ )
    382466      {
    383467        vars=vars*var(#[1][ii]);
     
    385469    }
    386470  }
    387   if (size(#) == 2)
     471
     472  string method;                    //for "std" or "slimgb" or "withWeights"
     473  if (size(#) >= 2)
    388474  {
    389475    if ( typeof(#[2]) == "string" )
     
    391477       if ( #[2] == "withWeights" )
    392478       {
    393          intvec @w = weight(id);
     479         intvec @w = weight(id);        //computation of weights
    394480       }
     481       if ( #[2] == "std" ) { method = "std"; }
     482       if ( #[2] == "slimgb" ) { method = "slimgb"; }
     483    }
     484    if (size(#) == 3)
     485    {
     486       if ( typeof(#[3]) == "string" )
     487       {
     488          if ( #[3] == "withWeights" )
     489          {
     490            intvec @w = weight(id);        //computation of weights
     491          }
     492          if ( #[3] == "std" ) { method = "std"; }
     493          if ( #[3] == "slimgb" ) { method = "slimgb"; }
     494       }
    395495    }
    396496  }
    397497
    398498//-------------- 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);
     499   if ( defined(@w) )
     500   {
     501      lER = elimRing(vars,@w);  //in this case lER[2] = @w
     502   }
     503   else
     504   {
     505      lER = elimRing(vars);
     506      intvec @w = lER[2];      //in this case w is the intvec of
     507                               //variable weights as computed in elimRing
     508   }
     509   def ER = lER[1];
     510   setring ER;
     511   def id = imap(BR,id);
     512   poly vars = imap(BR,vars);
     513
    410514//---------- 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   {
     515  //if possible apply std(id,hi,w) where hi is the first hilbert function
     516  //of id with respect to the weights w. If w is not defined (i.e. good weights
     517  //@w are computed then id is only approximately @w-homogeneous and
     518  //the hilbert driven std cannot be used directly; however, stdhilb
     519  //homogenizes first and applies the hilbert driven std to the homogenization
     520
     521   option(redThrough);
     522   if (typeof(id)=="matrix")
     523   {
     524     id = matrix(stdhilb(module(id),method,@w));
     525   }
     526   else
     527   {
     528     id = stdhilb(id,method,@w);
     529   }
     530
     531   //### Todo: hier sollte id = groebner(id, "hilb"); verwendet werden.
     532   //da z.Zt. (Jan 09) groebener bei extra Gewichtsvektor a(...) aber stets std
     533   //aufruft und ausserdem "withWeigts" nicht kennt, ist groebner(id, "hilb")
     534   //zunaechst nicht aktiviert. Ev. nach Ueberarbeitung von groebner aktivieren
     535
     536   id = nselect(id,1..ne);
     537   if ( pr > 0 )
     538   {
    415539     "// result is a SB in the following ring:";
    416      ER;
    417   }
    418   setring BR;
    419   return(imap(ER,id));
     540      ER;
     541   }
     542   setring BR;
     543   return(imap(ER,id));
    420544}
    421545example
     
    427551   int p = printlevel;
    428552   printlevel = 2;
    429    elim(i,uv,"withWeights");
     553   elim(i,uv,"withWeights","slimgb");
    430554   printlevel = p;
    431555
     
    477601   m=elim2(m,3..4);show(m);
    478602}
    479 ///////////////////////////////////////////////////////////////////////////////
    480 proc elim1 (id, poly vars)
    481 "USAGE:   elim1(id,p); id ideal/module, p product of vars to be eliminated
    482 RETURN:  ideal/module obtained from id by eliminating vars occuring in poly
     603
     604///////////////////////////////////////////////////////////////////////////////
     605proc elim1 (id, list #)
     606"USAGE:   elim1(id,arg); id ideal/module, arg can be either an intvec v or a
     607         product p of variables (type poly)
     608RETURN: ideal/module obtained from id by eliminating either the variables
     609        with indices appearing in v or the variables appearing in p
    483610METHOD:  elim1 calls eliminate but in a ring with ordering dp (resp. ls)
    484611         if the first var not to be eliminated belongs to a -p (resp. -s)
     
    493620   if ( size(ideal(br)) != 0 )
    494621   {
    495       ERROR ("cannot eliminate in a qring");
    496    }
     622      ERROR ("elim1 cannot eliminate in a qring");
     623   }
     624//------------- create product vars of variables to be eliminated -------------
     625  poly vars;
     626  int ii;
     627  if (size(#) > 0)
     628  {
     629    if ( typeof(#[1]) == "poly" ) {  vars = #[1]; }
     630    if ( typeof(#[1]) == "intvec" or typeof(#[1]) == "int")
     631    {
     632      vars=1;
     633      for( ii=1; ii<=size(#[1]); ii++ )
     634      {
     635        vars=vars*var(#[1][ii]);
     636      }
     637    }
     638  }
    497639//---- get variables to be eliminated and create string for new ordering ------
    498    int ii;
    499640   for( ii=1; ii<=nvars(basering); ii++ )
    500641   {
     
    519660   elim1(i,ts);
    520661   module m=i*gen(1)+i*gen(2);
    521    m=elim1(m,st); show(m);
    522 }
    523 ///////////////////////////////////////////////////////////////////////////////
     662   m=elim1(m,3..4); show(m);
     663}
     664///////////////////////////////////////////////////////////////////////////////
     665
    524666proc nselect (id, intvec v)
    525667"USAGE:   nselect(id,v); id = ideal, module or matrix, v = intvec
     
    528670SEE ALSO: select, select1
    529671EXAMPLE: example nselect; shows examples
    530 "{
    531    if (typeof(id)!="ideal")
    532    {
    533      if (typeof(id)=="module" || typeof(id)=="matrix")
    534      {
    535        module id1 = module(id);
    536      }
    537      else
    538      {
    539        ERROR("// *** input must be of type ideal or module or matrix");
    540      }
     672"
     673{
     674   if (typeof(id) != "ideal")
     675   {
     676      if (typeof(id)=="module" || typeof(id)=="matrix")
     677      {
     678        module id1 = module(id);
     679      }
     680      else
     681      {
     682        ERROR("// *** input must be of type ideal or module or matrix");
     683      }
    541684   }
    542685   else
     
    556699      }
    557700   }
    558    id1=simplify(id1,2);
    559701   if(typeof(id)=="matrix")
    560702   {
    561       return(matrix(id1));
    562    }
    563    return(id1);
     703      return(matrix(simplify(id1,2)));
     704   }
     705   return(simplify(id1,2));
    564706}
    565707example
     
    614756}
    615757///////////////////////////////////////////////////////////////////////////////
     758
    616759proc select (id, intvec v)
    617760"USAGE:   select(id,n[,m]); id = ideal/module/matrix, v = intvec
     
    622765SEE ALSO: select1, nselect
    623766EXAMPLE: example select; shows examples
    624 "{
    625    if (typeof(id)!="ideal")
    626    {
    627      if (typeof(id)=="module" || typeof(id)=="matrix")
    628      {
    629        module id1 = module(id);
    630      }
    631      else
    632      {
    633        ERROR("// *** input must be of type ideal or module or matrix");
    634      }
     767"
     768{
     769   if (typeof(id) != "ideal")
     770   {
     771      if (typeof(id)=="module" || typeof(id)=="matrix")
     772      {
     773        module id1 = module(id);
     774      }
     775      else
     776      {
     777        ERROR("// *** input must be of type ideal or module or matrix");
     778      }
    635779   }
    636780   else
    637781   {
    638      ideal id1 = id;
     782      ideal id1 = id;
    639783   }
    640784   int j,k;
     
    677821SEE ALSO: select, nselect
    678822EXAMPLE: example select1; shows examples
    679 "{
    680    if (typeof(id)!="ideal")
    681    {
    682      if (typeof(id)=="module" || typeof(id)=="matrix")
    683      {
    684        module id1 = module(id);
    685        module I;
    686      }
    687      else
    688      {
    689        ERROR("// *** input must be of type ideal or module or matrix");
    690      }
     823"
     824{
     825   if (typeof(id) != "ideal")
     826   {
     827      if (typeof(id)=="module" || typeof(id)=="matrix")
     828      {
     829        module id1 = module(id);
     830        module I;
     831      }
     832      else
     833      {
     834        ERROR("// *** input must be of type ideal or module or matrix");
     835      }
    691836   }
    692837   else
    693838   {
    694      ideal id1 = id;
    695      ideal I;
     839      ideal id1 = id;
     840      ideal I;
    696841   }
    697842   int j,k;
     
    706851      }
    707852   }
    708    I=simplify(I,2);
    709853   if(typeof(id)=="matrix")
    710854   {
    711       return(matrix(I));
    712    }
    713    return(I);
     855      return(matrix(simplify(I,2)));
     856   }
     857   return(simplify(I,2));
    714858}
    715859example
     
    722866   select1(matrix(m),1..2);
    723867}
    724 ///////////////////////////////////////////////////////////////////////////////
     868/*
     869///////////////////////////////////////////////////////////////////////////////
     870//                      EXAMPLEs
     871///////////////////////////////////////////////////////////////////////////////
     872// Siehe auch file 'tst-elim' mit grossem Beispiel;
     873example blowup0;
     874example elimRing;
     875example elim;
     876example elim1;
     877example nselect;
     878example sat;
     879example select;
     880example select1;
     881//===========================================================================
     882//         Rationale Normalkurve vom Grad d im P^d bzw. im A^d:
     883//homogen s:t -> (t^d:t^(d-1)s: ...: s^d), inhomogen t ->(t^d:t^(d-1): ...:t)
     884
     885//------------------- 1. Homogen:
     886//Varianten der Methode
     887int d = 5;
     888ring R = 0,(s,t,x(0..d)),dp;
     889ideal I;
     890for( int ii=0; ii<=d; ii++) {I = I,ideal(x(ii)-t^(d-ii)*s^ii); }
     891
     892int tt = timer;
     893ideal eI = elim(I,1..2,"std");
     894ideal eI = elim(I,1..2,"slimgb");
     895ideal eI = elim(I,st,"withWeights");
     896ideal eI = elim(I,st,"std","withWeights");
     897//komplizierter
     898int d = 50;
     899ring R = 0,(s,t,x(0..d)),dp;
     900ideal I;
     901for( int ii=0; ii<=d; ii++) {I = I,ideal(x(ii)-t^(d-ii)*s^ii); }
     902int tt = timer;
     903ideal eI = elim(I,1..2);               //56(44)sec (slimgb 22(17),hilb 33(26))
     904timer-tt; tt = timer;
     905ideal eI = elim1(I,1..2);              //71(53)sec
     906timer-tt; tt = timer;
     907ideal eI = eliminate(I,st);            //70(51)sec (wie elim1)
     908timer-tt;
     909timer-tt; tt = timer;
     910ideal eI = elim(I,1..2,"withWeights"); //190(138)sec
     911                                //(weights73(49), slimgb43(33), hilb71(53)
     912timer-tt;
     913//------------------- 2. Inhomogen
     914int d = 50;
     915ring r = 0,(t,x(0..d)),dp;
     916ideal I;
     917for( int ii=0; ii<=d; ii++) {I = I+ideal(x(ii)-t^(d-ii)); }
     918int tt = timer;
     919ideal eI = elim(I,1,);                //20(15)sec (slimgb13(10), hilb6(5))
     920ideal eI = elim(I,1,"std");           //17sec (std 11, hilb 6)
     921timer-tt; tt = timer;
     922ideal eI = elim1(I,t);               //8(6)sec
     923timer-tt; tt = timer;
     924ideal eI = eliminate(I,t);           //7(6)sec
     925timer-tt;
     926timer-tt; tt = timer;
     927ideal eI = elim(I,1..1,"withWeights"); //189(47)sec
     928//(weights73(42), slimgb43(1), hilb70(2)
     929timer-tt;
     930
     931//===========================================================================
     932//        Zufaellige Beispiele, homogen
     933system("random",37);
     934ring R = 0,x(1..6),lp;
     935ideal I = sparseid(4,3);
     936
     937int tt = timer;
     938ideal eI = elim(I,1);                //108(85)sec (slimgb 29(23), hilb79(61)
     939timer-tt; tt = timer;
     940ideal eI = elim(I,1,"std");          //(139)sec (std 77, hilb 61)
     941timer-tt; tt = timer;
     942ideal eI = elim1(I,1);               //(nach 45 min abgebrochen)
     943timer-tt; tt = timer;
     944ideal eI = eliminate(I,x(1));        //(nach 45 min abgebrochen)
     945timer-tt; tt = timer;
     946
     947//        Zufaellige Beispiele, inhomogen
     948system("random",37);
     949ring R = 32003,x(1..5),dp;
     950ideal I = sparseid(4,2,3);
     951option(prot,redThrough);
     952
     953intvec w = 1,1,1,1,1,1;
     954int tt = timer;
     955ideal eI = elim(I,1,w);            //(nach 5min abgebr.) hilb schlaegt nicht zu
     956timer-tt; tt = timer;              //BUG!!!!!!
     957
     958int tt = timer;
     959ideal eI = elim(I,1);              //(nach 5min abgebr.) hilb schlaegt nicht zu
     960timer-tt; tt = timer;              //BUG!!!!!!
     961ideal eI = elim1(I,1);             //8(7.8)sec
     962timer-tt; tt = timer;
     963ideal eI = eliminate(I,x(1));      //8(7.8)sec
     964timer-tt; tt = timer;
     965
     966                              BUG!!!!
     967//        Zufaellige Beispiele, inhomogen, lokal
     968system("random",37);
     969ring R = 32003,x(1..6),ds;
     970ideal I = sparseid(4,1,2);
     971option(prot,redThrough);
     972int tt = timer;
     973ideal eI = elim(I,1);                //(haengt sich auf)
     974timer-tt; tt = timer;
     975ideal eI = elim1(I,1);               //(0)sec !!!!!!
     976timer-tt; tt = timer;
     977ideal eI = eliminate(I,x(1));        //(ewig mit ...., abgebrochen)
     978timer-tt; tt = timer;
     979
     980ring R1 =(32003),(x(1),x(2),x(3),x(4),x(5),x(6)),(a(1,0,0,0,0,0),ds,C);
     981ideal I = imap(R,I);
     982I = std(I);                           //(haengt sich auf) !!!!!!!
     983
     984ideal eI = elim(I,1..1,"withWeights"); //(47)sec (weights42, slimgb1, hilb2)
     985timer-tt;
     986
     987ring R1 =(32003),(x(1),x(2),x(3),x(4),x(5),x(6)),(a(1,0,0,0,0,0),ds,C);
     988ideal I = imap(R,I);
     989I = std(I);                           //(haengt sich auf) !!!!!!!
     990
     991ideal eI = elim(I,1..1,"withWeights"); //(47)sec (weights42, slimgb1, hilb2)
     992timer-tt;
     993*/
Note: See TracChangeset for help on using the changeset viewer.