Changeset 43d23c in git for Singular/LIB/tropical.lib


Ignore:
Timestamp:
Aug 15, 2019, 1:45:11 PM (5 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
40b65a33b8f97714b624e53cd7ece1518afa831b
Parents:
6481efa31c6cdd77d94b8f54fe37cf6832effd6b3370016501d46485e4e45a46cb16fcdfc088fdd9
Message:
Merge branch 'steenpass-execute' into spielwiese
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/tropical.lib

    r6481ef r43d23c  
    338338  // we change to a ring where the variables have names t and x(1),...,x(n)
    339339  def ALTERRING=basering;
     340  list RL=ringlist(ALTERRING);
    340341  if (nvars(basering)==2)
    341342  {
    342     execute("ring BASERING=("+charstr(ALTERRING)+"),(t,x(1)),("+ordstr(ALTERRING)+");");
     343    RL[2]=list("t","x(1)");
     344    ring BASERING = ring(RL);
    343345  }
    344346  else
    345347  {
    346     execute("ring BASERING=("+charstr(ALTERRING)+"),(t,x(1.."+string(nvars(ALTERRING)-1)+")),("+ordstr(ALTERRING)+");");
     348    list V = "t";
     349    for (int ii = nvars(ALTERRING)-1; ii > 0; ii--)
     350    {
     351      V[ii+1] = "x("+string(ii)+")";
     352    }
     353    RL[2]=V;
     354    ring BASERING = ring(RL);
    347355  }
    348356  map altphi=ALTERRING,maxideal(1);
     
    466474  // for this, unfortunately, t has to be the last variable !!!
    467475  ideal variablen;
     476  list RL=ringlist(basering);
    468477  for (j=2;j<=nvars(basering);j++)
    469478  {
    470479    variablen=variablen+var(j);
    471   }
    472   execute("ring GRUNDRING=("+charstr(basering)+"),("+string(variablen)+",t),(dp("+string(nvars(basering)-1)+"),lp(1));");
     480    RL[2][j-1]=RL[2][j];
     481  }
     482  RL[2][size(RL[2])]="t";
     483  RL[3]=list(list("dp",1:(nvars(basering)-1)),list("lp",1));
     484  ring GRUNDRING = ring(RL);
     485  list RL=ringlist(GRUNDRING);
     486  list VARIABLEN;
    473487  ideal variablen;
    474488  for (j=1;j<=nvars(basering)-1;j++)
    475489  {
    476490    variablen=variablen+var(j);
     491    VARIABLEN[j]=RL[2][j];
    477492  }
    478493  map GRUNDPHI=BASERING,t,variablen;
     
    497512  if (iszerodim==0) // do so only if is_dim_zero is not set
    498513  {
    499     execute("ring QUOTRING=("+charstr(basering)+",t),("+string(variablen)+"),dp;");
     514    RL=ringlist(basering);
     515    RL[1]=list(RL[1],list("t"),list(list("lp",1)),ideal(0));
     516    RL[2]=VARIABLEN;
     517    RL[3]=list(list("dp",1:size(VARIABLEN)));
     518    ring QUOTRING = ring(RL);
    500519    ideal i=groebner(imap(GRUNDRING,i));
    501520    int dd=dim(i);
     
    573592        // from LIFTRING are present,
    574593        // and where also the variables of CUTDOWNRING live
    575         execute("ring REPLACEMENTRING=("+charstr(LIFTRING)+"),("+varstr(CUTDOWNRING)+"),dp;");
     594        list RL=ringlist(LIFTRING);
     595        list RL2=ringlist(CUTDOWNRING);
     596        RL[2]=RL2[2];
     597        RL[3]=list(list("dp",1:nvars(CUTDOWNRING)));
     598        ring REPLACEMENTRING = ring(RL);
    576599        list repl=imap(CUTDOWNRING,repl); // get the replacement rules
    577600                                          // from CUTDOWNRING
     
    10691092      poly mp=minpoly;
    10701093      def OLDRING=basering;
    1071       execute("ring NEWRING=0,("+varstr(basering)+","+parstr(basering)+"),ds;");
     1094      list RL=ringlist(OLDRING);
     1095      RL[2]=RL[2]+RL[1][2];
     1096      RL[1]=RL[1][1];
     1097      RL[3]=list(list("ds",1:size(RL[2])));
     1098      ring NEWRING=ring(RL);
    10721099      ideal I=imap(OLDRING,mp),imap(OLDRING,f);
    10731100    }
     
    17171744    {
    17181745      string polynomstring=string(f);
    1719       execute("ring drawring=(0,"+parstr(basering)+"),("+varstr(basering)+"),dp;");
     1746      list RL=ringlist(basering);
     1747      RL[1][1]=0;
     1748      RL[3]=list(list("dp",1:nvars(basering)));
     1749      ring drawring = ring(RL);
    17201750      execute("poly f="+polynomstring+";");
    17211751    }
     
    26372667  // THIS IS NOT DOCUMENTED FOR THE GENERAL USER!!!!
    26382668  def BASERING=basering;
     2669  list RL=ringlist(BASERING);
     2670  list VARIABLEN;
    26392671  int j;
    26402672  if (size(#)>0)
     
    26422674    // we first have to move the variable t to the front again
    26432675    ideal variablen=var(nvars(basering));
     2676    VARIABLEN[1]=RL[2][nvars(basering)];
    26442677    for (j=1;j<nvars(basering);j++)
    26452678    {
    26462679      variablen=variablen+var(j);
     2680      VARIABLEN[j+1]=RL[2][j];
    26472681    }
    26482682  }
     
    26502684  {
    26512685    ideal variablen=maxideal(1);
     2686    VARIABLEN=RL[2];
    26522687  }
    26532688  // we want to homogenise the ideal i ....
    2654   execute("ring HOMOGRING=("+charstr(basering)+"),(@s,"+string(variablen)+"),dp;");
     2689  RL=ringlist(basering);
     2690  RL[2]=list("@s")+RL[2];
     2691  RL[3]=list(list("dp",1:size(RL[2])));
     2692  ring HOMOGRING = ring(RL);
    26552693  ideal i=homog(std(imap(BASERING,i)),@s);
    26562694  // ... and compute a standard basis with
     
    26672705  }
    26682706  intmat O=weightVectorToOrderMatrix(whomog);
    2669   execute("ring WEIGHTRING=("+charstr(basering)+"),("+varstr(basering)+"),(M("+string(O)+"));");
     2707  list RL=ringlist(basering);
     2708  RL[3]=list(list("M",O));
     2709  ring WEIGHTRING = ring(RL);
    26702710  // map i to the new ring and compute a GB of i, then dehomogenise i,
    26712711  // so that we can be sure, that the
     
    26742714  // compute the w-initial ideal with the help of the procedure tInitialForm;
    26752715  setring BASERING;
    2676   execute("ring COMPINIRING=("+charstr(basering)+"),("+string(variablen)+"),dp;");
     2716  RL[2]=VARIABLEN;
     2717  RL[3]=list(list("dp",1:size(VARIABLEN)));
     2718  ring COMPINIRING = ring(RL);
    26772719  ideal i=imap(WEIGHTRING,i);
    26782720  ideal ini;
     
    27112753  def BASERING=basering;
    27122754  intmat O=weightVectorToOrderMatrix(w);
    2713   execute("ring INITIALRING=("+charstr(BASERING)+"),("+varstr(basering)+"),M("+string(O)+");");
     2755  list RL=ringlist(basering);
     2756  RL[3]=list(list("M",O));
     2757  ring INITIALRING = ring(RL);
    27142758  poly f=imap(BASERING,f);
    27152759  int GRAD=deg(f);
     
    27842828  def BASERING=basering;
    27852829  intmat O=weightVectorToOrderMatrix(w);
    2786   execute("ring INITIALRING=("+charstr(BASERING)+"),("+varstr(basering)+"),M("+string(O)+");");
     2830  list RL=ringlist(BASERING);
     2831  RL[3]=list(list("M",O));
     2832  ring INITIALRING = ring(RL);
    27872833  ideal i=imap(BASERING,i);
    27882834  i=std(i);
     
    28342880  }
    28352881  def BASERING=basering;
    2836   execute("ring PARAMETERRING=("+string(char(basering))+"),("+parstr(basering)+"),ds;");
     2882  ring PARAMETERRING = create_ring("("+string(char(basering))+")", "("+parstr(basering)+")", "ds");
    28372883  poly den=imap(BASERING,den);
    28382884  poly num=imap(BASERING,num);
     
    34933539{
    34943540  def BASERING=basering;
    3495   execute("ring RADRING=("+charstr(basering)+"),(@T,"+varstr(basering)+"),(dp(1),"+ordstr(basering)+");");
     3541  list RL=ringlist(BASERING);
     3542  RL[2]=list("@T")+RL[2];
     3543  RL[3]=list(list("dp",1:1))+RL[3];
     3544  ring RADRING = ring(RL);
    34963545  ideal I=ideal(imap(BASERING,i))+ideal(1-@T*imap(BASERING,f));
    34973546  if (reduce(1,std(I))==0)
     
    36443693  CHARAKTERISTIK=CHARAKTERISTIK[1..size(CHARAKTERISTIK)-2];
    36453694  def BASERING=basering;
    3646   execute("ring INITIALRING=("+CHARAKTERISTIK+"),("+varstr(basering)+"),("+ordstr(basering)+");");
     3695  ring INITIALRING = create_ring("("+CHARAKTERISTIK+")", "("+varstr(basering)+")", "("+ordstr(basering)+")");
    36473696  list l=solve(imap(BASERING,i));
    36483697  l;
     
    39524001  }
    39534002  def BASERING=basering;
    3954   execute("ring QUOTRING=("+charstr(basering)+",t),("+string(variablen)+"),dp;");
     4003  ring QUOTRING = create_ring("("+charstr(basering)+",t)", "("+string(variablen)+")", "dp");
    39554004  ideal i=subst(imap(BASERING,i),var(j-1),t^(-wj)*var(j-1));
    39564005  for (k=1;k<=size(i);k++)
     
    40074056  list erglini;
    40084057  list ergl;
     4058  list VARIABLEN;
     4059  list RL=ringlist(BASERING);
    40094060  for (j1=1;j1<=nvars(basering)-1;j1++)
    40104061  {
     
    40134064    product=product*var(j1); // make product of all variables
    40144065                             // (needed for the initial-monomial-check later
    4015   }
    4016   execute("ring QUOTRING=("+charstr(basering)+",t),("+string(variablen)+"),dp;");
     4066    VARIABLEN[j1]=RL[2][j1];
     4067  }
     4068  RL[1]=list(RL[1],list("t"),list(list("lp",1:1)),ideal(0));
     4069  RL[2]=VARIABLEN;
     4070  RL[3]=list(list("dp",1:size(VARIABLEN)));
     4071  ring QUOTRING = ring(RL);
    40174072  setring BASERING;
    40184073  // change to quotring where we want to compute the primary decomposition of i
     
    42014256        variablen=0;
    42024257        j2=0;
     4258        VARIABLEN=list();
    42034259        for(j1=1;j1<=nvars(basering)-1;j1++)
    42044260        {
     
    42144270            variablen=variablen+var(j1); // read the set of remaining variables
    42154271                                         // (needed to make quotring later)
     4272            VARIABLEN=VARIABLEN+list(RL[2][j1]);
    42164273          }
    42174274        }
    42184275        // return pideal, the initial and the list ergl which tells us
    42194276        // which variables we replaced by which form
    4220         execute("ring BASERINGLESS1=("+charstr(BASERING)+"),("+string(variablen)+",t),(dp("+string(ncols(variablen))+"),lp(1));");
     4277        RL=ringlist(BASERING);
     4278        RL[2]=VARIABLEN+list("t");
     4279        RL[3]=list(list("dp",1:size(VARIABLEN)),list("lp",1:1));
     4280        ring BASERINGLESS1 = ring(RL);
    42214281        ideal i=imap(BASERING,pideal);
    42224282        ideal ini=imap(BASERING,pini); //ideal ini2=tInitialIdeal(i,wvecp,1);
     
    42954355  }
    42964356  setring BASERING;
    4297   execute("ring BASERINGLESS2=("+charstr(BASERING)+"),("+string(variablen)+",t),(dp("+string(ncols(variablen))+"),lp(1));");
     4357  ring BASERINGLESS2 = create_ring(ringlist(BASERING)[1], "("+string(variablen)+",t)", "(dp("+string(ncols(variablen))+"),lp(1))", "no_minpoly");
    42984358  // using the 0/1-vector which tells us which variables belong
    42994359  // to the set of smallest entries of wvec
     
    46434703  if ((numberdeletedvariables>0) and (anzahlvariablen>1)) // if only t remains,
    46444704  { // all true variables are gone
    4645     execute("ring NEURING=("+charstr(basering)+"),("+string(variablen)+"),(dp("+string(size(variablen)-1)+"),lp(1));");
     4705    ring NEURING = create_ring(ringlist(basering)[1], "("+string(variablen)+")", "(dp("+string(size(variablen)-1)+"),lp(1))", "no_minpoly");
    46464706    ideal i=imap(BASERING,i);
    46474707    ideal gesamt_m=imap(BASERING,gesamt_m);
     
    46594719    {
    46604720      // pass to a ring which has variables which are suitable for gfan
    4661       execute("ring GFANRING=("+charstr(basering)+"),(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z),dp;");
     4721      ring GFANRING = create_ring(ringlist(basering)[1], "(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z)", "dp", "no_minpoly");
    46624722      ideal phiideal=b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z;
    46634723      phiideal[nvars(PREGFANRING)]=a; // map t to a
     
    48294889    else
    48304890    {
    4831       execute("ring PARARing=("+charstr(basering)+"),t,ls;");
     4891      ring PARARing = create_ring(ringlist(basering)[1], "t", "ls", "no_minpoly");
    48324892    }
    48334893    ideal PARA; // will contain the parametrisation
     
    49174977    variablen=variablen+var(j);
    49184978  }
    4919   execute("ring INITIALRING=("+charstr(basering)+"),("+string(variablen)+"),dp;");
     4979  ring INITIALRING = create_ring(ringlist(basering)[1], "("+string(variablen)+")", "dp", "no_minpoly");
    49204980  ideal ini=imap(BASERING,ini);
    49214981  // compute the associated primes of the initialideal
     
    51605220  if (anzahlvariablen<nvars(basering))
    51615221  {
    5162     execute("ring TINRING=("+charstr(basering)+","+string(Parameter)+"),("+string(variablen)+"),dp;");
     5222    ring TINRING = create_ring("("+charstr(basering)+","+string(Parameter)+")", "("+string(variablen)+")", "dp");
    51635223  }
    51645224  else
    51655225  {
    5166     execute("ring TINRING=("+charstr(basering)+"),("+string(variablen)+"),dp;");
     5226    ring TINRING = create_ring(ringlist(basering)[1], "("+string(variablen)+")", "dp", "no_minpoly");
    51675227  }
    51685228  ideal tin=imap(BASERING,tin);
     
    51855245  string PMet=string(par(1));
    51865246  def BASERING=basering;
    5187   execute("ring r=0,"+PMet+",ls;");
     5247  ring r = create_ring(0, PMet, "ls");
    51885248  execute("poly denomi="+denom+";");
    51895249  execute("poly numer="+num+";");
     
    55435603    if (size(#)>0) // noAbs was used
    55445604    {
    5545       execute("ring NOQRing=("+string(char(LIFTRing))+"),("+varstr(basering)+","+parstr(LIFTRing)+"),dp;");
     5605      ring NOQRing = create_ring("("+string(char(LIFTRing))+")", "("+varstr(basering)+","+parstr(LIFTRing)+")", "dp");
    55465606      execute("qring TESTRing=std("+#[1]+");");
    55475607      ideal i=imap(BASERING,i);
     
    55515611      setring LIFTRing;
    55525612      poly mp=minpoly;
    5553       execute("ring TESTRing=("+charstr(LIFTRing)+"),("+varstr(BASERING)+"),dp;");
     5613      ring TESTRing = create_ring(ringlist(LIFTRing)[1], "("+varstr(BASERING)+")", "dp", "no_minpoly");
    55545614      minpoly=number(imap(LIFTRing,mp));
    55555615      ideal i=imap(BASERING,i);
     
    57185778        {
    57195779          // pass to a ring which has variables which are suitable for gfan
    5720           execute("ring GFANRING=("+string(char(basering))+"),(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z),dp;");
     5780          ring GFANRING = create_ring(string(char(basering)), "(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z)", "dp");
    57215781          ideal phiideal=b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z;
    57225782          phiideal[nvars(PREGFANRING)]=a; // map t to a
     
    59345994        if (anzahlvariablen<nvars(basering))
    59355995        {
    5936           execute("ring PARARing=("+string(char(basering))+",@a),t,ls;");
     5996          ring PARARing = create_ring("("+string(char(basering))+",@a)", "t", "ls");
    59375997          minpoly=number(imap(PREGFANRING,m));
    59385998        }
    59395999        else
    59406000        {
    5941           execute("ring PARARing=("+charstr(basering)+"),t,ls;");
     6001          ring PARARing = create_ring(ringlist(basering)[1], "t", "ls", "no_minpoly");
    59426002        }
    59436003        ideal PARA; // will contain the parametrisation
     
    62006260        else
    62016261        {
    6202           execute("ring SATURATERING=("+charstr(basering)+"),("+varstr(basering)+"),("+ordstr(basering)+");");
     6262          ring SATURATERING = create_ring(ringlist(basering)[1], "("+varstr(basering)+")", "("+ordstr(basering)+")", "no_minpoly");
    62036263          ideal i=imap(BASERING,i);
    62046264          export(i);
     
    63086368  def BASERING=basering;
    63096369  string tvar=string(var(nvars(basering)));
     6370  list RL_BASERING=ringlist(BASERING);
     6371  list TVAR=RL_BASERING[2];
    63106372  int j,k,l; // indices
    63116373  // store the weighted degrees of the elements of i in an integer vector
     
    63346396  // collect the true variables x_1,...,x_n plus @a, if it is defined in BASERING
    63356397  ideal variablen;
     6398  list VARIABLEN;
     6399  list RL=ringlist(basering);
    63366400  for (j=1;j<=nvars(basering)-1;j++)
    63376401  {
    63386402    variablen=variablen+var(j);
     6403    VARIABLEN[j]=RL[2][j];
    63396404  }
    63406405  // move to a polynomial ring with global monomial ordering
    63416406  // - the variable t is superflous,
    63426407  // the variable @a is not if it was already present
    6343   execute("ring INITIALRING=("+charstr(basering)+"),("+string(variablen)+"),dp;");
     6408  RL[2]=VARIABLEN;
     6409  RL[3]=list(list("dp",1:size(VARIABLEN)));
     6410  ring INITIALRING = ring(RL);
    63446411  ideal ini=imap(BASERING,ini);
    63456412  // compute the minimal associated primes of the
     
    63576424  }
    63586425  list extensionringlist; // contains the rings which are to be returned
     6426  list RL;
    63596427  for (j=1;j<=size(maximalideals);j++)
    63606428  {
     
    63636431    // if some of the maximal ideals needs a field extension,
    63646432    // then everything will live in this ring
     6433    RL=ringlist(BASERING);
    63656434    if ((maximalideals[j][1]!=0) and (nvars(BASERING)==anzahlvariablen))
    63666435    {
    63676436      // define the extension ring which contains
    63686437      // the new variable @a, if it is not yet present
    6369       execute("ring EXTENSIONRING=("+charstr(BASERING)+"),("+string(imap(BASERING,variablen))+",@a,"+tvar+"),(dp("+string(anzahlvariablen-1)+"),dp(1),lp(1));");
     6438      RL[2]=VARIABLEN+list("@a")+TVAR;
     6439      RL[3]=list(list("dp",1:(anzahlvariablen-1)),list("dp",1:1),list("lp",1:1));
     6440      ring EXTENSIONRING = ring(RL);
    63706441      // phi maps x_i to x_i, @a to @a (if present in the ring),
    63716442      // and the additional variable
     
    63786449    else // @a was already present in the BASERING or no
    63796450    { // field extension is necessary
    6380       execute("ring EXTENSIONRING=("+charstr(BASERING)+"),("+varstr(BASERING)+"),("+ordstr(BASERING)+");");
     6451      ring EXTENSIONRING = ring(RL);
    63816452      // phi maps x_i to x_i, @a to @a (if present in the ring),
    63826453      // and the additional variable
     
    72557326{
    72567327  def BASERING=basering;
    7257   execute("ring INTERRING=0,("+varstr(basering)+"),("+ordstr(basering)+");");
     7328  ring INTERRING = create_ring(0, "("+varstr(basering)+")", "("+ordstr(basering)+")");
    72587329  poly n=imap(BASERING,n);
    7259   execute("ring REALRING=(real,50,100),("+varstr(basering)+"),("+ordstr(basering)+");");
     7330  ring REALRING = create_ring("(real,50,100)", "("+varstr(basering)+")", "("+ordstr(basering)+")");
    72607331  map phi=INTERRING,maxideal(1);
    72617332  string s=string(phi(n));
     
    78737944  {
    78747945    def BASERING=basering;
    7875     execute("ring TRING="+string(char(BASERING))+",t,ds;");
     7946    ring TRING = create_ring(string(char(BASERING)), "t", "ds");
    78767947    poly hn=imap(BASERING,hn);
    78777948    poly c4=imap(BASERING,c4);
Note: See TracChangeset for help on using the changeset viewer.