Changeset 9102bb in git


Ignore:
Timestamp:
Aug 6, 2019, 3:21:38 PM (4 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
Children:
695288e2d57e72ad6969a3bdcc02d8d019857a56
Parents:
48f20b0402356f0f7fa136772209441b8b6d869cf006a1a0d5b28b1d503bf27a7ce5902096a20eba
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2019-08-06 15:21:38+02:00
git-committer:
GitHub <noreply@github.com>2019-08-06 15:21:38+02:00
Message:
Merge pull request #944 from kabouzeid/lp_syzygies

Lp syzygies (work in progress)
Files:
51 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/algebra.lib

    rf006a1 r9102bb  
    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

    rf006a1 r9102bb  
    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

    rf006a1 r9102bb  
    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/ellipticcovers.lib

    rf006a1 r9102bb  
    6767
    6868
    69 proc mod_init()
    70 {
    71 newstruct("graph","list vertices, list edges");
    72 newstruct("Net","list rows");
    73 
    74 system("install","graph","print",printGraph,1);
    75 system("install","Net","print",printNet,1);
    76 system("install","Net","+",catNet,2);
    77 
    78 }
    79 
     69static proc mod_init()
     70{
     71  newstruct("graph","list vertices, list edges");
     72  newstruct("Net","list rows");
     73
     74  system("install","graph","print",printGraph,1);
     75  system("install","Net","print",printNet,1);
     76  system("install","Net","+",catNet,2);
     77}
    8078
    8179static proc catNet(Net N, Net M)
    8280{
    83 list L;
    84 list LN=N.rows;
    85 list LM=M.rows;
    86 int widthN=size(LN[1]);
    87 int widthM=size(LM[1]);
    88 int nm=max(size(LN),size(LM));
    89 for (int j=1; j<=nm; j++)
    90 {
     81  list L;
     82  list LN=N.rows;
     83  list LM=M.rows;
     84  int widthN=size(LN[1]);
     85  int widthM=size(LM[1]);
     86  int nm=max(size(LN),size(LM));
     87  for (int j=1; j<=nm; j++)
     88  {
    9189    if (j>size(LN)){LN[j]=emptyString(widthN);}
    9290    if (j>size(LM)){LM[j]=emptyString(widthM);}
    9391    L[j]=LN[j]+LM[j];
    94 }
    95 Net NM;
    96 NM.rows=L;
    97 return(NM);}
     92  }
     93  Net NM;
     94  NM.rows=L;
     95  return(NM);
     96}
    9897
    9998
     
    111110static proc printNet(Net N)
    112111{
    113 list L = N.rows;
    114 for (int j=1; j<=size(L); j++)
    115 {
    116    print(L[j]);
    117 }
    118 }
    119 
    120 static proc net(def M){
    121   if (typeof(M)=="list"){
     112  list L = N.rows;
     113  for (int j=1; j<=size(L); j++)
     114  {
     115    print(L[j]);
     116  }
     117}
     118
     119static proc net(def M)
     120{
     121  if (typeof(M)=="list")
     122  {
    122123    return(netList(M));
    123124  }
     
    126127  L[1]=string(M);
    127128  N.rows=L;
    128 return(N);}
     129  return(N);
     130}
    129131
    130132
     
    147149  G;
    148150}
    149 
    150 
    151151
    152152proc makeGraph(list v, list e)
     
    170170  G;
    171171}
    172 
    173172
    174173proc propagator(def xy, def d)
     
    195194"
    196195{
    197   if ((typeof(xy)=="list")||(typeof(d)=="int")) {
     196  if ((typeof(xy)=="list")||(typeof(d)=="int"))
     197  {
    198198    number x = xy[1];
    199199    number y = xy[2];
     
    201201    if (d==0) {return(x^2*y^2/(x^2-y^2)^2);}
    202202    number p=0;
    203     for (int j=1; j<=d; j++){
     203    for (int j=1; j<=d; j++)
     204    {
    204205       if (d%j==0){p=p+(j*x^(4*j)+j*y^(4*j))/(x*y)^(2*j);}
    205206    }
    206207    return(p);
    207208  }
    208   if ((typeof(xy)=="graph")||(typeof(d)=="list"))  {
     209  if ((typeof(xy)=="graph")||(typeof(d)=="list"))
     210  {
    209211    list xl = ringlist(basering)[1][2];
    210212    list ed = xy.edges;
    211213    number f=1;
    212     for (int j=1; j<=size(ed); j++){
     214    for (int j=1; j<=size(ed); j++)
     215    {
    213216       execute("number xx1 = "+xl[ed[j][1]]);
    214217       execute("number xx2 = "+xl[ed[j][2]]);
     
    219222    return(f);
    220223  }
    221   if ((typeof(xy)=="graph")||(typeof(d)=="int"))  {
    222   }
    223 ERROR("wrong input type");}
     224  if ((typeof(xy)=="graph")||(typeof(d)=="int"))
     225  {
     226  }
     227  ERROR("wrong input type");
     228}
    224229example
    225230{ "EXAMPLE:"; echo=2;
     
    230235  propagator(G,list(1,1,1,0,0,0));
    231236}
    232 
    233 
    234 
    235 
    236237
    237238proc computeConstant(number f,number xx)
     
    240241RETURN:  number, the constant coefficient of the Laurent series of f in the variable x.
    241242THEORY:  Computes the constant coefficient of the Laurent series by iterative differentiation.
    242 
    243243KEYWORDS: Laurent series
    244244EXAMPLE:  example computeConstant; shows an example
     
    250250  int j;
    251251  poly de;
    252   while (tst==0){
    253      ff=f*xx^k;
    254      for (j=1; j<=k; j++){
    255         ff=diff(ff,xx)/j;
    256      }
    257   de = subst(denominator(ff),xx,0);
    258   if (de!=0){
    259      poly nu = subst(numerator(ff),xx,0);
    260      return(number(nu/de));
    261   }
    262   k=k+1;
    263   }
    264 ERROR("error in computeConstant");}
     252  while (tst==0)
     253  {
     254    ff=f*xx^k;
     255    for (j=1; j<=k; j++)
     256    {
     257      ff=diff(ff,xx)/j;
     258    }
     259    de = subst(denominator(ff),xx,0);
     260    if (de!=0)
     261    {
     262      poly nu = subst(numerator(ff),xx,0);
     263      return(number(nu/de));
     264    }
     265    k++;
     266  }
     267  ERROR("error in computeConstant");
     268}
    265269example
    266270{ "EXAMPLE:"; echo=2;
     
    270274  computeConstant(P,x2);
    271275}
    272 
    273 
    274 
    275276
    276277proc evaluateIntegral(number P, list xL)
     
    289290{
    290291  number p = P;
    291   for(int j=1; j<=size(xL); j++){
     292  for(int j=1; j<=size(xL); j++)
     293  {
    292294     p=computeConstant(p,xL[j]);
    293295  }
    294 return(p);}
     296  return(p);
     297}
    295298example
    296299{ "EXAMPLE:"; echo=2;
     
    300303  evaluateIntegral(p,list(x1,x3,x4,x2));
    301304}
    302 
    303305
    304306proc permute (list N)
     
    314316"
    315317{
    316    int i,j,k;
    317    list L,L1;
    318    if (size(N)==1){
    319      return(list(N));
    320    } else {
    321      k=1;
    322      for (i=1; i<=size(N); i++){
    323        L=permute(delete(N,i));
    324        for (j=1; j<=size(L); j++){
    325           L1[k]=L[j]+list(N[i]);
    326           k=k+1;
    327        }
    328      }
    329    }
    330 return(L1);}
     318  int i,j,k;
     319  list L,L1;
     320  if (size(N)==1)
     321  {
     322    return(list(N));
     323  }
     324  else
     325  {
     326    k=1;
     327    for (i=1; i<=size(N); i++)
     328    {
     329      L=permute(delete(N,i));
     330      for (j=1; j<=size(L); j++)
     331      {
     332        L1[k]=L[j]+list(N[i]);
     333        k=k+1;
     334      }
     335    }
     336  }
     337  return(L1);
     338}
    331339example
    332340{ "EXAMPLE:"; echo=2;
     
    349357"
    350358{
    351 ring R = 2,(x(1..n)),dp;
    352 ideal I = maxideal(a);
    353 list L;
    354 for (int j=1;j<=size(I);j++){
    355   L[j]=leadexp(I[j]);
    356 }
    357 return(L);}
     359  ring R = 2,(x(1..n)),dp;
     360  ideal I = maxideal(a);
     361  list L;
     362  for (int j=1;j<=size(I);j++)
     363  {
     364    L[j]=leadexp(I[j]);
     365  }
     366  return(L);
     367}
    358368example
    359369{ "EXAMPLE:"; echo=2;
    360370  partitions(3,7);
    361371}
    362 
    363 
    364372
    365373proc gromovWitten(def P,list #)
     
    385393"
    386394{
    387   if (typeof(P)=="number") {
    388   list xl = ringlist(basering)[1][2];
    389   int j;
    390   for(j=1; j<=size(xl); j++){
    391      execute("number n= "+xl[j]);
    392      xl[j]=n;
    393      kill n;
    394   }
    395   list pxl = permute(xl);
    396   number p = 0;
    397   for(j=1; j<=size(pxl); j++){
    398      p=p+evaluateIntegral(P,pxl[j]);
    399   }
    400   return(p);
    401   }
    402   if (typeof(P)=="graph"){
    403      if (size(#)>1){
    404        return(gromovWitten(propagator(P,#)));
    405      } else {
     395  if (typeof(P)=="number")
     396  {
     397    list xl = ringlist(basering)[1][2];
     398    int j;
     399    for(j=1; j<=size(xl); j++)
     400    {
     401      execute("number n= "+xl[j]);
     402      xl[j]=n;
     403      kill n;
     404    }
     405    list pxl = permute(xl);
     406    number p = 0;
     407    for(j=1; j<=size(pxl); j++)
     408    {
     409      p=p+evaluateIntegral(P,pxl[j]);
     410    }
     411    return(p);
     412  }
     413  if (typeof(P)=="graph")
     414  {
     415    if (size(#)>1)
     416    {
     417      return(gromovWitten(propagator(P,#)));
     418    }
     419    else
     420    {
    406421      int d =#[1];
    407422      list pa = partitions(size(P.edges),d);
    408423      list re;
    409424      int ti;
    410       for (int j=1; j<=size(pa); j++) {
    411        ti=timer;
    412        re[j]=gromovWitten(propagator(P,pa[j]));
    413        ti=timer-ti;
    414        //print(string(j)+" / "+string(size(pa))+"    "+string(pa[j])+"     "+string(re[j])+"      "+string(sum(re))+"     "+string(ti));
     425      for (int j=1; j<=size(pa); j++)
     426      {
     427        ti=timer;
     428        re[j]=gromovWitten(propagator(P,pa[j]));
     429        ti=timer-ti;
     430        //print(string(j)+" / "+string(size(pa))+"    "+string(pa[j])+"     "+string(re[j])+"      "+string(sum(re))+"     "+string(ti));
    415431      }
    416      return(lsum(re));
    417      }
     432      return(lsum(re));
     433    }
    418434  }
    419435}
     
    427443  gromovWitten(G,2);
    428444}
    429 
    430 
    431445
    432446proc computeGromovWitten(graph P,int d, int st, int en, list #)
     
    443457"
    444458{
    445      number s =0;
    446      list pararg;
    447      list re;
    448      list pa = partitions(size(P.edges),d);
    449      int vb=0;
    450      if (size(#)>0){vb=#[1];}
    451      int ti;
    452      if (vb>0){print(size(pa));}
    453      for (int j=1; j<=size(pa); j++) {
    454       if ((j>=st)&(j<=en)){
    455        ti=timer;
    456        //pararg[j]=list(propagator(G,pa[j]));
    457        re[j]=gromovWitten(propagator(P,pa[j]));
    458        ti=timer-ti;
    459        if (vb>0){print(string(j)+" / "+string(size(pa))+"    "+string(pa[j])+"     "+string(re[j])+"      "+string(lsum(re))+"     "+string(ti));}
    460       } else {re[j]=s;}
    461      }
    462      //list re = parallelWaitAll("gromovWitten", pararg, list(list(list(2))));
    463      return(re);
     459  number s =0;
     460  list pararg;
     461  list re;
     462  list pa = partitions(size(P.edges),d);
     463  int vb=0;
     464  if (size(#)>0){vb=#[1];}
     465  int ti;
     466  if (vb>0){print(size(pa));}
     467  for (int j=1; j<=size(pa); j++)
     468  {
     469    if ((j>=st)&(j<=en))
     470    {
     471      ti=timer;
     472      //pararg[j]=list(propagator(G,pa[j]));
     473      re[j]=gromovWitten(propagator(P,pa[j]));
     474      ti=timer-ti;
     475      if (vb>0){print(string(j)+" / "+string(size(pa))+"    "+string(pa[j])+"     "+string(re[j])+"      "+string(lsum(re))+"     "+string(ti));}
     476    }
     477    else
     478    {re[j]=s;}
     479  }
     480  //list re = parallelWaitAll("gromovWitten", pararg, list(list(list(2))));
     481  return(re);
    464482}
    465483example
     
    471489  computeGromovWitten(G,2,3,7,1);
    472490}
    473 
    474491
    475492proc lsum(list L)
     
    485502{
    486503  execute(typeof(L[1])+" s");
    487   for(int j=1; j<=size(L); j++){
    488      s=s+L[j];
    489   }
    490 return(s);}
     504  for(int j=1; j<=size(L); j++)
     505  {
     506    s=s+L[j];
     507  }
     508  return(s);
     509}
    491510example
    492511{ "EXAMPLE:"; echo=2;
     
    494513  lsum(L);
    495514}
    496 
    497 
    498515
    499516proc generatingFunction(graph G, int d)
     
    512529  int j,jj;
    513530  list pa,L;
    514   for (j=1; j<=d; j++){
     531  for (j=1; j<=d; j++)
     532  {
    515533    pa = partitions(size(G.edges),j);
    516534    L = computeGromovWitten(G,j,1,size(pa));
    517     for (jj=1; jj<=size(pa); jj++) {
    518        s=s+L[jj]*monomial(pa[jj]);
    519     }
    520   }
    521 return(s);}
     535    for (jj=1; jj<=size(pa); jj++)
     536    {
     537      s=s+L[jj]*monomial(pa[jj]);
     538    }
     539  }
     540  return(s);
     541}
    522542example
    523543{ "EXAMPLE:"; echo=2;
  • Singular/LIB/finvar.lib

    rf006a1 r9102bb  
    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

    rf006a1 r9102bb  
    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

    rf006a1 r9102bb  
    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

    rf006a1 r9102bb  
    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

    rf006a1 r9102bb  
    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

    rf006a1 r9102bb  
    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

    rf006a1 r9102bb  
    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

    rf006a1 r9102bb  
    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

    rf006a1 r9102bb  
    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

    rf006a1 r9102bb  
    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);
  • Singular/dyn_modules/freealgebra/freealgebra.cc

    r48f20b r9102bb  
    55{
    66  const short t1[]={2,RING_CMD,INT_CMD};
    7   if (iiCheckTypes(args,t1,1))
     7  const short t2[]={3,RING_CMD,INT_CMD,INT_CMD};
     8  if (iiCheckTypes(args, t2, 0) || iiCheckTypes(args, t1, 1))
    89  {
    910    ring r=(ring)args->Data();
     
    3233      return TRUE;
    3334    }
    34     ring R=freeAlgebra(r,d);
     35    int ncGenCount = 0;
     36    if (iiCheckTypes(args,t2,0))
     37      ncGenCount = (int)(long) args->next->next->Data();
     38    ring R=freeAlgebra(r,d,ncGenCount);
    3539    res->rtyp=RING_CMD;
    3640    res->data=R;
  • Singular/dyn_modules/python/Makefile.am

    rf006a1 r9102bb  
    5151python_moduledir =  ${datadir}/singular/LIB
    5252python_module_DATA = cart.py  interpreter.py  perf.py  symm.py  util.py
     53EXTRA_DIST=cart.py  interpreter.py  perf.py  symm.py  util.py
  • Singular/dyn_modules/systhreads/Makefile.am

    rf006a1 r9102bb  
    1818endif
    1919
    20 SOURCES = shared.cc lintree.cc bytebuf.cc thread.cc bytebuf.h lintree.h channel.h syncvar.h threadconf.h
     20SOURCES = shared.cc lintree.cc bytebuf.cc thread.cc bytebuf.h lintree.h channel.h syncvar.h threadconf.h thread.h singthreads.h
    2121systhreads_la_SOURCES   = $(SOURCES)
    2222systhreads_la_CPPFLAGS  = ${MYINCLUDES} ${P_PROCS_CPPFLAGS_COMMON}
  • Singular/iparith.cc

    r48f20b r9102bb  
    51535153  ideal v_id=(ideal)v->Data();
    51545154  tHomog hom=testHomog;
     5155#ifdef HAVE_SHIFTBBA
     5156  if (rIsLPRing(currRing))
     5157  {
     5158    if (currRing->LPncGenCount < IDELEMS(v_id))
     5159    {
     5160      Werror("At least %d ncgen variables are needed for this computation.", IDELEMS(v_id));
     5161      return TRUE;
     5162    }
     5163  }
     5164#endif
    51555165  if (ww!=NULL)
    51565166  {
  • Singular/ipshell.cc

    rf006a1 r9102bb  
    22522252//  R->cf->ch=0;
    22532253  // ----------------------------------------
    2254   // 1:
     2254  // 0, (r1,r2) [, "i" ]
    22552255  if (L->m[1].rtyp!=LIST_CMD)
    22562256  {
     
    22592259  }
    22602260  lists LL=(lists)L->m[1].data;
    2261   if (((LL->nr!=2)
     2261  if ((LL->nr!=2)
    22622262    || (LL->m[0].rtyp!=INT_CMD)
    22632263    || (LL->m[1].rtyp!=INT_CMD))
    2264   && ((LL->nr!=1)
    2265     || (LL->m[0].rtyp!=INT_CMD)))
    2266   {
    2267     WerrorS("invalid coeff. field description list");
     2264  {
     2265    WerrorS("invalid coeff. field description list, expected list(`int`,`int`)");
    22682266    return;
    22692267  }
    22702268  int r1=(int)(long)LL->m[0].data;
    22712269  int r2=(int)(long)LL->m[1].data;
     2270  r1=si_min(r1,32767);
     2271  r2=si_min(r2,32767);
     2272  LongComplexInfo par; memset(&par, 0, sizeof(par));
     2273  par.float_len=r1;
     2274  par.float_len2=r2;
    22722275  if (L->nr==2) // complex
    2273     R->cf = nInitChar(n_long_C, NULL);
    2274   else if ((r1<=SHORT_REAL_LENGTH)
    2275   && (r2<=SHORT_REAL_LENGTH))
    2276     R->cf = nInitChar(n_R, NULL);
    2277   else
    2278   {
    2279     LongComplexInfo* p = (LongComplexInfo *)omAlloc0(sizeof(LongComplexInfo));
    2280     p->float_len=r1;
    2281     p->float_len2=r2;
    2282     R->cf = nInitChar(n_long_R, p);
    2283   }
    2284 
    2285   if ((r1<=SHORT_REAL_LENGTH)   // should go into nInitChar
    2286   && (r2<=SHORT_REAL_LENGTH))
    2287   {
    2288     R->cf->float_len=SHORT_REAL_LENGTH/2;
    2289     R->cf->float_len2=SHORT_REAL_LENGTH;
    2290   }
    2291   else
    2292   {
    2293     R->cf->float_len=si_min(r1,32767);
    2294     R->cf->float_len2=si_min(r2,32767);
    2295   }
    2296   // ----------------------------------------
    2297   // 2: list (par)
    2298   if (L->nr==2)
    2299   {
    2300     //R->cf->extRing->N=1;
     2276  {
    23012277    if (L->m[2].rtyp!=STRING_CMD)
    23022278    {
     
    23042280      return;
    23052281    }
    2306     //(rParameter(R))=(char**)omAlloc0(rPar(R)*sizeof(char_ptr));
    2307     rParameter(R)[0]=omStrDup((char *)L->m[2].data);
    2308   }
    2309   // ----------------------------------------
     2282    par.par_name=(char*)L->m[2].data;
     2283    R->cf = nInitChar(n_long_C, &par);
     2284  }
     2285  else if ((r1<=SHORT_REAL_LENGTH) && (r2<=SHORT_REAL_LENGTH)) /* && L->nr==1*/
     2286    R->cf = nInitChar(n_R, NULL);
     2287  else /* && L->nr==1*/
     2288  {
     2289    R->cf = nInitChar(n_long_R, &par);
     2290  }
    23102291}
    23112292
  • Singular/table.h

    r48f20b r9102bb  
    278278,{D(jjSTD),        STD_CMD,         SMATRIX_CMD,    SMATRIX_CMD   , ALLOW_NC |ALLOW_RING}
    279279,{D(jjDUMMY),      STRING_CMD,      STRING_CMD,     STRING_CMD    , ALLOW_NC |ALLOW_RING}
    280 ,{D(jjSYZYGY),     SYZYGY_CMD,      MODUL_CMD,      IDEAL_CMD     , ALLOW_PLURAL |ALLOW_RING}
    281 ,{D(jjSYZYGY),     SYZYGY_CMD,      MODUL_CMD,      MODUL_CMD     , ALLOW_PLURAL |ALLOW_RING}
     280,{D(jjSYZYGY),     SYZYGY_CMD,      MODUL_CMD,      IDEAL_CMD     , ALLOW_NC |ALLOW_RING}
     281,{D(jjSYZYGY),     SYZYGY_CMD,      MODUL_CMD,      MODUL_CMD     , ALLOW_NC |ALLOW_RING}
    282282#ifdef HAVE_PLURAL
    283283,{D(jjENVELOPE),   ENVELOPE_CMD,    RING_CMD,       RING_CMD      , ALLOW_PLURAL |NO_RING}
  • Tst/Short/absfact.res.gz.uu

    rf006a1 r9102bb  
    11begin 640 absfact.res.gz
    2 M'XL("`O%'%T"`V%B<V9A8W0N<F5S`.V<6V_;.!;'W_,IB&*`D2PI(0]OX@3V
    3 MP^QB%P,L]J'IVZ`IY-2>&IM-@EC=2/WT>VC9)%W1M]:=+K9*45OFS1+/__QX
    4 M1)&^>?/7W_Y)"&$3\H_??B6OZF5]>;^8OKJ^N%GG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_PT9E`%>2H<7OBM<*:/ABLA>2E]$]+^087\%X^,R
     48M\<HOY1#'G$51=C5AO(=U%#EE><3`QJ5!`0@%()B!4G(AN9&2FI**DAM-&0BM
     49M\#]C&)%*)3!'"DJ5`HI0\S\^(#C6I4"Q$H966J!0M]/:2)H-IK10HI2*`XY<
     50MBFHF`+_"1M]`M1)&@Z$X4MJJI:"EPI-CI3DA^@*I*E'85UYH;K\'HWAC&*6&
     51MV>D'A6TJ62H&)A+;EX$K/_O;/[L*,VH/PX;([;S2-["KJV-K])D1IVP^1TV8
     52MCKD5QDHKP&XFM=M)J-KC`SV!0JYX)H65M%5R"1&9&;\1@)GPEX!6TUWYI]6$
     53MUY:`7I-D5^'4M;C>_3/'0JU`@!<MC!)6-!!TYZ[=0/-3XL"!UK8K363B"^A)
     54M,[5VKK(513?<'JNU[<$>*(OLUP8*`Z7.:G*@,1@!%=_#Y)XE0)$E`3Q9>OW3
     55+Q7\!?:#A?_%,````
    5656`
    5757end
  • Tst/Short/absfact.stat

    rf006a1 r9102bb  
    1 1 >> tst_memory_0 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:190632
    2 1 >> tst_memory_1 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:2486272
    3 1 >> tst_memory_2 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:2486272
    4 1 >> tst_timer :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:18
    5 2 >> tst_memory_0 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:195048
    6 2 >> tst_memory_1 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:2740224
    7 2 >> tst_memory_2 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:2740224
    8 2 >> tst_timer :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:50
    9 3 >> tst_memory_0 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:195048
    10 3 >> tst_memory_1 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:2740224
    11 3 >> tst_memory_2 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:2740224
    12 3 >> tst_timer :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:1
    13 4 >> tst_memory_0 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:196464
    14 4 >> tst_memory_1 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:2740224
    15 4 >> tst_memory_2 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:2740224
    16 4 >> tst_timer :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:9
    17 5 >> tst_memory_0 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:195968
    18 5 >> tst_memory_1 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:2740224
    19 5 >> tst_memory_2 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:2740224
    20 5 >> tst_timer_1 :: 1562166539:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:83
     11 >> tst_memory_0 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:192208
     21 >> tst_memory_1 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:2506752
     31 >> tst_memory_2 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:2506752
     41 >> tst_timer :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:18
     52 >> tst_memory_0 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:197648
     62 >> tst_memory_1 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:2637824
     72 >> tst_memory_2 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:2637824
     82 >> tst_timer :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:50
     93 >> tst_memory_0 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:197648
     103 >> tst_memory_1 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:2637824
     113 >> tst_memory_2 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:2637824
     123 >> tst_timer :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:2
     134 >> tst_memory_0 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:202280
     144 >> tst_memory_1 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:2637824
     154 >> tst_memory_2 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:2637824
     164 >> tst_timer :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:9
     175 >> tst_memory_0 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:201784
     185 >> tst_memory_1 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:2637824
     195 >> tst_memory_2 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:2637824
     205 >> tst_timer_1 :: 1565087159:4122, 64 bit:4.1.2:x86_64-Linux:nepomuck:83
  • Tst/Short/bug_zp.res.gz.uu

    rf006a1 r9102bb  
    11begin 640 bug_zp.res.gz
    2 M'XL("-%LPED"`V)U9U]Z<"YR97,`E5!-3\)`$+WW5[P0#B6I"[O(AQ#6Q'@A
    3 M,5[P1K19RK9.`FTSNX3*KW>KI.K1T[QY;U[FS6Q>'M?/`*3&T_H!/>^\.-"N
    4 MMXPV5T5I!#*EDGP\6$9MA=;8G8KT4HO2GH7SQG?C8XT.WPH,AS@;+A-0CIKI
    5 M:$$.OJIP,%Q8Y!4C-YFO^&/1V28"3&4!7DW&T_E,CD8R:9)]_9-IJJ\NNEC$
    6 MC;J1(5G@[Y&]&PZ*97*>LC_+XJ-I6D*]J;O!/Z>W\G716M(`5C+:JN]6=HEF
    7 7O\Z>BZ^/M6\YN3A$ZT>?0,1X.V<!````
     2M'XL("$.:.5T"`V)U9U]Z<"YR97,`55#+;L(P$+S[*T:(0Y""P>99$$:J>D&J
     3M>H$;:B.3.F$E2"+;B)2OK].BM)QV=V9'L[/;W<OF#8!0>-T\H^.=YR<Z=)9L
     4M>V>D0@`3*LA'O25K*I3"X9(GMXH7YLJ=U[Y='RFT_9AC,,!5VR(&9:@LG0W(
     5MP9<E3MKF!EEID>G4E_9KT<HF'):*''8U&4WG,S$<BKB./ZN_FZ;JKJ*;053+
     6MO@B7!7R-]*AM8(PEYRE],(O.NFX`^2&?>FPOWA>-)`G-2K"]_!U%ZS'[%V3.
     73?W[0!+VX*)AUV3<,'@((.0$`````
    88`
    99end
  • Tst/Short/bug_zp.stat

    rf006a1 r9102bb  
    1 1 >> tst_memory_0 :: 1505914065:4103, 64 bit:4.1.0:x86_64-Linux:nepomuck:83592
    2 1 >> tst_memory_1 :: 1505914065:4103, 64 bit:4.1.0:x86_64-Linux:nepomuck:2215936
    3 1 >> tst_memory_2 :: 1505914065:4103, 64 bit:4.1.0:x86_64-Linux:nepomuck:2215936
    4 1 >> tst_timer_1 :: 1505914065:4103, 64 bit:4.1.0:x86_64-Linux:nepomuck:0
     11 >> tst_memory_0 :: 1564056131:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:85680
     21 >> tst_memory_1 :: 1564056131:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:2150192
     31 >> tst_memory_2 :: 1564056131:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:2191296
     41 >> tst_timer_1 :: 1564056131:4120, 64 bit:4.1.2:x86_64-Linux:nepomuck:5
  • doc/NEWS.texi

    rf006a1 r9102bb  
    2121
    2222@heading News for version @value{VERSION}
     23
     24Changes in the kernel/build system:
     25@itemize
     26@item improved gcd and multiplication via FLINT
     27@end itemize
     28
     29@heading News for version 4-1-2
    2330New libraries:
    2431@itemize
  • factory/FLINTconvert.cc

    rf006a1 r9102bb  
    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    fmpq_set_si (result, f.intval(), 1);
     166  }
     167  else if(f.inQ())
    158168  {
    159169    mpz_t gmp_val;
     
    165175    mpz_clear (gmp_val);
    166176  }
     177  else if(f.inZ())
     178  {
     179    mpz_t gmp_val;
     180    f.mpzval(gmp_val);
     181    fmpz_set_mpz (fmpq_numref (result), gmp_val);
     182    mpz_clear (gmp_val);
     183    fmpz_one(fmpq_denref(result));
     184  }
     185  else
     186  {
     187    printf("wrong type\n");
     188  }
    167189}
    168190
     
    181203
    182204  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;
     205  if (mpz_is_imm (nden))
     206  {
     207    if (mpz_is_imm(nnum))
     208    {
     209      num= CanonicalForm (mpz_get_si(nnum));
     210      den= CanonicalForm (mpz_get_si(nden));
     211      mpz_clear (nnum);
     212      mpz_clear (nden);
     213      result= num/den;
     214    }
     215    else if (mpz_cmp_si(nden,1)==0)
     216    {
     217      result= CanonicalForm( CFFactory::basic(nnum));
     218      mpz_clear (nden);
     219    }
     220    else
     221      result= CanonicalForm( CFFactory::rational( nnum, nden, false));
    193222  }
    194223  else
    195224  {
    196     result= make_cf (nnum, nden, false);
    197     if (!isRat)
    198       Off (SW_RATIONAL);
    199     return result;
    200   }
     225    result= CanonicalForm( CFFactory::rational( nnum, nden, false));
     226  }
     227  if (!isRat)
     228    Off (SW_RATIONAL);
     229  return result;
    201230}
    202231
     
    528557}
    529558#endif
    530 
    531 #endif
    532 
    533 
     559#if __FLINT_RELEASE >= 20503
     560static void convFlint_RecPP ( const CanonicalForm & f, ulong * exp, nmod_mpoly_t result, nmod_mpoly_ctx_t ctx, int N )
     561{
     562  // assume f!=0
     563  if ( ! f.inCoeffDomain() )
     564  {
     565    int l = f.level();
     566    for ( CFIterator i = f; i.hasTerms(); i++ )
     567    {
     568      exp[N-l] = i.exp();
     569      convFlint_RecPP( i.coeff(), exp, result, ctx, N );
     570    }
     571    exp[N-l] = 0;
     572  }
     573  else
     574  {
     575    int c=f.intval(); // with Off(SW_SYMMETRIC_FF): 0<=c<p
     576    nmod_mpoly_push_term_ui_ui(result,c,exp,ctx);
     577  }
     578}
     579
     580static void convFlint_RecPP ( const CanonicalForm & f, ulong * exp, fmpq_mpoly_t result, fmpq_mpoly_ctx_t ctx, int N )
     581{
     582  // assume f!=0
     583  if ( ! f.inBaseDomain() )
     584  {
     585    int l = f.level();
     586    for ( CFIterator i = f; i.hasTerms(); i++ )
     587    {
     588      exp[N-l] = i.exp();
     589      convFlint_RecPP( i.coeff(), exp, result, ctx, N );
     590    }
     591    exp[N-l] = 0;
     592  }
     593  else
     594  {
     595    fmpq_t c;
     596    fmpq_init(c);
     597    convertCF2Fmpq(c,f);
     598    fmpq_mpoly_push_term_fmpq_ui(result,c,exp,ctx);
     599    fmpq_clear(c);
     600  }
     601}
     602
     603void convFactoryPFlintMP ( const CanonicalForm & f, nmod_mpoly_t res, nmod_mpoly_ctx_t ctx, int N )
     604{
     605  if (f.isZero()) return;
     606  ulong * exp = (ulong*)Alloc(N*sizeof(ulong));
     607  memset(exp,0,N*sizeof(ulong));
     608  bool save_sym_ff= isOn (SW_SYMMETRIC_FF);
     609  if (save_sym_ff) Off (SW_SYMMETRIC_FF);
     610  convFlint_RecPP( f, exp, res, ctx, N );
     611  if (save_sym_ff) On(SW_SYMMETRIC_FF);
     612  Free(exp,N*sizeof(ulong));
     613}
     614
     615void convFactoryPFlintMP ( const CanonicalForm & f, fmpq_mpoly_t res, fmpq_mpoly_ctx_t ctx, int N )
     616{
     617  if (f.isZero()) return;
     618  ulong * exp = (ulong*)Alloc(N*sizeof(ulong));
     619  memset(exp,0,N*sizeof(ulong));
     620  convFlint_RecPP( f, exp, res, ctx, N );
     621  fmpq_mpoly_reduce(res,ctx);
     622  Free(exp,N*sizeof(ulong));
     623}
     624
     625CanonicalForm convFlintMPFactoryP(nmod_mpoly_t f, nmod_mpoly_ctx_t ctx, int N)
     626{
     627  CanonicalForm result;
     628  int d=nmod_mpoly_length(f,ctx)-1;
     629  ulong* exp=(ulong*)Alloc(N*sizeof(ulong));
     630  for(int i=d; i>=0; i--)
     631  {
     632    ulong c=nmod_mpoly_get_term_coeff_ui(f,i,ctx);
     633    nmod_mpoly_get_term_exp_ui(exp,f,i,ctx);
     634    CanonicalForm term=(int)c;
     635    for ( int i = 0; i <N; i++ )
     636    {
     637      if (exp[i]!=0) term*=CanonicalForm( Variable( N-i ), exp[i] );
     638    }
     639    result+=term;
     640  }
     641  Free(exp,N*sizeof(ulong));
     642  return result;
     643}
     644
     645CanonicalForm convFlintMPFactoryP(fmpq_mpoly_t f, fmpq_mpoly_ctx_t ctx, int N)
     646{
     647  CanonicalForm result;
     648  int d=fmpq_mpoly_length(f,ctx)-1;
     649  ulong* exp=(ulong*)Alloc(N*sizeof(ulong));
     650  fmpq_t c;
     651  fmpq_init(c);
     652  for(int i=d; i>=0; i--)
     653  {
     654    fmpq_mpoly_get_term_coeff_fmpq(c,f,i,ctx);
     655    fmpq_mpoly_get_term_exp_ui(exp,f,i,ctx);
     656    CanonicalForm term=convertFmpq_t2CF(c);
     657    for ( int i = 0; i <N; i++ )
     658    {
     659      if (exp[i]!=0) term*=CanonicalForm( Variable( N-i ), exp[i] );
     660    }
     661    result+=term;
     662  }
     663  fmpq_clear(c);
     664  Free(exp,N*sizeof(ulong));
     665  return result;
     666}
     667
     668// stolen from:
     669// https://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
     670static inline int SI_LOG2(int v)
     671{
     672  const unsigned int b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
     673  const unsigned int S[] = {1, 2, 4, 8, 16};
     674
     675  unsigned int r = 0; // result of log2(v) will go here
     676  if (v & b[4]) { v >>= S[4]; r |= S[4]; }
     677  if (v & b[3]) { v >>= S[3]; r |= S[3]; }
     678  if (v & b[2]) { v >>= S[2]; r |= S[2]; }
     679  if (v & b[1]) { v >>= S[1]; r |= S[1]; }
     680  if (v & b[0]) { v >>= S[0]; r |= S[0]; }
     681  return (int)r;
     682}
     683
     684CanonicalForm mulFlintMP_Zp(const CanonicalForm& F,int lF, const CanonicalForm& G, int lG,int m)
     685{
     686  int bits=SI_LOG2(m)+1;
     687  int N=F.level();
     688  nmod_mpoly_ctx_t ctx;
     689  nmod_mpoly_ctx_init(ctx,N,ORD_LEX,getCharacteristic());
     690  nmod_mpoly_t f,g,res;
     691  nmod_mpoly_init3(f,lF,bits,ctx);
     692  nmod_mpoly_init3(g,lG,bits,ctx);
     693  convFactoryPFlintMP(F,f,ctx,N);
     694  convFactoryPFlintMP(G,g,ctx,N);
     695  nmod_mpoly_init(res,ctx);
     696  nmod_mpoly_mul(res,f,g,ctx);
     697  nmod_mpoly_clear(g,ctx);
     698  nmod_mpoly_clear(f,ctx);
     699  CanonicalForm RES=convFlintMPFactoryP(res,ctx,N);
     700  nmod_mpoly_clear(res,ctx);
     701  nmod_mpoly_ctx_clear(ctx);
     702  return RES;
     703}
     704
     705CanonicalForm mulFlintMP_QQ(const CanonicalForm& F,int lF, const CanonicalForm& G, int lG, int m)
     706{
     707  int bits=SI_LOG2(m)+1;
     708  int N=F.level();
     709  fmpq_mpoly_ctx_t ctx;
     710  fmpq_mpoly_ctx_init(ctx,N,ORD_LEX);
     711  fmpq_mpoly_t f,g,res;
     712  fmpq_mpoly_init3(f,lF,bits,ctx);
     713  fmpq_mpoly_init3(g,lG,bits,ctx);
     714  convFactoryPFlintMP(F,f,ctx,N);
     715  convFactoryPFlintMP(G,g,ctx,N);
     716  fmpq_mpoly_init(res,ctx);
     717  fmpq_mpoly_mul(res,f,g,ctx);
     718  fmpq_mpoly_clear(g,ctx);
     719  fmpq_mpoly_clear(f,ctx);
     720  CanonicalForm RES=convFlintMPFactoryP(res,ctx,N);
     721  fmpq_mpoly_clear(res,ctx);
     722  fmpq_mpoly_ctx_clear(ctx);
     723  return RES;
     724}
     725
     726CanonicalForm gcdFlintMP_Zp(const CanonicalForm& F, const CanonicalForm& G)
     727{
     728  int N=F.level();
     729  int lf,lg,m=1<<MPOLY_MIN_BITS;
     730  lf=size_maxexp(F,m);
     731  lg=size_maxexp(G,m);
     732  int bits=SI_LOG2(m)+1;
     733  nmod_mpoly_ctx_t ctx;
     734  nmod_mpoly_ctx_init(ctx,N,ORD_LEX,getCharacteristic());
     735  nmod_mpoly_t f,g,res;
     736  nmod_mpoly_init3(f,lf,bits,ctx);
     737  nmod_mpoly_init3(g,lg,bits,ctx);
     738  convFactoryPFlintMP(F,f,ctx,N);
     739  convFactoryPFlintMP(G,g,ctx,N);
     740  nmod_mpoly_init(res,ctx);
     741  int ok=nmod_mpoly_gcd(res,f,g,ctx);
     742  nmod_mpoly_clear(g,ctx);
     743  nmod_mpoly_clear(f,ctx);
     744  CanonicalForm RES=1;
     745  if (ok)
     746  {
     747    RES=convFlintMPFactoryP(res,ctx,N);
     748  }
     749  nmod_mpoly_clear(res,ctx);
     750  nmod_mpoly_ctx_clear(ctx);
     751  return RES;
     752}
     753
     754static CanonicalForm b_content ( const CanonicalForm & f )
     755{
     756    if ( f.inCoeffDomain() )
     757        return f;
     758    else
     759    {
     760        CanonicalForm result = 0;
     761        CFIterator i;
     762        for ( i = f; i.hasTerms() && (!result.isOne()); i++ )
     763            result=bgcd( b_content(i.coeff()) , result );
     764        return result;
     765    }
     766}
     767
     768
     769CanonicalForm gcdFlintMP_QQ(const CanonicalForm& F, const CanonicalForm& G)
     770{
     771  int N=F.level();
     772  fmpq_mpoly_ctx_t ctx;
     773  fmpq_mpoly_ctx_init(ctx,N,ORD_LEX);
     774  fmpq_mpoly_t f,g,res;
     775  fmpq_mpoly_init(f,ctx);
     776  fmpq_mpoly_init(g,ctx);
     777  convFactoryPFlintMP(F,f,ctx,N);
     778  convFactoryPFlintMP(G,g,ctx,N);
     779  fmpq_mpoly_init(res,ctx);
     780  int ok=fmpq_mpoly_gcd(res,f,g,ctx);
     781  fmpq_mpoly_clear(g,ctx);
     782  fmpq_mpoly_clear(f,ctx);
     783  CanonicalForm RES=1;
     784  if (ok)
     785  {
     786    // Flint normalizes the gcd to be monic.
     787    // Singular wants a gcd defined over ZZ that is primitive and has a positive leading coeff.
     788    if (!fmpq_mpoly_is_zero(res, ctx))
     789    {
     790      fmpq_t content;
     791      fmpq_init(content);
     792      fmpq_mpoly_content(content, res, ctx);
     793      fmpq_mpoly_scalar_div_fmpq(res, res, content, ctx);
     794      fmpq_clear(content);
     795    }
     796    RES=convFlintMPFactoryP(res,ctx,N);
     797    // gcd(2x,4x) should be 2x, so RES should also have the gcd(lc(F),lc(G))
     798    RES*=bgcd(b_content(F),b_content(G));
     799  }
     800  fmpq_mpoly_clear(res,ctx);
     801  fmpq_mpoly_ctx_clear(ctx);
     802  return RES;
     803}
     804
     805#endif
     806
     807#endif
     808
     809
  • factory/FLINTconvert.h

    rf006a1 r9102bb  
    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/Makefile.am

    rf006a1 r9102bb  
    173173libfactory_includedir = ${includedir}/factory
    174174
    175 nodist_libfactory_include_HEADERS = factory.h factoryconf.h globaldefs.h
     175nodist_libfactory_include_HEADERS = factory.h factoryconf.h
     176libfactory_include_HEADERS = globaldefs.h
    176177
    177178
  • factory/NTLconvert.cc

    rf006a1 r9102bb  
    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

    rf006a1 r9102bb  
    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_char.cc

    rf006a1 r9102bb  
    3333        theDegree = 1;
    3434        CFFactory::settype( FiniteFieldDomain );
     35        ff_big = c > cf_getSmallPrime( cf_getNumSmallPrimes()-1 );
     36        if (c!=theCharacteristic)
     37        {
     38          if (c > 536870909) factoryError("characteristic is too large(max is 2^29)");
     39          ff_setprime( c );
     40        }
    3541        theCharacteristic = c;
    36         ff_big = c > cf_getSmallPrime( cf_getNumSmallPrimes()-1 );
    37         if (c > 536870909) factoryError("characteristic is too large(max is 2^29)");
    38         ff_setprime( c );
    3942    }
    4043}
  • factory/cf_gcd.cc

    rf006a1 r9102bb  
    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()>10)
     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    {
     
    311329                CanonicalForm cdF = bCommonDen( f );
    312330                CanonicalForm cdG = bCommonDen( g );
     331                CanonicalForm F = f * cdF, G = g * cdG;
    313332                Off( SW_RATIONAL );
    314                 CanonicalForm l = lcm( cdF, cdG );
    315                 On( SW_RATIONAL );
    316                 CanonicalForm F = f * l, G = g * l;
    317                 Off( SW_RATIONAL );
    318                 l = gcd_poly( F, G );
     333                CanonicalForm l = gcd_poly( F, G );
    319334                On( SW_RATIONAL );
    320335                return abs( l );
  • factory/cf_switches.cc

    rf006a1 r9102bb  
    3232#ifdef HAVE_NTL
    3333  On(SW_USE_CHINREM_GCD);
    34   //Off(SW_USE_NTL_SORT);
     34  On(SW_USE_NTL_SORT);
     35#endif
     36#ifdef HAVE_FLINT
    3537  On(SW_USE_FL_GCD_P);
    36   //On(SW_USE_FL_GCD_0);
     38  On(SW_USE_FL_GCD_0);
    3739#endif
    3840  On(SW_USE_EZGCD);
  • factory/facFqBivar.cc

    rf006a1 r9102bb  
    68836883#ifdef HAVE_FLINT
    68846884  nmod_mat_t FLINTN;
    6885 #else
     6885#endif
     6886
    68866887  if (fac_NTL_char != getCharacteristic())
    68876888  {
     
    68906891  }
    68916892  mat_zz_p NTLN;
    6892 #endif
    68936893
    68946894  if (alpha.level() != 1)
     
    68986898  }
    68996899  mat_zz_pE NTLNe;
     6900
    69006901  if (alpha.level() == 1)
    69016902  {
  • kernel/GBEngine/kstd1.cc

    r48f20b r9102bb  
    3838#include "kernel/GBEngine/kInline.h"
    3939
     40#ifdef HAVE_SHIFTBBA
     41#include "polys/shiftop.h"
     42#endif
    4043
    4144/* the list of all options which give a warning by test */
     
    23432346
    23442347#ifdef HAVE_SHIFTBBA
    2345   if(rIsLPRing(currRing)) return freegb(F, Q);
     2348  if(rIsLPRing(currRing)) return kStdShift(F, Q, h, w, hilb, syzComp, newIdeal, vw, FALSE);
    23462349#endif
    23472350
     
    28202823                int newIdeal, intvec *vw, BOOLEAN rightGB)
    28212824{
     2825  assume(rIsLPRing(currRing));
     2826  assume(idIsInV(F));
    28222827  ideal r;
    28232828  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
     
    29132918  delete(strat);
    29142919  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
     2920  assume(idIsInV(r));
    29152921  return r;
    29162922}
  • kernel/GBEngine/kstd1.h

    r48f20b r9102bb  
    4242    int syzComp=0, int newIdeal=0, intvec *vw=NULL, BOOLEAN rightGB=FALSE);
    4343
    44 ideal freegb(ideal F, ideal Q);
    4544ideal rightgb(ideal F, ideal Q);
    4645
  • kernel/GBEngine/kstd2.cc

    r48f20b r9102bb  
    45204520}
    45214521
    4522 
    4523 ideal freegb(ideal F, ideal Q)
    4524 {
    4525   assume(rIsLPRing(currRing));
    4526   assume(idIsInV(F));
    4527   ideal RS = kStdShift(F, Q, testHomog, NULL);
    4528   idSkipZeroes(RS); // is this even necessary?
    4529   assume(idIsInV(RS));
    4530   return(RS);
    4531 }
    4532 
     4522#ifdef HAVE_SHIFTBBA
    45334523ideal rightgb(ideal F, ideal Q)
    45344524{
     
    45404530  return(RS);
    45414531}
     4532#endif
    45424533
    45434534/*2
  • kernel/ideals.cc

    r48f20b r9102bb  
    617617    p = h2->m[j];
    618618    q = pOne();
     619#ifdef HAVE_SHIFTBBA
     620    // non multiplicative variable
     621    if (rIsLPRing(currRing))
     622    {
     623      pSetExp(q, currRing->isLPring - currRing->LPncGenCount + j + 1, 1);
     624      p_Setm(q, currRing);
     625    }
     626#endif
    619627    pSetComp(q,syzcomp+1+j);
    620628    pSetmComp(q);
    621629    if (p!=NULL)
    622630    {
    623       while (pNext(p)) pIter(p);
    624       p->next = q;
     631#ifdef HAVE_SHIFTBBA
     632      if (rIsLPRing(currRing))
     633      {
     634        h2->m[j] = pAdd(p, q);
     635      }
     636      else
     637#endif
     638      {
     639        while (pNext(p)) pIter(p);
     640        p->next = q;
     641      }
    625642    }
    626643    else
     
    630647  idTest(h2);
    631648
     649#ifdef HAVE_SHIFTBBA
     650  if (rIsLPRing(currRing)) alg = GbStd;
     651#endif
    632652  ideal h3=NULL;
    633653  if (alg==GbDefault) alg=GbStd;
  • kernel/mod2.h

    rf006a1 r9102bb  
    7777#endif
    7878
    79 #define SINGULAR_PATCHLEVEL 0
     79#define SINGULAR_PATCHLEVEL 2
    8080#define SINGULAR_VERSION ((SINGULAR_MAJOR_VERSION*1000 + SINGULAR_MINOR_VERSION*100 + SINGULAR_SUB_VERSION*10)+SINGULAR_PATCHLEVEL)
    8181
  • kernel/preimage.cc

    rf006a1 r9102bb  
    8888  }
    8989
    90   assume(n_SetMap(theImageRing->cf, dst_r->cf) == ndCopyMap);
    91 
    9290  if (theImageRing->cf != dst_r->cf)
    9391  {
  • libpolys/coeffs/Makefile.am

    rf006a1 r9102bb  
    4444test_LDADD   = libcoeffs.la $(libcoeffs_la_LIBADD)
    4545
    46 EXTRA_DIST = rintegers2.cc rinteger3.cc
     46EXTRA_DIST = rintegers2.cc rintegers3.cc
  • libpolys/coeffs/rintegers2.cc

    rf006a1 r9102bb  
    515515}
    516516
     517static void nrzMPZ(mpz_t res, number &a, const coeffs)
     518{
     519  mpz_init_set(res, (mpz_ptr) a);
     520}
     521
    517522static number nrzFarey(number r, number N, const coeffs R)
    518523{
     
    621626  r->cfInit = nrzInit;
    622627  r->cfInitMPZ = nrzInitMPZ;
     628  r->cfMPZ = nrzMPZ;
    623629  r->cfSize  = nrzSize;
    624630  r->cfInt  = nrzInt;
  • libpolys/polys/clapconv.cc

    rf006a1 r9102bb  
    8787  p1=p;
    8888  l=l/2;
    89   while(l>0) { p=pNext(p); l--; }
     89  while(l>1) { p=pNext(p); l--; }
    9090  p2=pNext(p);
    9191  pNext(p)=NULL;
     
    101101
    102102#define MIN_CONV_LEN 7
    103 CanonicalForm convSingPFactoryP( poly p, const ring r )
     103static CanonicalForm convSingPFactoryP_intern( poly p, int l, BOOLEAN & setChar,const ring r )
    104104{
    105105  CanonicalForm result = 0;
    106106  int e, n = rVar(r);
    107   BOOLEAN setChar=TRUE;
    108 
    109   int l;
    110   if ((l=pLength(p))>MIN_CONV_LEN)
     107  assume(l==pLength(p));
     108
     109  if (l>MIN_CONV_LEN)
    111110  {
    112111    poly p1,p2;
    113112    convPhalf(p,l,p1,p2);
    114     CanonicalForm P=convSingPFactoryP(p1,r);
    115     P+=convSingPFactoryP(p2,r);
     113    CanonicalForm P=convSingPFactoryP_intern(p1,l/2,setChar,r);
     114    P+=convSingPFactoryP_intern(p2,l-l/2,setChar,r);
    116115    convPunhalf(p1,p2);
    117116    return P;
    118117  }
     118  BOOLEAN setChar_loc=setChar;
     119  setChar=FALSE;
    119120  while ( p!=NULL )
    120121  {
    121     CanonicalForm term=r->cf->convSingNFactoryN(pGetCoeff( p ),setChar, r->cf);
     122    CanonicalForm term=r->cf->convSingNFactoryN(pGetCoeff( p ),setChar_loc, r->cf);
    122123    if (errorreported) break;
    123     setChar=FALSE;
     124    setChar_loc=FALSE;
    124125    for ( int i = 1; i <=n; i++ )
    125126    {
     
    131132 }
    132133 return result;
     134}
     135
     136CanonicalForm convSingPFactoryP( poly p, const ring r )
     137{
     138  BOOLEAN setChar=TRUE;
     139  return convSingPFactoryP_intern(p,pLength(p),setChar,r);
    133140}
    134141
  • libpolys/polys/clapsing.cc

    rf006a1 r9102bb  
    5959  #ifdef HAVE_FLINT
    6060  #if __FLINT_RELEASE >= 20503
    61   if (rField_is_Zp(r) && (r->cf->ch>500))
     61  if (rField_is_Zp(r) && (r->cf->ch>10))
    6262  {
    6363    nmod_mpoly_ctx_t ctx;
  • libpolys/polys/flint_mpoly.cc

    rf006a1 r9102bb  
    6565#if 1
    6666// memory allocation is not thread safe; singular polynomials must be constructed in serial
     67
     68/*
     69    We agree the that result of a singular -> fmpq_mpoly conversion is
     70    readonly. This restricts the usage of the result in flint functions to
     71    const arguments. However, the real readonly conversion is currently only
     72    implemented in the threaded conversion below since it requires a scan of
     73    all coefficients anyways. The _fmpq_mpoly_clear_readonly_sing needs to
     74    be provided for a consistent interface in the polynomial operations.
     75*/
     76static void _fmpq_mpoly_clear_readonly_sing(fmpq_mpoly_t a, fmpq_mpoly_ctx_t ctx)
     77{
     78    fmpq_mpoly_clear(a, ctx);
     79}
    6780
    6881void convSingPFlintMP(fmpq_mpoly_t res, fmpq_mpoly_ctx_t ctx, poly p, int lp, const ring r)
     
    186199}
    187200
     201
     202/*
     203    In order that flint may sometimes borrow the large integer coeffs of
     204    polynomials over QQ (borrow means: simply point to the same GMP structs
     205    that singular has already allocated), we define the result of a
     206    singular -> fmpq_mpoly conversion to be readonly. This means we agree
     207    that
     208        - it can only be used as an const argument to a flint function
     209        - singular must not mutate the original coeffs while the readonly object is in use
     210*/
     211
     212static void _fmpq_mpoly_clear_readonly_sing(fmpq_mpoly_t a, fmpq_mpoly_ctx_t ctx)
     213{
     214    if (fmpq_is_one(a->content))
     215    {
     216        if (a->zpoly->alloc > 0)
     217        {
     218            flint_free(a->zpoly->coeffs);
     219            flint_free(a->zpoly->exps);
     220        }
     221
     222        fmpq_clear(a->content);
     223    }
     224    else
     225    {
     226        fmpq_mpoly_clear(a, ctx);
     227    }
     228}
     229
    188230/* singular -> fmpq_mpoly conversion */
    189231
     
    197239    std::vector<poly> markers;
    198240    ring r;
    199 
    200     convert_sing_to_fmpq_mpoly_base(slong num_threads_, fmpq_mpoly_struct * res_,
    201                              const fmpq_mpoly_ctx_struct * ctx_, const ring r_, poly p)
    202       : num_threads(num_threads_),
     241    fmpq_t content;
     242
     243    convert_sing_to_fmpq_mpoly_base(fmpq_mpoly_struct * res_,
     244                     const fmpq_mpoly_ctx_struct * ctx_, const ring r_, poly p)
     245      : num_threads(0),
    203246        res(res_),
    204247        ctx(ctx_),
    205248        r(r_)
    206249    {
     250        fmpq_t c;
     251        fmpq_init(c);
     252        fmpq_init(content);
     253        fmpq_zero(content);
     254
    207255        length = 0;
    208256        while (1)
    209257        {
    210258            if ((length % 4096) == 0)
     259            {
     260                my_convSingNFlintN_QQ(c, number(pGetCoeff(p)));
     261                fmpq_gcd(content, content, c);
    211262                markers.push_back(p);
     263            }
    212264            if (p == NULL)
    213265                return;
     
    215267            pIter(p);
    216268        }
     269
     270        fmpq_clear(c);
     271    }
     272
     273    ~convert_sing_to_fmpq_mpoly_base()
     274    {
     275        fmpq_clear(content);
    217276    }
    218277};
     
    248307
    249308    flint_bitcnt_t required_bits = MPOLY_MIN_BITS;
    250     fmpq_zero(arg->content);
     309    fmpq_set(arg->content, base->content);
    251310
    252311    while (idx < arg->end_idx)
    253312    {
    254         my_convSingNFlintN_QQ(c, number(pGetCoeff(p)));
    255         fmpq_gcd(arg->content, arg->content, c);
     313        number n = number(pGetCoeff(p));
     314
     315        if (fmpq_is_one(arg->content) && (SR_HDL(n)&SR_INT || n->s >= 3))
     316        {
     317            /* content is 1 and n is an integer, nothing to do */
     318        }
     319        else
     320        {
     321            my_convSingNFlintN_QQ(c, n);
     322            fmpq_gcd(arg->content, arg->content, c);
     323        }
    256324
    257325        #if SIZEOF_LONG==8
     
    293361    }
    294362
     363    slong N = mpoly_words_per_exp(base->res->zpoly->bits, base->ctx->zctx->minfo);
     364    fmpz * res_coeffs = base->res->zpoly->coeffs;
     365    ulong * res_exps = base->res->zpoly->exps;
     366    flint_bitcnt_t res_bits = base->res->zpoly->bits;
     367
    295368    while (idx < arg->end_idx)
    296369    {
    297         my_convSingNFlintN_QQ(c, number(pGetCoeff(p)));
    298         FLINT_ASSERT(!fmpq_is_zero(base->res->content));
    299         fmpq_div(t, c, base->res->content);
    300         FLINT_ASSERT(fmpz_is_one(fmpq_denref(t)));
    301 
    302         slong N = mpoly_words_per_exp(base->res->zpoly->bits, base->ctx->zctx->minfo);
    303         fmpz_swap(base->res->zpoly->coeffs + idx, fmpq_numref(t));
     370        if (fmpq_is_one(base->res->content))
     371        {
     372            // borrowing singular integers
     373            // the entry res_coeffs[idx] is junk, we should just overwrite it
     374
     375            number n = number(pGetCoeff(p));
     376
     377            if (SR_HDL(n)&SR_INT)
     378            {
     379                // n is a singular-small integer
     380                res_coeffs[idx] = SR_TO_INT(n);
     381            }
     382            else if (n->s<3)
     383            {
     384                // n is an element of QQ \ ZZ, should not happen
     385                assume(false);
     386            }
     387            else
     388            {
     389                // n is a singular-large integer, n may be flint-small
     390                res_coeffs[idx] = PTR_TO_COEFF(n->z);
     391                if (fmpz_fits_si(res_coeffs + idx))
     392                {
     393                    slong val = fmpz_get_si(res_coeffs + idx);
     394                    if (val >= COEFF_MIN && val <= COEFF_MAX)
     395                        res_coeffs[idx] = val;
     396                }
     397            }
     398        }
     399        else
     400        {
     401            my_convSingNFlintN_QQ(c, number(pGetCoeff(p)));
     402            FLINT_ASSERT(!fmpq_is_zero(base->res->content));
     403            fmpq_div(t, c, base->res->content);
     404            FLINT_ASSERT(fmpz_is_one(fmpq_denref(t)));
     405            fmpz_swap(res_coeffs + idx, fmpq_numref(t));
     406        }
     407
    304408        #if SIZEOF_LONG==8
    305409        p_GetExpVL(p, (int64*)exp, base->r);
    306         mpoly_set_monomial_ui(base->res->zpoly->exps + N*idx, exp, base->res->zpoly->bits, base->ctx->zctx->minfo);
     410        mpoly_set_monomial_ui(res_exps + N*idx, exp, res_bits, base->ctx->zctx->minfo);
    307411        #else
    308412        p_GetExpV(p, (int*)exp, base->r);
    309         mpoly_set_monomial_ui(base->res->zpoly->exps + N*idx, &(exp[1]), base->res->zpoly->bits, base->ctx->minfo);
     413        mpoly_set_monomial_ui(res_exps + N*idx, &(exp[1]), res_bits, base->ctx->minfo);
    310414        #endif
    311415
     
    324428    thread_pool_handle * handles;
    325429    slong num_handles;
    326     slong thread_limit = 1000;
    327 
    328     /* get workers */
     430    slong thread_limit = 1000; // TODO: should be paramter to this function
     431
     432    /* the constructor works out the length of p and sets some markers */
     433    convert_sing_to_fmpq_mpoly_base base(res, ctx, r, p);
     434
     435    /* sensibly limit thread count and get workers */
     436    thread_limit = FLINT_MIN(thread_limit, base.length/1024);
    329437    handles = NULL;
    330438    num_handles = 0;
     
    340448    }
    341449
    342     convert_sing_to_fmpq_mpoly_base base(num_handles + 1, res, ctx, r, p);
    343 
    344450    /* fill in thread division points */
     451    base.num_threads = 1 + num_handles;
    345452    convert_sing_to_fmpq_mpoly_arg * args = new convert_sing_to_fmpq_mpoly_arg[base.num_threads];
    346453    slong cur_idx = 0;
     
    348455    {
    349456        slong next_idx = i + 1 < base.num_threads ? (i + 1)*base.length/base.num_threads : base.length;
     457        FLINT_ASSERT(cur_idx <= base.length);
    350458        next_idx = FLINT_MAX(next_idx, cur_idx);
    351459        next_idx = FLINT_MIN(next_idx, base.length);
     
    367475        required_bits = FLINT_MAX(required_bits, args[i].required_bits);
    368476
    369     /* initialize res with optimal bits */
    370     fmpq_mpoly_init3(res, base.length, mpoly_fix_bits(required_bits, ctx->zctx->minfo), ctx);
    371 
    372477    /* sign of content should match sign of first coeff */
    373     fmpq_zero(base.res->content);
     478    fmpq_t content;
     479    fmpq_init(content);
     480    fmpq_zero(content);
    374481    for (slong i = 0; i < base.num_threads; i++)
    375         fmpq_gcd(base.res->content, base.res->content, args[i].content);
     482        fmpq_gcd(content, content, args[i].content);
    376483    if (p != NULL)
    377484    {
     
    380487        my_convSingNFlintN_QQ(c, number(pGetCoeff(p)));
    381488        if (fmpq_sgn(c) < 0)
    382             fmpq_neg(base.res->content, base.res->content);
     489            fmpq_neg(content, content);
    383490        fmpq_clear(c);
    384491    }
     492
     493    /* initialize res with optimal bits */
     494    required_bits = mpoly_fix_bits(required_bits, ctx->zctx->minfo);
     495    if (fmpq_is_one(content))
     496    {
     497        /* initialize borrowed coeffs */
     498        slong N = mpoly_words_per_exp(required_bits, ctx->zctx->minfo);
     499        slong alloc = base.length;
     500        if (alloc != 0)
     501        {
     502            res->zpoly->coeffs = (fmpz *) flint_malloc(alloc*sizeof(fmpz));
     503            res->zpoly->exps   = (ulong *) flint_malloc(alloc*N*sizeof(ulong));
     504        }
     505        else
     506        {
     507            res->zpoly->coeffs = NULL;
     508            res->zpoly->exps = NULL;
     509        }
     510        res->zpoly->alloc = alloc;
     511        res->zpoly->length = 0;
     512        res->zpoly->bits = required_bits;
     513
     514        fmpq_init(res->content);
     515        fmpq_one(res->content);
     516    }
     517    else
     518    {
     519        /* initialize coeffs that will be created and destroyed */
     520        fmpq_mpoly_init3(res, base.length, required_bits, ctx);
     521        fmpq_swap(res->content, content);
     522    }
     523
     524    fmpq_clear(content);
    385525
    386526    /* fill in res->zpoly */
     
    468608    thread_pool_handle * handles;
    469609    slong num_handles;
    470     slong thread_limit = 1000;
    471 
    472     /* get workers */
     610    slong thread_limit = 1000;// TODO: should be paramter to this function
     611
     612    /* sensibly limit threads and get workers */
     613    thread_limit = FLINT_MIN(thread_limit, f->zpoly->length/1024);
    473614    handles = NULL;
    474615    num_handles = 0;
     
    485626
    486627    convert_fmpq_mpoly_to_sing_base base(num_handles + 1, f, ctx, r);
    487 
    488628    convert_fmpq_mpoly_to_sing_arg * args = new convert_fmpq_mpoly_to_sing_arg[base.num_threads];
    489629    slong cur_idx = 0;
     
    492632        slong next_idx = i + 1 < base.num_threads ? (i + 1)*base.f->zpoly->length/base.num_threads
    493633                                                  : base.f->zpoly->length;
     634        FLINT_ASSERT(cur_idx <= base.f->zpoly->length);
    494635        next_idx = FLINT_MAX(next_idx, cur_idx);
    495636        next_idx = FLINT_MIN(next_idx, base.f->zpoly->length);
     
    542683    ring r;
    543684
    544     convert_sing_to_nmod_mpoly_base(slong num_threads_, nmod_mpoly_struct * res_,
    545                             const nmod_mpoly_ctx_struct * ctx_, const ring r_, poly p)
    546       : num_threads(num_threads_),
     685    convert_sing_to_nmod_mpoly_base(nmod_mpoly_struct * res_,
     686                     const nmod_mpoly_ctx_struct * ctx_, const ring r_, poly p)
     687      : num_threads(0),
    547688        res(res_),
    548689        ctx(ctx_),
     
    624765    }
    625766
     767    slong N = mpoly_words_per_exp(base->res->bits, base->ctx->minfo);
     768    ulong * res_coeffs = base->res->coeffs;
     769    ulong * res_exps = base->res->exps;
     770    flint_bitcnt_t res_bits = base->res->bits;
     771
    626772    while (idx < arg->end_idx)
    627773    {
    628         slong N = mpoly_words_per_exp(base->res->bits, base->ctx->minfo);
    629774        #if SIZEOF_LONG==8
    630775        p_GetExpVL(p, (int64*)exp, base->r);
    631         mpoly_set_monomial_ui(base->res->exps + N*idx, exp, base->res->bits, base->ctx->minfo);
     776        mpoly_set_monomial_ui(res_exps + N*idx, exp, res_bits, base->ctx->minfo);
    632777        #else
    633778        p_GetExpV(p, (int*)exp, base->r);
    634         mpoly_set_monomial_ui(base->res->exps + N*idx, &(exp[1]), base->res->bits, base->ctx->minfo);
     779        mpoly_set_monomial_ui(res_exps + N*idx, &(exp[1]), res_bits, base->ctx->minfo);
    635780        #endif
    636781
    637         base->res->coeffs[idx] = (ulong)(number(pGetCoeff(p)));
     782        res_coeffs[idx] = (ulong)(number(pGetCoeff(p)));
    638783
    639784        pIter(p);
     
    649794    thread_pool_handle * handles;
    650795    slong num_handles;
    651     slong thread_limit = 1000;
    652 
    653     /* get workers */
     796    slong thread_limit = 1000; // TODO: should be paramter to this function
     797
     798    /* the constructor works out the length of p and sets some markers */
     799    convert_sing_to_nmod_mpoly_base base(res, ctx, r, p);
     800
     801    /* sensibly limit thread count and get workers */
     802    thread_limit = FLINT_MIN(thread_limit, base.length/1024);
    654803    handles = NULL;
    655804    num_handles = 0;
     
    665814    }
    666815
    667     convert_sing_to_nmod_mpoly_base base(num_handles + 1, res, ctx, r, p);
    668 
    669816    /* fill in thread division points */
     817    base.num_threads = 1 + num_handles;
    670818    convert_sing_to_nmod_mpoly_arg * args = new convert_sing_to_nmod_mpoly_arg[base.num_threads];
    671819    slong cur_idx = 0;
     
    674822        slong next_idx = i + 1 < base.num_threads ? (i + 1)*base.length/base.num_threads
    675823                                                  : base.length;
     824        FLINT_ASSERT(cur_idx <= base.length);
    676825        next_idx = FLINT_MAX(next_idx, cur_idx);
    677826        next_idx = FLINT_MIN(next_idx, base.length);
     
    777926    thread_pool_handle * handles;
    778927    slong num_handles;
    779     slong thread_limit = 1000;
    780 
    781     /* get workers */
     928    slong thread_limit = 1000; // TODO: should be paramter to this function
     929
     930    /* sensibly limit threads and get workers */
     931    thread_limit = FLINT_MIN(thread_limit, f->length/1024);
    782932    handles = NULL;
    783933    num_handles = 0;
     
    794944
    795945    convert_nmod_mpoly_to_sing_base base(num_handles + 1, f, ctx, r);
    796 
    797946    convert_nmod_mpoly_to_sing_arg * args = new convert_nmod_mpoly_to_sing_arg[base.num_threads];
    798947    slong cur_idx = 0;
     
    801950        slong next_idx = i + 1 < base.num_threads ? (i + 1)*base.f->length/base.num_threads
    802951                                                  : base.f->length;
     952        FLINT_ASSERT(cur_idx <= base.f->length);
    803953        next_idx = FLINT_MAX(next_idx, cur_idx);
    804954        next_idx = FLINT_MIN(next_idx, base.f->length);
     
    845995{
    846996  fmpq_mpoly_t pp,qq,res;
    847   convSingPFlintMP(pp,ctx,p,lp,r);
    848   convSingPFlintMP(qq,ctx,q,lq,r);
     997  convSingPFlintMP(pp,ctx,p,lp,r); // pp read only
     998  convSingPFlintMP(qq,ctx,q,lq,r); // qq read only
    849999  fmpq_mpoly_init(res,ctx);
    8501000  fmpq_mpoly_mul(res,pp,qq,ctx);
    8511001  poly pres=convFlintMPSingP(res,ctx,r);
    8521002  fmpq_mpoly_clear(res,ctx);
    853   fmpq_mpoly_clear(pp,ctx);
    854   fmpq_mpoly_clear(qq,ctx);
     1003  _fmpq_mpoly_clear_readonly_sing(pp,ctx);
     1004  _fmpq_mpoly_clear_readonly_sing(qq,ctx);
    8551005  fmpq_mpoly_ctx_clear(ctx);
    8561006  p_Test(pres,r);
     
    8781028{
    8791029  fmpq_mpoly_t pp,qq,res;
    880   convSingPFlintMP(pp,ctx,p,lp,r);
    881   convSingPFlintMP(qq,ctx,q,lq,r);
     1030  convSingPFlintMP(pp,ctx,p,lp,r); // pp read only
     1031  convSingPFlintMP(qq,ctx,q,lq,r); // qq read only
    8821032  fmpq_mpoly_init(res,ctx);
    8831033  fmpq_mpoly_divides(res,pp,qq,ctx);
    8841034  poly pres = convFlintMPSingP(res,ctx,r);
    8851035  fmpq_mpoly_clear(res,ctx);
    886   fmpq_mpoly_clear(pp,ctx);
    887   fmpq_mpoly_clear(qq,ctx);
     1036  _fmpq_mpoly_clear_readonly_sing(pp,ctx);
     1037  _fmpq_mpoly_clear_readonly_sing(qq,ctx);
    8881038  fmpq_mpoly_ctx_clear(ctx);
    8891039  p_Test(pres,r);
     
    9341084{
    9351085  fmpq_mpoly_t pp,qq,res;
    936   convSingPFlintMP(pp,ctx,p,lp,r);
    937   convSingPFlintMP(qq,ctx,q,lq,r);
     1086  convSingPFlintMP(pp,ctx,p,lp,r); // pp read only
     1087  convSingPFlintMP(qq,ctx,q,lq,r); // qq read only
    9381088  fmpq_mpoly_init(res,ctx);
    9391089  int ok=fmpq_mpoly_gcd(res,pp,qq,ctx);
     
    9591109  }
    9601110  fmpq_mpoly_clear(res,ctx);
    961   fmpq_mpoly_clear(pp,ctx);
    962   fmpq_mpoly_clear(qq,ctx);
     1111  _fmpq_mpoly_clear_readonly_sing(pp,ctx);
     1112  _fmpq_mpoly_clear_readonly_sing(qq,ctx);
    9631113  fmpq_mpoly_ctx_clear(ctx);
    9641114  return pres;
  • libpolys/polys/monomials/ring.cc

    r48f20b r9102bb  
    432432  if (rIsLPRing(r))
    433433  {
    434     Print("\n// letterplace ring (block size %d)",r->isLPring);
     434    Print("\n// letterplace ring (block size %d, ncgen count %d)",r->isLPring, r->LPncGenCount);
    435435  }
    436436#endif
     
    13931393#ifdef HAVE_SHIFTBBA
    13941394  res->isLPring=r->isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */
     1395  res->LPncGenCount=r->LPncGenCount;
    13951396#endif
    13961397
     
    15221523#ifdef HAVE_SHIFTBBA
    15231524  res->isLPring=r->isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */
     1525  res->LPncGenCount=r->LPncGenCount;
    15241526#endif
    15251527
     
    16671669  #ifdef HAVE_SHIFTBBA
    16681670  if (r1->isLPring!=r2->isLPring) return FALSE;
     1671  if (r1->LPncGenCount!=r2->LPncGenCount) return FALSE;
    16691672  #endif
    16701673
  • libpolys/polys/monomials/ring.h

    r48f20b r9102bb  
    312312#ifdef HAVE_SHIFTBBA
    313313  short          isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */
     314  short          LPncGenCount;
    314315#endif
    315316
  • libpolys/polys/operations/p_Mult_q.cc

    rf006a1 r9102bb  
    6767}
    6868
     69static void pqLengthApprox(poly p, poly q, int &lp, int &lq, const int min)
     70{
     71  int l = 0;
     72
     73  do
     74  {
     75    if (p == NULL)
     76    {
     77      lp=l;
     78      lq=l+(q!=NULL);
     79      return;
     80    }
     81    if (q == NULL) /* && p!=NULL */
     82    {
     83      lp=l+1;
     84      lq=l;
     85      return;
     86    }
     87    if (l>min) /* && p,q!=NULL */
     88    {
     89      lp=l; lq=l;
     90      return;
     91    }
     92    pIter(p);
     93    pIter(q);
     94    l++;
     95  }
     96  while (1);
     97}
     98
    6999
    70100static poly _p_Mult_q_Bucket(poly p, const int lp,
     
    290320  poly pt;
    291321
    292   pqLength(p, q, lp, lq, MIN_LENGTH_FACTORY);
     322  // MIN_LENGTH_FACTORY must be >= MIN_LENGTH_FACTORY_QQ, MIN_FLINT_QQ, MIN_FLINT_Zp 20
     323  pqLengthApprox(p, q, lp, lq, MIN_LENGTH_FACTORY);
    293324
    294325  if (lp < lq)
     
    309340    if (pure_polys && rField_is_Q(r) && !convSingRFlintR(ctx,r))
    310341    {
    311       lp=pLength(p);
    312       //printf("mul in flint\n");
    313       poly res=Flint_Mult_MP(p,lp,q,lq,ctx,r);
     342      // lq is a lower bound for the length of p and  q
     343      poly res=Flint_Mult_MP(p,lq,q,lq,ctx,r);
    314344      if (!copy)
    315345      {
     
    325355    if (pure_polys && rField_is_Zp(r) && !convSingRFlintR(ctx,r))
    326356    {
    327       lp=pLength(p);
    328       //printf("mul in flint\n");
    329       poly res=Flint_Mult_MP(p,lp,q,lq,ctx,r);
     357      // lq is a lower bound for the length of p and  q
     358      poly res=Flint_Mult_MP(p,lq,q,lq,ctx,r);
    330359      if (!copy)
    331360      {
     
    357386  {
    358387    lp=pLength(p);
    359     assume(lq == pLength(q));
     388    lq=pLength(q);
    360389    return _p_Mult_q_Bucket(p, lp, q, lq, copy, r);
    361390  }
  • libpolys/polys/shiftop.cc

    r48f20b r9102bb  
    529529  PrintLn(); WriteLPExpV(m1ExpV, ri);
    530530#endif
     531  assume(_p_mLPNCGenValid(m1ExpV, ri));
    531532}
    532533
     
    564565  PrintLn(); WriteLPExpV(m1ExpV, ri);
    565566#endif
     567  assume(_p_mLPNCGenValid(m1ExpV, ri));
    566568}
    567569
     
    608610  assume(p_FirstVblock(m1,r) <= 1);
    609611  assume(p_FirstVblock(m2,r) <= 1);
     612}
     613
     614BOOLEAN _p_mLPNCGenValid(int *mExpV, const ring r)
     615{
     616  BOOLEAN hasNCGen = FALSE;
     617  int lV = r->isLPring;
     618  int degbound = r->N/lV;
     619  int ncGenCount = r->LPncGenCount;
     620  for (int i = 1; i <= degbound; i++)
     621  {
     622    for (int j = i*lV; j > (i*lV - ncGenCount); j--)
     623    {
     624      if (mExpV[j])
     625      {
     626        if (hasNCGen)
     627        {
     628          return FALSE;
     629        }
     630        hasNCGen = TRUE;
     631      }
     632    }
     633  }
     634  return TRUE;
    610635}
    611636
     
    673698    if (B[j]!=0) break;
    674699  }
    675   /* do not need e anymore */
     700
     701  if (j==0)
     702  {
     703    omFreeSize((ADDRESS) e, (r->N+1)*sizeof(int));
     704    omFreeSize((ADDRESS) B, (b+1)*sizeof(int));
     705    return 1;
     706  }
     707
     708  if (!_p_mLPNCGenValid(e, r))
     709  {
     710    omFreeSize((ADDRESS) e, (r->N+1)*sizeof(int));
     711    omFreeSize((ADDRESS) B, (b+1)*sizeof(int));
     712    return 0;
     713  }
     714
    676715  omFreeSize((ADDRESS) e, (r->N+1)*sizeof(int));
    677716
    678   if (j==0) goto ret_true;
    679717//   {
    680718//     /* it is a zero exp vector, which is in V */
     
    688726    {
    689727      omFreeSize((ADDRESS) B, (b+1)*sizeof(int));
    690       return(0);
    691     }
    692   }
    693  ret_true:
     728      return 0;
     729    }
     730  }
     731
    694732  omFreeSize((ADDRESS) B, (b+1)*sizeof(int));
    695   return(1);
     733  return 1;
    696734}
    697735
     
    783821}
    784822
    785 ring freeAlgebra(ring r, int d)
    786 {
     823ring freeAlgebra(ring r, int d, int ncGenCount)
     824{
     825  if (ncGenCount) r = rCopy0(r);
     826  for (int i = 1; i <= ncGenCount; i++)
     827  {
     828    char *varname=(char *)omAlloc(256);
     829    sprintf(varname, "ncgen(%d)", i);
     830    ring save = r;
     831    r = rPlusVar(r, varname, 0);
     832    omFreeSize(varname, 256);
     833    rDelete(save);
     834  }
    787835  ring R=rCopy0(r);
    788836  int p;
     
    795843  R->N=r->N*d;
    796844  R->isLPring=r->N;
     845  R->LPncGenCount=ncGenCount;
    797846  // create R->order
    798847  BOOLEAN has_order_a=FALSE;
     
    883932  R->names=names;
    884933
     934  if (ncGenCount) rDelete(r);
    885935  rComplete(R,TRUE);
    886936  return R;
  • libpolys/polys/shiftop.h

    r48f20b r9102bb  
    5555BOOLEAN _p_LPLmDivisibleByNoComp(poly a, poly b, const ring r);
    5656
     57BOOLEAN _p_mLPNCGenValid(int *mExpV, const ring r);
     58
    5759poly p_LPVarAt(poly p, int pos, const ring r);
    5860
    5961/// create the letterplace ring corresponding to r up to degree d
    60 ring freeAlgebra(ring r, int d);
     62ring freeAlgebra(ring r, int d, int LPncGenCount = 0);
    6163#endif
    6264#endif
Note: See TracChangeset for help on using the changeset viewer.