Changeset 78eaa8 in git


Ignore:
Timestamp:
Jul 24, 2019, 1:39:31 PM (4 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
Children:
20e7303a3d50b30117c53a232ad724297637ac0e
Parents:
fa1cd304b94fb2782b47874564b731a57670c34ccbb89a79113ccf8c4cf31dd700cba8927fe3623a
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2019-07-24 13:39:31+02:00
git-committer:
GitHub <noreply@github.com>2019-07-24 13:39:31+02:00
Message:
Merge pull request #943 from steenpass/execute

remove more occurrences of execute() (3)
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/algebra.lib

    rfa1cd3 r78eaa8  
    10321032  }
    10331033  // --------------------- change of variable names -------------------------
    1034   execute("ring @bsr = ("+charstr(bsr)+"),y(1..m),("+os+");");
     1034  list l2;
     1035  for (int ii = 1; ii <= m; ii++)
     1036  {
     1037    l2[ii] = "y("+string(ii)+")";
     1038  }
     1039  ring @bsr = create_ring(ringlist(bsr)[1], l2, "("+os+")", "no_minpoly");
    10351040  ideal J = fetch(bsr,J);
    10361041  ideal PHI = fetch(bsr,PHI);
  • Singular/LIB/assprimeszerodim.lib

    rfa1cd3 r78eaa8  
    364364//=== mapping T to p and test if d=deg(F)
    365365   def R = basering;
    366    execute("ring Rhelp = ("+charstr(R)+"), T, dp;");
     366   ring Rhelp = create_ring(ringlist(R)[1], "T", "dp", "no_minpoly");
    367367   setring R;
    368368   map phi = Rhelp,p;
  • Singular/LIB/chern.lib

    rfa1cd3 r78eaa8  
    33053305  int n=nvars(basering);
    33063306  def br@=basering; // remember the base ring
    3307   execute("ring r@=("+ charstr(basering) +"),("+varstr(basering)+",homvar@), dp;");
     3307  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+",homvar@)", "dp", "no_minpoly");
    33083308  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
    33093309  ideal I=F(I);
  • Singular/LIB/finvar.lib

    rfa1cd3 r78eaa8  
    13901390    poly A(1)=M[1,2];                 // denominator of Molien series (for now)
    13911391    string mp=string(minpoly);
    1392     execute("ring R=("+charstr(br)+"),("+varstr(br)+"),ds;");
     1392    ring R = create_ring(ringlist(br)[1], "("+varstr(br)+")", "ds", "no_minpoly");
    13931393    if (mp!="0")
    13941394    {
  • Singular/LIB/goettsche.lib

    rfa1cd3 r78eaa8  
    8181  def br@=basering; // remember the base ring
    8282  // add additional variables z@, t@ to the base ring
    83   execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;" );
     83  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
    8484  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
    8585  // compute the generating function by the Goettsche's formula up to degree n in t@
     
    144144  def br@=basering; // remember the base ring
    145145  // add additional variables z@, t@ to the base ring
    146   execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;" );
     146  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
    147147  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
    148148  // compute the generating function by the Goettsche's formula up to degree n in t@
     
    208208  def br@=basering; // remember the base ring
    209209  // add additional variables z@, t@ to the base ring
    210   execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;" );
     210  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
    211211  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
    212212  poly rez=1;
     
    267267  def br@=basering; // remember the base ring
    268268  // add additional variables z@, t@ to the base ring
    269   execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;" );
     269  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
    270270  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
    271271  // compute the generating function by the Nakajima-Yoshioka formula up to degree n in t@
     
    322322  def br@=basering; // remember the base ring
    323323  // add additional variables z@, t@ to the base ring
    324   execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;" );
     324  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
    325325  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
    326326  // compute the generating function by the Nakajima-Yoshioka formula up to degree n in t@
     
    377377  def br@=basering; // remember the base ring
    378378  // add additional variables z@, t@ to the base ring
    379   execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;" );
     379  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
    380380  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
    381381  poly rez=1;
     
    434434  def br@=basering; // remember the base ring
    435435  // add additional variables z@, t@ to the base ring
    436   execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;" );
     436  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
    437437  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
    438438  poly rez=1;
     
    485485  def br@=basering; // remember the base ring
    486486  // add additional variables z@, t@ to the base ring
    487   execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;" );
     487  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
    488488  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
    489489  poly rez=1;
     
    536536  def br@=basering; // remember the base ring
    537537  // add additional variables z@, t@ to the base ring
    538   execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;" );
     538  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
    539539  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
    540540  poly rez=1;
     
    594594  def br@=basering; // remember the base ring
    595595  // add additional variable t@ to the base ring
    596   execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", t@), dp;" );
     596  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", t@)", "dp", "no_minpoly");
    597597  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
    598598  poly rez=(1-t@^2)*PPolyW(q, m, n, t@, d);
     
    637637  def br@=basering; // remember the base ring
    638638  // add additional variable t@ to the base ring
    639   execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", t@), dp;" );
     639  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", t@)", "dp", "no_minpoly");
    640640  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
    641641  poly rez=(1-t@^2)*PPolyW(q, m, n, t@, d);
  • Singular/LIB/graal.lib

    rfa1cd3 r78eaa8  
    210210  {
    211211    def origin = basering;
    212     execute("ring ringForGeneralPosition = ("+charstr(basering)+"),("+varstr(basering)+"),lp;");
     212    ring ringForGeneralPosition = create_ring(ringlist(basering)[1], "("+varstr(basering)+")", "lp", "no_minpoly");
    213213    ideal m = fetch(origin,m);
    214214    newRing = 1;
  • Singular/LIB/numerAlg.lib

    rfa1cd3 r78eaa8  
    230230 setring W1;
    231231 number j1=jj;
    232  execute("ring q=(real,0),("+varstr(S)+"),dp;");
     232 ring q = create_ring("(real,0)", "("+varstr(S)+")", "dp");
    233233 ideal I=imap(W1,I);
    234234 ideal J=imap(W1,J);
    235  execute("ring qq=0,("+varstr(S)+"),dp;");
     235 ring qq = create_ring(0, "("+varstr(S)+")", "dp");
    236236 ideal I=imap(S,I);
    237237 ideal J=imap(S,J);
     
    315315 if((u^2)==0)
    316316 {
    317   execute("ring A=(real,e-1),("+varstr(S)+",I),ds;");
     317  ring A = create_ring("(real,e-1)", "("+varstr(S)+",I)", "ds");
    318318  ideal II=imap(S,J);
    319319  list rw=imap(S,rw);
     
    332332 {
    333333  int d=dim(std(J));
    334   execute("ring R=(complex,e-1,I),("+varstr(S)+"),ds;");
     334  ring R = create_ring("(complex,e-1,I)", "("+varstr(S)+")", "ds");
    335335  list w=imap(S,w);
    336336  ideal II=imap(S,J);
     
    355355  if(tt==d)
    356356  {
    357    execute("ring A=(complex,e,I),("+varstr(S)+"),dp;");
     357   ring A = create_ring("(complex,e,I)", "("+varstr(S)+")", "dp");
    358358   t=tt;
    359359  }
    360360  else
    361361  {
    362    execute("ring RR=(real,e-2),("+varstr(S)+",I),dp;");
     362   ring RR = create_ring("(real,e-2)", "("+varstr(S)+",I)", "dp");
    363363   ideal II=imap(S,J);
    364364   list rw=imap(S,rw);
     
    398398    setring M;
    399399    sz1=size(SOL);
    400     execute("ring RRRQ=(real,e-1),("+varstr(S)+",I),dp;");
     400    ring RRRQ = create_ring("(real,e-1)", "("+varstr(S)+",I)", "dp");
    401401    ideal HH=imap(RR,HH);
    402402    if(dim(std(HH))==0)
     
    413413   if(sz1==sz2)
    414414   {
    415     execute("ring A=(complex,e,I),("+varstr(S)+"),dp;");
     415    ring A = create_ring("(complex,e,I)", "("+varstr(S)+")", "dp");
    416416    t=d;
    417417   }
    418418   else
    419419   {
    420     execute("ring RQ=(real,e-1),("+varstr(S)+"),dp;");
     420    ring RQ = create_ring("(real,e-1)", "("+varstr(S)+")", "dp");
    421421    ideal II=imap(S,J);
    422422    def RW=WitSet(II);
     
    448448        if((ni+nr)<1/10^(2*e-3))
    449449        {
    450          execute("ring A=(complex,e,I),("+varstr(S)+"),dp;");
     450         ring A = create_ring("(complex,e,I)", "("+varstr(S)+")", "dp");
    451451         list W(ii)=imap(RW,W(ii));
    452452         t=0;
     
    459459      {
    460460       def SS=Singular2bertini(W(ii));
    461        execute("ring D=(complex,e,I),("+varstr(S)+",s,gamma),dp;");
     461       ring D = create_ring("(complex,e,I)", "("+varstr(S)+",s,gamma)", "dp");
    462462       string nonsin;
    463463       ideal H,L;
     
    504504         if(tr<=1/10^(2*e-3))
    505505         {
    506           execute("ring A=(complex,e,I),("+varstr(S)+"),dp;");
     506          ring A = create_ring("(complex,e,I)", "("+varstr(S)+")", "dp");
    507507          t=ii;
    508508          ii=d+1;
  • Singular/LIB/numerDecom.lib

    rfa1cd3 r78eaa8  
    349349   if((n-rn)!=dd)
    350350   {
    351     execute("ring R=0,("+varstr(S)+",z(1..dd)),dp;");
     351    list l2 = ringlist(S)[2];
     352    for (int ii = 1; ii <= dd; ii++)
     353    {
     354     l2[size(l2)+1] = "z("+string(ii)+")";
     355    }
     356    ring R = create_ring(0, l2, "dp");
    352357    ideal I=imap(rs,I);
    353358    ideal H(0..n),L,LL,L(1..dd),LL(1..dd),h(1..dd),N(0..dd);
     
    483488     {
    484489      int w(q-1)=0;
    485       execute("ring D(q)=(0,s,gamma),("+varstr(S)+",z(1..q)),dp;");
     490      list l2 = ringlist(S)[2];
     491      for (int ii = 1; ii <= q; ii++)
     492      {
     493       l2[size(l2)+1] = "z("+string(ii)+")";
     494      }
     495      ring D(q) = create_ring("(0,s,gamma)", l2, "dp");
    486496      string nonsin(q),stnonsin(q);
    487497      ideal H(1..q);
     
    579589         for(qq=q-1;qq>=1;qq--)
    580590         {
    581           execute("ring T(qq)=(complex,16,I),("+varstr(S)+",z(1..qq)),dp;");
     591          list l2 = ringlist(S)[2];
     592          for (int ii = 1; ii <= qq; ii++)
     593          {
     594           l2[size(l2)+1] = "z("+string(ii)+")";
     595          }
     596          ring T(qq) = create_ring("(complex,16,I)", l2, "dp");
    582597          list W(qq-1)=var(1);
    583598         }
     
    591606       {
    592607        int w(qq-1);
    593         execute("ring T(qq)=(complex,16,I),("+varstr(S)+",z(1..qq)),dp;");
     608        list l2 = ringlist(S)[2];
     609        for (int ii = 1; ii <= qq; ii++)
     610        {
     611         l2[size(l2)+1] = "z("+string(ii)+")";
     612        }
     613        ring T(qq) = create_ring("(complex,16,I)", l2, "dp");
    594614        list W(qq-1)=var(1);
    595615       }
     
    600620      for(qq=q;qq>=1;qq--)
    601621      {
    602        execute("ring T(qq)=(complex,16,I),("+varstr(S)+",z(1..qq)),dp;");
     622       list l2 = ringlist(S)[2];
     623       for (int ii = 1; ii <= qq; ii++)
     624       {
     625        l2[size(l2)+1] = "z("+string(ii)+")";
     626       }
     627       ring T(qq) = create_ring("(complex,16,I)", l2, "dp");
    603628       list W(qq-1)=var(1);
    604629      }
     
    19511976  export(J(i));
    19521977 }
    1953  execute("ring RR=0,(x(1..n),"+varstr(S)+"),dp;");
     1978 list l2;
     1979 for (int ii = 1; ii <= n; ii++)
     1980 {
     1981  l2[ii] = "x("+string(ii)+")";
     1982 }
     1983 l2 = l2+ringlist(S)[2];
     1984 ring RR = create_ring(0, l2, "dp");
    19541985 for(i=1;i<=d;i++)
    19551986 {
     
    19952026 int zc=size(D(d));
    19962027 export(zc);
    1997  execute("ring DR=0,("+varstr(S)+",x(1..zc)),dp;");
     2028 list l2 = ringlist(S)[2];
     2029 for (int ii = 1; ii <= zc; ii++)
     2030 {
     2031  l2[size(l2)+1] = "x("+string(ii)+")";
     2032 }
     2033 ring DR = create_ring(0, l2, "dp");
    19982034 matrix TT(d)=imap(R,TT(d));
    19992035 ideal I=imap(S,I);
  • Singular/LIB/resolve.lib

    rfa1cd3 r78eaa8  
    396396            laM=subst(laM,var(templist[4][j]),0);
    397397         }
    398          execute("ring Rnew=("+charstr(basering)+"),("+string(templist[1])+"),dp;");
     398         ring Rnew = create_ring(ringlist(basering)[1], "("+string(templist[1])+")", "dp", "no_minpoly");
    399399         ideal Jnew=imap(R,Jsub);
    400400         ideal eD=imap(R,Esub);
     
    639639         v=N[4];
    640640         for(j=1;j<=size(v);j++){BO[5]=subst(BO[5],var(v[j]),0);}
    641          execute("ring R1=("+charstr(R0)+"),("+newvar+"),dp;");
     641         ring R1 = create_ring(ringlist(R0)[1], "("+newvar+")", "dp", "no_minpoly");
    642642         list BO=imap(R0,BO);
    643643         ideal C=imap(R0,C);
     
    11151115              laM=subst(laM,var(v[j]),0);
    11161116           }
    1117            execute("ring R2=("+charstr(S)+"),("+newvar+"),dp;");
     1117           ring R2 = create_ring(ringlist(S)[1], "("+newvar+")", "dp", "no_minpoly");
    11181118           list BO=imap(S,B);
    11191119           ideal laM=imap(S,laM);
     
    29842984//--- hypersurface is V(@f)
    29852985       @f=Jb[fvec[i]];
    2986        execute("ring R1=("+charstr(R)+"),(@y,"+varstr(R)+"),dp;");
     2986       ring R1 = create_ring(ringlist(R)[1], "(@y,"+varstr(R)+")", "dp", "no_minpoly");
    29872987       poly p=imap(R,@p);
    29882988       poly f=imap(R,@f);
     
    42334233             kill tr,L;
    42344234          }
    4235           execute("ring R1=("+charstr(S)+"),(@z,"+varstr(S)+"),dp;");
     4235          ring R1 = create_ring(ringlist(S)[1], "(@z,"+varstr(S)+")", "dp", "no_minpoly");
    42364236          poly p=imap(S,@p);
    42374237          list BO=imap(S,BO);
     
    48004800      {
    48014801         string newvar=string(N[1]);
    4802          execute("ring R1=("+charstr(R)+"),("+newvar+"),dp;");
     4802         ring R1 = create_ring(ringlist(R)[1], "("+newvar+")", "dp", "no_minpoly");
    48034803         list BO=imap(R,BO);
    48044804         ideal cent=imap(R,cent);
  • Singular/LIB/rinvar.lib

    rfa1cd3 r78eaa8  
    658658          minPoly = string(minpoly);
    659659        }
    660         execute("ring RA1=0,(" + varstr(basering) + "," + parName + "), lp;");
     660        ring RA1 = create_ring(0, "(" + varstr(basering) + "," + parName + ")", "lp");
    661661        if (minPoly!="0") { execute("ideal mpoly = std(" + minPoly + ");"); }
    662662        ideal I = imap(RIRR,invarsGens);
     
    962962    minPoly = string(minpoly);
    963963  }
    964   execute("ring RA1=0,(" + varstr(basering) + "," + parName + "), lp;");
     964  ring RA1 = create_ring(0, "(" + varstr(basering) + "," + parName + ")", "lp");
    965965  if (minPoly!="0") { execute("ideal mpoly = std(" + minPoly + ");"); }
    966966  ideal Grp = imap(ROBR,Grp);
  • Singular/LIB/sing.lib

    rfa1cd3 r78eaa8  
    10761076  int ii;
    10771077  def bas = basering;
    1078   execute("ring  @r_locstd
    1079      =("+charstr(bas)+"),(@t@,"+varstr(bas)+"),(dp(1),dp);");
     1078  ring @r_locstd = create_ring(ringlist(bas)[1], "(@t@,"+varstr(bas)+")", "(dp(1),dp)", "no_minpoly");
    10801079  ideal @id = imap(bas,id);
    10811080  ideal @hid = homog(@id,@t@);
  • Singular/LIB/standard.lib

    rfa1cd3 r78eaa8  
    25722572{
    25732573  string name;
    2574   intvec w;
    25752574  int b1 = find(ordering, "(", 1);
    25762575  if (b1 == 0)   // no parentheses
     
    25792578    if (name == "C" || name == "c")
    25802579    {
    2581       w = intvec(0);
     2580      intvec w = intvec(0);
    25822581    }
    25832582    else
    25842583    {
    2585       w = 1:n_vars;
     2584      intvec w = 1:n_vars;
    25862585    }
    25872586  }
     
    25932592    if (c == 0)
    25942593    {
    2595       w = 1:int(ordering[b1+1, b2-b1-1]);
     2594      if (name == "L")
     2595      {
     2596        int w = int(ordering[b1+1, b2-b1-1]);
     2597      }
     2598      else
     2599      {
     2600        intvec w = 1:int(ordering[b1+1, b2-b1-1]);
     2601      }
    25962602    }
    25972603    else
    25982604    {
    25992605      list W = tuple_to_tokens(ordering[b1, b2-b1+1]);
    2600       w = intvec(int(W[1..size(W)]));
     2606      intvec w = intvec(int(W[1..size(W)]));
    26012607    }
    26022608  }
  • Singular/LIB/tropical.lib

    rfa1cd3 r78eaa8  
    36443644  CHARAKTERISTIK=CHARAKTERISTIK[1..size(CHARAKTERISTIK)-2];
    36453645  def BASERING=basering;
    3646   execute("ring INITIALRING=("+CHARAKTERISTIK+"),("+varstr(basering)+"),("+ordstr(basering)+");");
     3646  ring INITIALRING = create_ring("("+CHARAKTERISTIK+")", "("+varstr(basering)+")", "("+ordstr(basering)+")");
    36473647  list l=solve(imap(BASERING,i));
    36483648  l;
     
    55515551      setring LIFTRing;
    55525552      poly mp=minpoly;
    5553       execute("ring TESTRing=("+charstr(LIFTRing)+"),("+varstr(BASERING)+"),dp;");
     5553      ring TESTRing = create_ring(ringlist(LIFTRing)[1], "("+varstr(BASERING)+")", "dp", "no_minpoly");
    55545554      minpoly=number(imap(LIFTRing,mp));
    55555555      ideal i=imap(BASERING,i);
     
    59395939        else
    59405940        {
    5941           execute("ring PARARing=("+charstr(basering)+"),t,ls;");
     5941          ring PARARing = create_ring(ringlist(basering)[1], "t", "ls", "no_minpoly");
    59425942        }
    59435943        ideal PARA; // will contain the parametrisation
     
    62006200        else
    62016201        {
    6202           execute("ring SATURATERING=("+charstr(basering)+"),("+varstr(basering)+"),("+ordstr(basering)+");");
     6202          ring SATURATERING = create_ring(ringlist(basering)[1], "("+varstr(basering)+")", "("+ordstr(basering)+")", "no_minpoly");
    62036203          ideal i=imap(BASERING,i);
    62046204          export(i);
     
    63416341  // - the variable t is superflous,
    63426342  // the variable @a is not if it was already present
    6343   execute("ring INITIALRING=("+charstr(basering)+"),("+string(variablen)+"),dp;");
     6343  ring INITIALRING = create_ring(ringlist(basering)[1], "("+string(variablen)+")", "dp", "no_minpoly");
    63446344  ideal ini=imap(BASERING,ini);
    63456345  // compute the minimal associated primes of the
     
    63676367      // define the extension ring which contains
    63686368      // 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));");
     6369      ring EXTENSIONRING = create_ring(ringlist(BASERING)[1], "("+string(imap(BASERING,variablen))+",@a,"+tvar+")", "(dp("+string(anzahlvariablen-1)+"),dp(1),lp(1))", "no_minpoly");
    63706370      // phi maps x_i to x_i, @a to @a (if present in the ring),
    63716371      // and the additional variable
     
    63786378    else // @a was already present in the BASERING or no
    63796379    { // field extension is necessary
    6380       execute("ring EXTENSIONRING=("+charstr(BASERING)+"),("+varstr(BASERING)+"),("+ordstr(BASERING)+");");
     6380      ring EXTENSIONRING = create_ring(ringlist(BASERING)[1], "("+varstr(BASERING)+")", "("+ordstr(BASERING)+")", "no_minpoly");
    63816381      // phi maps x_i to x_i, @a to @a (if present in the ring),
    63826382      // and the additional variable
     
    72557255{
    72567256  def BASERING=basering;
    7257   execute("ring INTERRING=0,("+varstr(basering)+"),("+ordstr(basering)+");");
     7257  ring INTERRING = create_ring(0, "("+varstr(basering)+")", "("+ordstr(basering)+")");
    72587258  poly n=imap(BASERING,n);
    7259   execute("ring REALRING=(real,50,100),("+varstr(basering)+"),("+ordstr(basering)+");");
     7259  ring REALRING = create_ring("(real,50,100)", "("+varstr(basering)+")", "("+ordstr(basering)+")");
    72607260  map phi=INTERRING,maxideal(1);
    72617261  string s=string(phi(n));
     
    78737873  {
    78747874    def BASERING=basering;
    7875     execute("ring TRING="+string(char(BASERING))+",t,ds;");
     7875    ring TRING = create_ring(string(char(BASERING)), "t", "ds");
    78767876    poly hn=imap(BASERING,hn);
    78777877    poly c4=imap(BASERING,c4);
  • factory/FLINTconvert.cc

    rcbb89a7 r78eaa8  
    2424#include "singext.h"
    2525#include "cf_algorithm.h"
     26
     27#ifdef HAVE_OMALLOC
     28#define Alloc(L) omAlloc(L)
     29#define Free(A,L) omFreeSize(A,L)
     30#else
     31#define Alloc(L) malloc(L)
     32#define Free(A,L) free(A)
     33#endif
    2634
    2735#ifdef HAVE_FLINT
     
    5361#include <flint/fq_nmod_mat.h>
    5462#endif
     63#if ( __FLINT_RELEASE >= 20503)
     64#include <flint/fmpq_mpoly.h>
     65#endif
    5566#ifdef __cplusplus
    5667}
     
    152163  if (f.isImm ())
    153164  {
    154     fmpz_set_si (fmpq_numref (result), f.num().intval());
    155     fmpz_set_si (fmpq_denref (result), f.den().intval());
    156   }
    157   else
     165    fmpz_set_si (fmpq_numref (result), f.intval());
     166    fmpz_set_si (fmpq_denref (result), 1);
     167  }
     168  else if(f.inQ())
    158169  {
    159170    mpz_t gmp_val;
     
    165176    mpz_clear (gmp_val);
    166177  }
     178  else if(f.inZ())
     179  {
     180    mpz_t gmp_val;
     181    f.mpzval(gmp_val);
     182    fmpz_set_mpz (fmpq_numref (result), gmp_val);
     183    mpz_clear (gmp_val);
     184    fmpz_set_si (fmpq_denref (result), 1);
     185  }
     186  else
     187  {
     188    printf("wrong type\n");
     189  }
    167190}
    168191
     
    181204
    182205  CanonicalForm result;
    183   if (mpz_is_imm (nnum) && mpz_is_imm (nden))
    184   {
    185     num= CanonicalForm (mpz_get_si(nnum));
    186     den= CanonicalForm (mpz_get_si(nden));
    187     mpz_clear (nnum);
    188     mpz_clear (nden);
    189     result= num/den;
    190     if (!isRat)
    191       Off (SW_RATIONAL);
    192     return result;
     206  if (mpz_is_imm (nden))
     207  {
     208    if (mpz_is_imm(nnum))
     209    {
     210      num= CanonicalForm (mpz_get_si(nnum));
     211      den= CanonicalForm (mpz_get_si(nden));
     212      mpz_clear (nnum);
     213      mpz_clear (nden);
     214      result= num/den;
     215    }
     216    else if (mpz_cmp_si(nden,1)==0)
     217    {
     218      result= make_cf(nnum);
     219      mpz_clear (nden);
     220    }
     221    else
     222      result= make_cf (nnum, nden, false);
    193223  }
    194224  else
    195225  {
    196226    result= make_cf (nnum, nden, false);
    197     if (!isRat)
    198       Off (SW_RATIONAL);
    199     return result;
    200   }
     227  }
     228  if (!isRat)
     229    Off (SW_RATIONAL);
     230  return result;
    201231}
    202232
     
    528558}
    529559#endif
    530 
    531 #endif
    532 
    533 
     560#if __FLINT_RELEASE >= 20503
     561static void convFlint_RecPP ( const CanonicalForm & f, ulong * exp, nmod_mpoly_t result, nmod_mpoly_ctx_t ctx, int N )
     562{
     563  // assume f!=0
     564  if ( ! f.inCoeffDomain() )
     565  {
     566    int l = f.level();
     567    for ( CFIterator i = f; i.hasTerms(); i++ )
     568    {
     569      exp[N-l] = i.exp();
     570      convFlint_RecPP( i.coeff(), exp, result, ctx, N );
     571    }
     572    exp[N-l] = 0;
     573  }
     574  else
     575  {
     576    int c=f.intval();
     577    if (c<0) c+=getCharacteristic();
     578    nmod_mpoly_push_term_ui_ui(result,c,exp,ctx);
     579  }
     580}
     581
     582static void convFlint_RecPP ( const CanonicalForm & f, ulong * exp, fmpq_mpoly_t result, fmpq_mpoly_ctx_t ctx, int N )
     583{
     584  // assume f!=0
     585  if ( ! f.inBaseDomain() )
     586  {
     587    int l = f.level();
     588    for ( CFIterator i = f; i.hasTerms(); i++ )
     589    {
     590      exp[N-l] = i.exp();
     591      convFlint_RecPP( i.coeff(), exp, result, ctx, N );
     592    }
     593    exp[N-l] = 0;
     594  }
     595  else
     596  {
     597    fmpq_t c;
     598    fmpq_init(c);
     599    convertCF2Fmpq(c,f);
     600    fmpq_mpoly_push_term_fmpq_ui(result,c,exp,ctx);
     601    fmpq_clear(c);
     602  }
     603}
     604
     605void convFactoryPFlintMP ( const CanonicalForm & f, nmod_mpoly_t res, nmod_mpoly_ctx_t ctx, int N )
     606{
     607  if (f.isZero()) return;
     608  ulong * exp = (ulong*)Alloc(N*sizeof(ulong));
     609  memset(exp,0,N*sizeof(ulong));
     610  convFlint_RecPP( f, exp, res, ctx, N );
     611  Free(exp,N*sizeof(ulong));
     612}
     613
     614void convFactoryPFlintMP ( const CanonicalForm & f, fmpq_mpoly_t res, fmpq_mpoly_ctx_t ctx, int N )
     615{
     616  if (f.isZero()) return;
     617  ulong * exp = (ulong*)Alloc(N*sizeof(ulong));
     618  memset(exp,0,N*sizeof(ulong));
     619  convFlint_RecPP( f, exp, res, ctx, N );
     620  fmpq_mpoly_reduce(res,ctx);
     621  Free(exp,N*sizeof(ulong));
     622}
     623
     624CanonicalForm convFlintMPFactoryP(nmod_mpoly_t f, nmod_mpoly_ctx_t ctx, int N)
     625{
     626  CanonicalForm result;
     627  int d=nmod_mpoly_length(f,ctx)-1;
     628  ulong* exp=(ulong*)Alloc(N*sizeof(ulong));
     629  for(int i=d; i>=0; i--)
     630  {
     631    ulong c=nmod_mpoly_get_term_coeff_ui(f,i,ctx);
     632    nmod_mpoly_get_term_exp_ui(exp,f,i,ctx);
     633    CanonicalForm term=(int)c;
     634    for ( int i = 0; i <N; i++ )
     635    {
     636      if (exp[i]!=0) term*=CanonicalForm( Variable( N-i ), exp[i] );
     637    }
     638    result+=term;
     639  }
     640  Free(exp,N*sizeof(ulong));
     641  return result;
     642}
     643
     644CanonicalForm convFlintMPFactoryP(fmpq_mpoly_t f, fmpq_mpoly_ctx_t ctx, int N)
     645{
     646  CanonicalForm result;
     647  int d=fmpq_mpoly_length(f,ctx)-1;
     648  ulong* exp=(ulong*)Alloc(N*sizeof(ulong));
     649  fmpq_t c;
     650  fmpq_init(c);
     651  for(int i=d; i>=0; i--)
     652  {
     653    fmpq_mpoly_get_term_coeff_fmpq(c,f,i,ctx);
     654    fmpq_mpoly_get_term_exp_ui(exp,f,i,ctx);
     655    CanonicalForm term=convertFmpq_t2CF(c);
     656    for ( int i = 0; i <N; i++ )
     657    {
     658      if (exp[i]!=0) term*=CanonicalForm( Variable( N-i ), exp[i] );
     659    }
     660    result+=term;
     661  }
     662  fmpq_clear(c);
     663  Free(exp,N*sizeof(ulong));
     664  return result;
     665}
     666
     667// stolen from:
     668// https://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
     669static inline int SI_LOG2(int v)
     670{
     671  const unsigned int b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
     672  const unsigned int S[] = {1, 2, 4, 8, 16};
     673
     674  unsigned int r = 0; // result of log2(v) will go here
     675  if (v & b[4]) { v >>= S[4]; r |= S[4]; }
     676  if (v & b[3]) { v >>= S[3]; r |= S[3]; }
     677  if (v & b[2]) { v >>= S[2]; r |= S[2]; }
     678  if (v & b[1]) { v >>= S[1]; r |= S[1]; }
     679  if (v & b[0]) { v >>= S[0]; r |= S[0]; }
     680  return (int)r;
     681}
     682
     683CanonicalForm mulFlintMP_Zp(const CanonicalForm& F,int lF, const CanonicalForm& G, int lG,int m)
     684{
     685  int bits=SI_LOG2(m)+1;
     686  int N=F.level();
     687  nmod_mpoly_ctx_t ctx;
     688  nmod_mpoly_ctx_init(ctx,N,ORD_LEX,getCharacteristic());
     689  nmod_mpoly_t f,g,res;
     690  nmod_mpoly_init3(f,lF,bits,ctx);
     691  nmod_mpoly_init3(g,lG,bits,ctx);
     692  convFactoryPFlintMP(F,f,ctx,N);
     693  convFactoryPFlintMP(G,g,ctx,N);
     694  nmod_mpoly_init3(res,lF+lG,bits+1,ctx);
     695  nmod_mpoly_mul(res,f,g,ctx);
     696  nmod_mpoly_clear(g,ctx);
     697  nmod_mpoly_clear(f,ctx);
     698  CanonicalForm RES=convFlintMPFactoryP(res,ctx,N);
     699  nmod_mpoly_clear(res,ctx);
     700  nmod_mpoly_ctx_clear(ctx);
     701  return RES;
     702}
     703
     704CanonicalForm mulFlintMP_QQ(const CanonicalForm& F,int lF, const CanonicalForm& G, int lG, int m)
     705{
     706  int bits=SI_LOG2(m)+1;
     707  int N=F.level();
     708  fmpq_mpoly_ctx_t ctx;
     709  fmpq_mpoly_ctx_init(ctx,N,ORD_LEX);
     710  fmpq_mpoly_t f,g,res;
     711  fmpq_mpoly_init3(f,lF,bits,ctx);
     712  fmpq_mpoly_init3(g,lG,bits,ctx);
     713  convFactoryPFlintMP(F,f,ctx,N);
     714  convFactoryPFlintMP(G,g,ctx,N);
     715  fmpq_mpoly_init3(res,lF+lG,bits+1,ctx);
     716  fmpq_mpoly_mul(res,f,g,ctx);
     717  fmpq_mpoly_clear(g,ctx);
     718  fmpq_mpoly_clear(f,ctx);
     719  CanonicalForm RES=convFlintMPFactoryP(res,ctx,N);
     720  fmpq_mpoly_clear(res,ctx);
     721  fmpq_mpoly_ctx_clear(ctx);
     722  return RES;
     723}
     724
     725CanonicalForm gcdFlintMP_Zp(const CanonicalForm& F, const CanonicalForm& G)
     726{
     727  int N=F.level();
     728  int lf,lg,m=1<<MPOLY_MIN_BITS;
     729  lf=size_maxexp(F,m);
     730  lg=size_maxexp(G,m);
     731  int bits=SI_LOG2(m)+1;
     732  nmod_mpoly_ctx_t ctx;
     733  nmod_mpoly_ctx_init(ctx,N,ORD_LEX,getCharacteristic());
     734  nmod_mpoly_t f,g,res;
     735  nmod_mpoly_init3(f,lf,bits,ctx);
     736  nmod_mpoly_init3(g,lg,bits,ctx);
     737  convFactoryPFlintMP(F,f,ctx,N);
     738  convFactoryPFlintMP(G,g,ctx,N);
     739  nmod_mpoly_init3(res,lf,bits,ctx);
     740  int ok=nmod_mpoly_gcd(res,f,g,ctx);
     741  nmod_mpoly_clear(g,ctx);
     742  nmod_mpoly_clear(f,ctx);
     743  CanonicalForm RES=1;
     744  if (ok)
     745  {
     746    RES=convFlintMPFactoryP(res,ctx,N);
     747  }
     748  nmod_mpoly_clear(res,ctx);
     749  nmod_mpoly_ctx_clear(ctx);
     750  return RES;
     751}
     752
     753CanonicalForm gcdFlintMP_QQ(const CanonicalForm& F, const CanonicalForm& G)
     754{
     755  int N=F.level();
     756  fmpq_mpoly_ctx_t ctx;
     757  fmpq_mpoly_ctx_init(ctx,N,ORD_LEX);
     758  fmpq_mpoly_t f,g,res;
     759  fmpq_mpoly_init(f,ctx);
     760  fmpq_mpoly_init(g,ctx);
     761  convFactoryPFlintMP(F,f,ctx,N);
     762  convFactoryPFlintMP(G,g,ctx,N);
     763  fmpq_mpoly_init(res,ctx);
     764  int ok=fmpq_mpoly_gcd(res,f,g,ctx);
     765  fmpq_mpoly_clear(g,ctx);
     766  fmpq_mpoly_clear(f,ctx);
     767  CanonicalForm RES=1;
     768  if (ok)
     769  {
     770    // Flint normalizes the gcd to be monic.
     771    // Singular wants a gcd defined over ZZ that is primitive and has a positive leading coeff.
     772    if (!fmpq_mpoly_is_zero(res, ctx))
     773    {
     774      fmpq_t content;
     775      fmpq_init(content);
     776      fmpq_mpoly_content(content, res, ctx);
     777      fmpq_mpoly_scalar_div_fmpq(res, res, content, ctx);
     778      fmpq_clear(content);
     779    }
     780    RES=convFlintMPFactoryP(res,ctx,N);
     781  }
     782  fmpq_mpoly_clear(res,ctx);
     783  fmpq_mpoly_ctx_clear(ctx);
     784  return RES;
     785}
     786
     787#endif
     788
     789#endif
     790
     791
  • factory/FLINTconvert.h

    rcbb89a7 r78eaa8  
    250250
    251251
    252 #endif
    253 #endif
     252#if __FLINT_RELEASE >= 20503
     253CanonicalForm mulFlintMP_Zp(const CanonicalForm& F,int lF, const CanonicalForm& Gi, int lG, int m);
     254CanonicalForm mulFlintMP_QQ(const CanonicalForm& F,int lF, const CanonicalForm& Gi, int lG, int m);
     255CanonicalForm gcdFlintMP_Zp(const CanonicalForm& F, const CanonicalForm& G);
     256CanonicalForm gcdFlintMP_QQ(const CanonicalForm& F, const CanonicalForm& G);
     257#endif
     258#endif
     259#endif
  • factory/NTLconvert.cc

    rcbb89a7 r78eaa8  
    3333#include "NTLconvert.h"
    3434
     35#ifdef HAVE_OMALLOC
     36#define Alloc(L) omAlloc(L)
     37#define Free(A,L) omFreeSize(A,L)
     38#else
    3539#define Alloc(L) malloc(L)
    3640#define Free(A,L) free(A)
     41#endif
    3742
    3843void out_cf(const char *s1,const CanonicalForm &f,const char *s2);
  • factory/canonicalform.cc

    rcbb89a7 r78eaa8  
    1717#include "gfops.h"
    1818#include "facMul.h"
     19#include "facAlgFuncUtil.h"
    1920#include "FLINTconvert.h"
    2021
     
    707708    else  if ( value->level() == cf.value->level() ) {
    708709#if (HAVE_NTL && HAVE_FLINT && __FLINT_RELEASE >= 20400)
     710#if (__FLINT_RELEASE >= 20503)
     711        int l_this,l_cf,m=1;
     712        if ((getCharacteristic()>0)
     713        && (CFFactory::gettype() != GaloisFieldDomain)
     714        &&(!hasAlgVar(*this))
     715        &&(!hasAlgVar(cf))
     716        &&((l_cf=size_maxexp(cf,m))>10)
     717        &&((l_this=size_maxexp(*this,m))>10)
     718        )
     719        {
     720          *this=mulFlintMP_Zp(*this,l_this,cf,l_cf,m);
     721        }
     722        else
     723        /*-----------------------------------------------------*/
     724        if ((getCharacteristic()==0)
     725        &&(!hasAlgVar(*this))
     726        &&(!hasAlgVar(cf))
     727        &&((l_cf=size_maxexp(cf,m))>10)
     728        &&((l_this=size_maxexp(*this,m))>10)
     729        )
     730        {
     731          *this=mulFlintMP_QQ(*this,l_this,cf,l_cf,m);
     732        }
     733        else
     734#endif
     735
    709736        if (value->levelcoeff() == cf.value->levelcoeff() && cf.isUnivariate() && (*this).isUnivariate())
    710737        {
  • factory/cf_gcd.cc

    rcbb89a7 r78eaa8  
    2626#include "cfSubResGcd.h"
    2727#include "cfModGcd.h"
     28#include "FLINTconvert.h"
    2829#include "facAlgFuncUtil.h"
    2930
     
    100101  if ( getCharacteristic() != 0 )
    101102  {
     103    #if defined(HAVE_FLINT) && ( __FLINT_RELEASE >= 20503)
     104    if ( isOn( SW_USE_FL_GCD_P)
     105    && (CFFactory::gettype() != GaloisFieldDomain)
     106    && (getCharacteristic()>500)
     107    &&(!hasAlgVar(fc)) && (!hasAlgVar(gc)))
     108    {
     109      return gcdFlintMP_Zp(fc,gc);
     110    }
     111    #endif
    102112    #ifdef HAVE_NTL
    103113    if ((!fc_and_gc_Univariate) && (isOn( SW_USE_EZGCD_P )))
     
    119129    fc = subResGCD_p( fc, gc );
    120130  }
    121   else if (!fc_and_gc_Univariate)
     131  else if (!fc_and_gc_Univariate) /* && char==0*/
    122132  {
     133    #if defined(HAVE_FLINT) && ( __FLINT_RELEASE >= 20503)
     134    if (( isOn( SW_USE_FL_GCD_0) )
     135    &&(!hasAlgVar(fc)) && (!hasAlgVar(gc)))
     136    {
     137      return gcdFlintMP_QQ(fc,gc);
     138    }
     139    else
     140    #endif
    123141    if ( isOn( SW_USE_EZGCD ) )
    124142      fc= ezgcd (fc, gc);
    125 #ifdef HAVE_NTL
     143    #ifdef HAVE_NTL
    126144    else if (isOn(SW_USE_CHINREM_GCD))
    127145      fc = modGCDZ( fc, gc);
    128 #endif
     146    #endif
    129147    else
    130148    {
Note: See TracChangeset for help on using the changeset viewer.