Changeset f2ba60d in git


Ignore:
Timestamp:
Nov 27, 2014, 2:33:50 PM (9 years ago)
Author:
Stephan Oberfranz <oberfran@…>
Branches:
(u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
Children:
acccd24f08e9ec59e6ae03983de207fa7c337644
Parents:
635bddeea45a8e0e67969f7f60711ac84aba26d04d2a3539c40e545a3b264f0885793cdf5294ba00
Message:
Merge branch 'spielwiese' of github.com:Singular/Sources into spielwiese
Files:
7 added
50 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/general.lib

    r635bdd rf2ba60d  
    975975example
    976976{ "EXAMPLE:"; echo=2;
    977   ring r=0,(x,y,z),dp;
    978   poly f=x^30+y^30;
    979   watchdog(1,"factorize(eval("+string(f)+"))");
    980   watchdog(100,"factorize(eval("+string(f)+"))");
     977  watchdog(1,"system(\"sh\",\"sleep 5\")");
     978  watchdog(10,"system(\"sh\",\"sleep 5\")");
    981979}
    982980///////////////////////////////////////////////////////////////////////////////
  • Singular/LIB/modwalk.lib

    • Property mode changed from 100644 to 100755
    r4d2a353 rf2ba60d  
    1616
    1717PROCEDURES:
     18modpWalk(ideal,int,int,int[,int,int,int,int])    standard basis conversion of I in prime characteristic
    1819modWalk(ideal,int,int[,int,int,int,int]);        standard basis conversion of I using modular methods (chinese remainder)
    1920";
     
    2930////////////////////////////////////////////////////////////////////////////////
    3031
    31 static proc modpWalk(def II, int p, int variant, list #)
     32proc modpWalk(def II, int p, int variant, list #)
    3233"USAGE:  modpWalk(I,p,#); I ideal, p integer, variant integer
    3334ASSUME:  If size(#) > 0, then
     
    8081    }
    8182  }
    82 
    83 //-------------------------  make i homogeneous  -----------------------------
    84   if(!mixedTest() && !h)
    85   {
    86     if(!((find(ordstr_R0, "M") > 0) || (find(ordstr_R0, "a") > 0) || neg))
    87     {
    88       if(!((order == "simple") || (sizerl > 4)))
    89       {
    90         list rl@r = ringlist(@r);
    91         nvar@r = nvars(@r);     
    92         intvec w;
    93         for(k = 1; k <= nvar@r; k++)
    94         {
    95           w[k] = deg(var(k));
    96         }
    97         w[nvar@r + 1] = 1;
    98         rl@r[2][nvar@r + 1] = "homvar";
    99         rl@r[3][2][2] = w;
    100         def HomR = ring(rl@r);
    101         setring HomR;
    102         ideal i = imap(@r, i);
    103         i = homog(i, homvar);
    104       }
    105     }
    106   }
    107 
    10883//-------------------------  compute a standard basis mod p  -----------------------------
    109 
    11084  if(variant == 1)
    11185  {
     
    11387    {
    11488      i = rwalk(i,radius,pert_deg,#);
    115      // rwalk(i,radius,pert_deg,#); std(i);
    11689    }
    11790    else
     
    175148    }
    176149  }
    177  
    178   if(!mixedTest() && !h)
    179   {
    180     if(!((find(ordstr_R0, "M") > 0) || (find(ordstr_R0, "a") > 0) || neg))
    181     {
    182       if(!((order == "simple") || (sizerl > 4)))
    183       {
    184         i = subst(i, homvar, 1);
    185         i = simplify(i, 34);
    186         setring @r;
    187         i = imap(HomR, i);
    188         i = interred(i);
    189         kill HomR;
    190       }
    191     }
    192   }
     150
    193151  setring R0;
    194152  return(list(fetch(@r,i),p));
     
    487445  if(n2 > 4)
    488446  {
    489   //  L[5] = prime(random(an,en));
     447    L[5] = prime(random(an,en));
    490448  }
    491449  if(printlevel >= 10)
     
    528486//-------------------  Now all leading ideals are the same  --------------------
    529487//-------------------  Lift results to basering via farey  ---------------------
    530 
    531488    tt = timer; rt = rtimer;
    532489    N = T2[1];
     
    545502
    546503//----------------  Test if we already have a standard basis of I --------------
    547 
    548504    tt = timer; rt = rtimer;
    549     pTest = pTestSB(I,J,L,variant);
    550     //pTest = primeTestSB(I,J,L,variant);
     505    pTest = primeTest(J, prime(random(1000000000,2134567879)));
    551506    if(printlevel >= 10)
    552507    {
     
    596551    }
    597552//--------------  We do not already have a standard basis of I, therefore do the main computation for more primes  --------------
    598 
    599553    T1 = H;
    600554    T2 = N;
     
    613567      for(i=j; i<=size(L); i++)
    614568      {
    615         //Arguments[i-j+1] = list(II,L[i],variant,list(curr_weight,target_weight));
    616569        Arguments[size(Arguments)+1] = list(II,L[i],variant,list(curr_weight,target_weight));
    617570      }
     
    621574      for(i=j; i<=size(L); i++)
    622575      {
    623         //Arguments[i-j+1] = list(II,L[i],variant);
    624576        Arguments[size(Arguments)+1] = list(II,L[i],variant);
    625577      }
     
    632584    for(i=1; i<=size(PP); i++)
    633585    {
    634       //P[size(P) + 1] = PP[i];
    635586      T1[size(T1) + 1] = PP[i][1];
    636587      T2[size(T2) + 1] = bigint(PP[i][2]);
     
    649600  echo = 2;
    650601  ring R=0,(x,y,z),lp;
    651   ideal I=-x+y2z-z,xz+1,x2+y2-1;
    652   // I is a standard basis in dp
    653   ideal J = modWalk(I,1);
     602  ideal I= y3+xyz+y2z+xz3, 3+xy+x2y+y2z;
     603  ideal J = modWalk(I,2);
    654604  J;
    655605}
     
    772722  return(J);
    773723}
    774 //////////////////////////////////////////////////////////////////////////////////
    775 static proc primeTestSB(def II, ideal J, list L, int variant, list #)
    776 "USAGE:  primeTestSB(I,J,L,variant,#); I,J ideals, L intvec of primes, variant int
    777 RETURN:  1 (resp. 0) if for a randomly chosen prime p that is not in L
    778          J mod p is (resp. is not) a standard basis of I mod p
    779 EXAMPLE: example primeTestSB; shows an example
    780 "
    781 {
    782 if(typeof(II) == "ideal")
    783   {
    784   ideal I = II;
    785   int radius = 2;
    786   }
    787 if(typeof(II) == "list")
    788   {
    789   ideal I = II[1];
    790   int radius = II[2];
    791   }
    792 
    793 int i,j,k,p;
    794 def R = basering;
    795 list r = ringlist(R);
    796 
    797 while(!j)
    798   {
    799   j = 1;
    800   p = prime(random(1000000000,2134567879));
    801   for(i = 1; i <= size(L); i++)
    802     {
    803     if(p == L[i])
    804       {
    805       j = 0;
    806       break;
    807       }
    808     }
    809   if(j)
    810     {
    811     for(i = 1; i <= ncols(I); i++)
    812       {
    813       for(k = 2; k <= size(I[i]); k++)
    814         {
    815         if((denominator(leadcoef(I[i][k])) mod p) == 0)
    816           {
    817           j = 0;
    818           break;
    819           }
    820         }
    821       if(!j)
    822         {
    823         break;
    824         }
    825       }
    826     }
    827   if(j)
    828     {
    829     if(!primeTest(I,p))
    830       {
    831       j = 0;
    832       }
    833     }
    834   }
    835 r[1] = p;
    836 def @R = ring(r);
    837 setring @R;
    838 ideal I = imap(R,I);
    839 ideal J = imap(R,J);
    840 attrib(J,"isSB",1);
    841 
    842 int t = timer;
    843 j = 1;
    844 if(isIncluded(I,J) == 0)
    845   {
    846   j = 0;
    847   }
    848 if(printlevel >= 11)
    849   {
    850   "isIncluded(I,J) takes "+string(timer - t)+" seconds";
    851   "j = "+string(j);
    852   }
    853 t = timer;
    854 if(j)
    855   {
    856   if(size(#) > 0)
    857     {
    858     ideal K = modpWalk(I,p,variant,#)[1];
    859     }
    860   else
    861     {
    862     ideal K = modpWalk(I,p,variant)[1];
    863     }
    864   t = timer;
    865   if(isIncluded(J,K) == 0)
    866     {
    867     j = 0;
    868     }
    869   if(printlevel >= 11)
    870     {
    871     "isIncluded(K,J) takes "+string(timer - t)+" seconds";
    872     "j = "+string(j);
    873     }
    874   }
    875 setring R;
    876 
    877 return(j);
    878 }
    879 example
    880 { "EXAMPLE:"; echo = 2;
    881    intvec L = 2,3,5;
    882    ring r = 0,(x,y,z),lp;
    883    ideal I = x+1,x+y+1;
    884    ideal J = x+1,y;
    885    primeTestSB(I,I,L,1);
    886    primeTestSB(I,J,L,1);
    887 }
    888 
    889 ////////////////////////////////////////////////////////////////////////////////
    890 static proc pTestSB(ideal I, ideal J, list L, int variant, list #)
    891 "USAGE:  pTestSB(I,J,L,variant,#); I,J ideals, L intvec of primes, variant int
    892 RETURN:  1 (resp. 0) if for a randomly chosen prime p that is not in L
    893          J mod p is (resp. is not) a standard basis of I mod p
    894 EXAMPLE: example pTestSB; shows an example
    895 "
    896 {
    897    int i,j,k,p;
    898    def R = basering;
    899    list r = ringlist(R);
    900 
    901    while(!j)
    902    {
    903       j = 1;
    904       p = prime(random(1000000000,2134567879));
    905       for(i = 1; i <= size(L); i++)
    906       {
    907          if(p == L[i]) { j = 0; break; }
    908       }
    909       if(j)
    910       {
    911          for(i = 1; i <= ncols(I); i++)
    912          {
    913             for(k = 2; k <= size(I[i]); k++)
    914             {
    915                if((denominator(leadcoef(I[i][k])) mod p) == 0) { j = 0; break; }
    916             }
    917             if(!j){ break; }
    918          }
    919       }
    920       if(j)
    921       {
    922          if(!primeTest(I,p)) { j = 0; }
    923       }
    924    }
    925    r[1] = p;
    926    def @R = ring(r);
    927    setring @R;
    928    ideal I = imap(R,I);
    929    ideal J = imap(R,J);
    930    attrib(J,"isSB",1);
    931 
    932    int t = timer;
    933    j = 1;
    934    if(isIncluded(I,J) == 0) { j = 0; }
    935 
    936    if(printlevel >= 11)
    937    {
    938       "isIncluded(I,J) takes "+string(timer - t)+" seconds";
    939       "j = "+string(j);
    940    }
    941 
    942    t = timer;
    943    if(j)
    944    {
    945       if(size(#) > 0)
    946       {
    947          ideal K = modpStd(I,p,variant,#[1])[1];
    948       }
    949       else
    950       {
    951          ideal K = groebner(I);
    952       }
    953       t = timer;
    954       if(isIncluded(J,K) == 0) { j = 0; }
    955 
    956       if(printlevel >= 11)
    957       {
    958          "isIncluded(J,K) takes "+string(timer - t)+" seconds";
    959          "j = "+string(j);
    960       }
    961    }
    962    setring R;
    963    return(j);
    964 }
    965 example
    966 { "EXAMPLE:"; echo = 2;
    967    intvec L = 2,3,5;
    968    ring r = 0,(x,y,z),dp;
    969    ideal I = x+1,x+y+1;
    970    ideal J = x+1,y;
    971    pTestSB(I,I,L,2);
    972    pTestSB(I,J,L,2);
    973 }
     724
    974725////////////////////////////////////////////////////////////////////////////////
    975726static proc mixedTest()
  • Singular/LIB/rwalk.lib

    • Property mode changed from 100644 to 100755
  • Singular/LIB/schreyer.lib

    r635bdd rf2ba60d  
    22592259      exportto(Schreyer, Syzextra::ComputeResolution);
    22602260
     2261      exportto(Top, Syzextra::NumberStatsInit);
     2262      exportto(Top, Syzextra::NumberStatsPrint);
     2263
    22612264      newstruct("SRES","ring r,resolution rsltn"); // http://www.singular.uni-kl.de/Manual/latest/sing_179.htm#SEC218
    22622265      newstruct("SSYZ","ring r,module szg"); // http://www.singular.uni-kl.de/Manual/latest/sing_179.htm#SEC218
     
    25812584proc s_res(def I, int l)
    25822585{
     2586  int @prot = (find(option(),"prot") != 0);
    25832587  def R=SSinit(I); setring R; int @l = size(RES);
    25842588  SRES ret; ret.r = R;
     2589  if(@prot){ NumberStatsInit(); }
    25852590  ret.rsltn = ComputeResolution(RES[@l], LRES[@l], TRES[@l], l);
     2591  if(@prot){ NumberStatsPrint("Number statistic for s_res with ComputeResolution"); }
    25862592  return (ret);
    25872593}
  • Singular/LIB/swalk.lib

    • Property mode changed from 100644 to 100755
  • Singular/calcSVD.cc

    r635bdd rf2ba60d  
    1818{
    1919  poly p=pInit();
    20   currRing->cf->nRead(s,&pGetCoeff(p));
     20  n_Read(s, &pGetCoeff(p), currRing->cf);
    2121  return p;
    2222}
  • Singular/dyn_modules/syzextra/mod_main.cc

    r635bdd rf2ba60d  
    263263    const ring r = currRing;
    264264
    265 #ifdef LDEBUG
    266     r->cf->cfDBTest(n,__FILE__,__LINE__,r->cf);
    267 #endif
     265    n_Test(n, r->cf);
    268266
    269267    StringSetS("");
     
    19311929}
    19321930
    1933 
     1931// no args.
     1932// init num stats
     1933static BOOLEAN _NumberStatsInit(leftv res, leftv h)
     1934{
     1935  if ( (h!=NULL) && (h->Typ()!=INT_CMD) )
     1936  {
     1937    WerrorS("`NumberStatsInit([<int>])` expected");
     1938    return TRUE;
     1939  }
     1940
     1941  unsigned long v = 0;
     1942
     1943  if( h != NULL )
     1944    v = (unsigned long)(h->Data());
     1945
     1946  number_stats_Init(v);
     1947 
     1948  NoReturn(res);
     1949  return FALSE;
     1950}
     1951
     1952// maybe one arg.
     1953// print num stats
     1954static BOOLEAN _NumberStatsPrint(leftv res, leftv h)
     1955{
     1956  if ( (h!=NULL) && (h->Typ()!=STRING_CMD) )
     1957  {
     1958    WerrorS("`NumberStatsPrint([<string>])` expected");
     1959    return TRUE;
     1960  }
     1961 
     1962  const char* msg = NULL;
     1963
     1964  if( h != NULL )
     1965    msg = (const char*)(h->Data());
     1966 
     1967  number_stats_Print(msg);
     1968
     1969  NoReturn(res);
     1970  return FALSE;
     1971}
    19341972
    19351973END_NAMESPACE
     
    19912029//  ADD("GetAMData", FALSE, GetAMData);
    19922030
     2031  ADD("NumberStatsInit", FALSE, _NumberStatsInit);
     2032  ADD("NumberStatsPrint", FALSE, _NumberStatsPrint);
     2033 
    19932034  //  ADD("", FALSE, );
    19942035
  • Singular/extra.cc

    r4d2a353 rf2ba60d  
    19541954    if (strcmp(sys_cmd, "Mfrwalk") == 0)
    19551955    {
    1956       const short t[]={6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,RING_CMD};
     1956      const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
    19571957      if (!iiCheckTypes(h,t,1)) return TRUE;
    19581958      if (((intvec*) h->next->Data())->length() != currRing->N &&
  • Singular/gentable.cc

    r635bdd rf2ba60d  
    2020#include "grammar.h"
    2121#include "tok.h"
     22
     23inline int RingDependend(int t) { return (BEGIN_RING<t)&&(t<END_RING); }
    2224
    2325// to produce convert_table.texi for doc:
     
    348350          Tok2Cmdname(dArith1[i].arg),
    349351          Tok2Cmdname(dArith1[i].res));
     352    if (RingDependend(dArith1[i].res) && (!RingDependend(dArith1[i].arg)))
     353    {
     354      fprintf(outfile,"// WARNING: %s requires currRing\n",s);
     355    }
    350356    i++;
    351357  }
     
    362368          Tok2Cmdname(dArith2[i].arg2),
    363369          Tok2Cmdname(dArith2[i].res));
     370    if (RingDependend(dArith2[i].res)
     371       && (!RingDependend(dArith2[i].arg1))
     372       && (!RingDependend(dArith2[i].arg2)))
     373    {
     374      fprintf(outfile,"// WARNING: %s requires currRing\n",s);
     375    }
    364376    i++;
    365377  }
     
    377389          Tok2Cmdname(dArith3[i].arg3),
    378390          Tok2Cmdname(dArith3[i].res));
     391    if (RingDependend(dArith3[i].res)
     392       && (!RingDependend(dArith3[i].arg1))
     393       && (!RingDependend(dArith3[i].arg2))
     394       && (!RingDependend(dArith3[i].arg3)))
     395    {
     396      fprintf(outfile,"// WARNING: %s requires currRing\n",s);
     397    }
    379398    i++;
    380399  }
  • Singular/iparith.cc

    r635bdd rf2ba60d  
    108108  #include <polys/nc/nc.h>
    109109  #include <polys/nc/sca.h>
    110   #define ALLOW_PLURAL     1
    111   #define NO_PLURAL        0
    112   #define COMM_PLURAL      2
    113110  #define  PLURAL_MASK 3
    114111#else /* HAVE_PLURAL */
    115   #define ALLOW_PLURAL     0
    116   #define NO_PLURAL        0
    117   #define COMM_PLURAL      0
    118112  #define  PLURAL_MASK     0
    119113#endif /* HAVE_PLURAL */
     
    126120  #define ZERODIVISOR_MASK 0
    127121#endif
     122#define ALLOW_PLURAL     1
     123#define NO_PLURAL        0
     124#define COMM_PLURAL      2
    128125#define ALLOW_RING       4
    129126#define NO_RING          0
     
    754751          v->name = omStrDup(v->name);
    755752        }
     753        else if (v->rtyp!=0)
     754        {
     755          WerrorS("reserved name with ::");
     756          return TRUE;
     757        }
    756758        v->req_packhdl=IDPACKAGE(packhdl);
    757759        syMake(v, v->name, packhdl);
     
    18031805    if (nMap==NULL)
    18041806    {
    1805       Werror("not implemented: map bigint -> %s",cf->cfCoeffString(cf));
     1807      Werror("not implemented: map bigint -> %s", nCoeffString(cf));
    18061808      return TRUE;
    18071809    }
     
    23422344err_fetch:
    23432345  Werror("no identity map from %s (%s -> %s)",u->Fullname(),
    2344     r->cf->cfCoeffString(r->cf),
    2345     currRing->cf->cfCoeffString(currRing->cf));
     2346         nCoeffString(r->cf),
     2347         nCoeffString(currRing->cf));
    23462348  return TRUE;
    23472349}
     
    37533755  else
    37543756  {
    3755     Werror("cannot convert bigint to cring %s",currRing->cf->cfCoeffString(currRing->cf));
     3757    Werror("cannot convert bigint to cring %s", nCoeffString(currRing->cf));
    37563758    bo=TRUE;
    37573759  }
     
    62716273  if ((cf!=NULL) && (cf->cfRandom!=NULL))
    62726274  {
    6273     number n=cf->cfRandom(siRand,(number)v->Data(),(number)w->Data(),cf);
     6275    number n= n_Random(siRand,(number)v->Data(),(number)w->Data(),cf);
    62746276    number2 nn=(number2)omAlloc(sizeof(*nn));
    62756277    nn->cf=cf;
     
    77927794          if (check_valid(dA2[i].valid_for,op)) break;
    77937795        }
     7796        else
     7797        {
     7798          if (RingDependend(dA2[i].res))
     7799          {
     7800            WerrorS("no ring active");
     7801            break;
     7802          }
     7803        }
    77947804        if (traceit&TRACE_CALL)
    77957805          Print("call %s(%s,%s)\n",iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt));
     
    78257835            {
    78267836              if (check_valid(dA2[i].valid_for,op)) break;
     7837            }
     7838            else
     7839            {
     7840              if (RingDependend(dA2[i].res))
     7841              {
     7842                WerrorS("no ring active");
     7843                break;
     7844              }
    78277845            }
    78287846            if (traceit&TRACE_CALL)
     
    80038021          if (check_valid(dA1[i].valid_for,op)) break;
    80048022        }
     8023        else
     8024        {
     8025          if (RingDependend(dA1[i].res))
     8026          {
     8027            WerrorS("no ring active");
     8028            break;
     8029          }
     8030        }
    80058031        if (traceit&TRACE_CALL)
    80068032          Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
     
    80358061          {
    80368062            if (check_valid(dA1[i].valid_for,op)) break;
     8063          }
     8064          else
     8065          {
     8066            if (RingDependend(dA1[i].res))
     8067            {
     8068              WerrorS("no ring active");
     8069              break;
     8070            }
    80378071          }
    80388072          if (traceit&TRACE_CALL)
  • Singular/ipconv.cc

    r635bdd rf2ba60d  
    5858  if (nMap==NULL)
    5959  {
    60     Werror("no conversion from bigint to %s",currRing->cf->cfCoeffString(currRing->cf));
     60    Werror("no conversion from bigint to %s", nCoeffString(currRing->cf));
    6161    return NULL;
    6262  }
     
    7979  if (nMap==NULL)
    8080  {
    81     Werror("no conversion from bigint to %s",currRing->cf->cfCoeffString(currRing->cf));
     81    Werror("no conversion from bigint to %s", nCoeffString(currRing->cf));
    8282    return NULL;
    8383  }
     
    102102  if (nMap==NULL)
    103103  {
    104     Werror("no conversion from bigint to %s",currRing->cf->cfCoeffString(currRing->cf));
     104    Werror("no conversion from bigint to %s", nCoeffString(currRing->cf));
    105105    return NULL;
    106106  }
     
    186186  if (nMap==NULL)
    187187  {
    188     Werror("no conversion from bigint to %s",currRing->cf->cfCoeffString(currRing->cf));
     188    Werror("no conversion from bigint to %s", nCoeffString(currRing->cf));
    189189    return NULL;
    190190  }
  • Singular/ipid.cc

    r635bdd rf2ba60d  
    5757
    5858proclevel *procstack=NULL;
    59 #define TEST
    6059//idhdl idroot = NULL;
    6160
  • Singular/ipprint.cc

    r635bdd rf2ba60d  
    222222  }
    223223  else PrintS("field: ");
    224   PrintS(r->cfCoeffName(r));
     224  PrintS(nCoeffName(r));
    225225  return FALSE;
    226226}
  • Singular/ipshell.cc

    r635bdd rf2ba60d  
    228228    case CNUMBER_CMD:
    229229                   {  number2 n=(number2)IDDATA(h);
    230                       Print(" (%s)",n->cf->cfCoeffName(n->cf));
     230                      Print(" (%s)",nCoeffName(n->cf));
    231231                      break;
    232232                   }
     
    235235                      Print(" %d x %d (%s)",
    236236                        b->rows(),b->cols(),
    237                         b->basecoeffs()->cfCoeffName(b->basecoeffs()));
     237                        nCoeffName(b->basecoeffs()));
    238238                      break;
    239239                   }
  • Singular/links/ssiLink.cc

    r635bdd rf2ba60d  
    120120void ssiWriteBigInt(const ssiInfo *d, const number n)
    121121{
    122  coeffs_BIGINT->cfWriteFd(n,d->f_write,coeffs_BIGINT);
     122 n_WriteFd(n,d->f_write,coeffs_BIGINT);
    123123}
    124124
     
    146146  else if (cf->cfWriteFd!=NULL)
    147147  {
    148     cf->cfWriteFd(n,d->f_write,cf);
     148    n_WriteFd(n,d->f_write,cf);
    149149  }
    150150  else WerrorS("coeff field not implemented");
     
    390390  if (cf->cfReadFd!=NULL)
    391391  {
    392      return cf->cfReadFd(d->f_read,cf);
     392     return n_ReadFd(d->f_read,cf);
    393393  }
    394394  else if (getCoeffType(cf) == n_transExt)
  • Singular/number2.cc

    r635bdd rf2ba60d  
    1919    return omStrDup("oo");
    2020  }
    21   return omStrDup(c->cfCoeffName(c));
     21  return omStrDup(nCoeffName(c));
    2222}
    2323void crPrint(coeffs c)
  • Singular/walk.cc

    • Property mode changed from 100644 to 100755
    r4d2a353 rf2ba60d  
    562562}
    563563
     564/*****************************************************************************
     565 * compute the gcd of the entries of the vectors curr_weight and diff_weight *
     566 *****************************************************************************/
     567static int simplify_gcd(intvec* curr_weight, intvec* diff_weight)
     568{
     569  int j;
     570  int nRing = currRing->N;
     571  int gcd_tmp = (*curr_weight)[0];
     572  for (j=1; j<nRing; j++)
     573  {
     574    gcd_tmp = gcd(gcd_tmp, (*curr_weight)[j]);
     575    if(gcd_tmp == 1)
     576    {
     577      break;
     578    }
     579  }
     580  if(gcd_tmp != 1)
     581  {
     582    for (j=0; j<nRing; j++)
     583    {
     584    gcd_tmp = gcd(gcd_tmp, (*diff_weight)[j]);
     585    if(gcd_tmp == 1)
     586      {
     587        break;
     588      }
     589    }
     590  }
     591  return gcd_tmp;
     592}
     593
    564594/*********************************************
    565595 * cancel gcd of integers zaehler and nenner *
     
    18611891}
    18621892
     1893
     1894/**************************************************************
     1895 * Look for the position of the smallest absolut value in vec *
     1896 **************************************************************/
     1897static int MivAbsMaxArg(intvec* vec)
     1898{
     1899  int k = MivAbsMax(vec);
     1900  int i=0;
     1901  while(1)
     1902  {
     1903    if((*vec)[i] == k || (*vec)[i] == -k)
     1904    {
     1905      break;
     1906    }
     1907    i++;
     1908  }
     1909  return i;
     1910}
     1911
     1912
    18631913/**********************************************************************
    18641914 * Compute a next weight vector between curr_weight and target_weight *
     
    18751925
    18761926  int nRing = currRing->N;
    1877   int checkRed, j, kkk, nG = IDELEMS(G);
     1927  int checkRed, j, nG = IDELEMS(G);
    18781928  intvec* ivtemp;
    18791929
     
    19131963  mpz_init(dcw);
    19141964
    1915   //int tn0, tn1, tz1, ncmp, gcd_tmp, ntmp;
    19161965  int gcd_tmp;
    19171966  intvec* diff_weight = MivSub(target_weight, curr_weight);
     
    19191968  intvec* diff_weight1 = MivSub(target_weight, curr_weight);
    19201969  poly g;
    1921   //poly g, gw;
     1970
    19221971  for (j=0; j<nG; j++)
    19231972  {
     
    19812030    }
    19822031  }
    1983 //Print("\n// Alloc Size = %d \n", nRing*sizeof(mpz_t));
     2032  //Print("\n// Alloc Size = %d \n", nRing*sizeof(mpz_t));
    19842033  mpz_t *vec=(mpz_t*)omAlloc(nRing*sizeof(mpz_t));
    19852034
    19862035
    1987   // there is no 0<t<1 and define the next weight vector that is equal to the current weight vector
     2036  // there is no 0<t<1 and define the next weight vector that is equal
     2037  // to the current weight vector
    19882038  if(mpz_cmp(t_nenner, t_null) == 0)
    19892039  {
     
    20562106#endif
    20572107
    2058   //  BOOLEAN isdwpos;
    2059 
    2060   // construct a new weight vector
     2108// construct a new weight vector and check whether vec[j] is overflow,
     2109// i.e. vec[j] > 2^31.
     2110// If vec[j] doesn't overflow, define a weight vector. Otherwise,
     2111// report that overflow appears. In the second case, test whether the
     2112// the correctness of the new vector plays an important role
     2113
    20612114  for (j=0; j<nRing; j++)
    20622115  {
     
    21022155    }
    21032156  }
    2104 
     2157  // reduce the vector with the gcd
     2158  if(mpz_cmp_si(ggt,1) != 0)
     2159  {
     2160    for (j=0; j<nRing; j++)
     2161    {
     2162      mpz_divexact(vec[j], vec[j], ggt);
     2163    }
     2164  }
    21052165#ifdef  NEXT_VECTORS_CC
    21062166  PrintS("\n// gcd of elements of the vector: ");
     
    21082168#endif
    21092169
    2110 /**********************************************************************
    2111 * construct a new weight vector and check whether vec[j] is overflow, *
    2112 * i.e. vec[j] > 2^31.                                                 *
    2113 * If vec[j] doesn't overflow, define a weight vector. Otherwise,      *
    2114 * report that overflow appears. In the second case, test whether the  *
    2115 * the correctness of the new vector plays an important role           *
    2116 **********************************************************************/
    2117   kkk=0;
    21182170  for(j=0; j<nRing; j++)
    21192171    {
     
    21312183
    21322184  REDUCTION:
     2185  checkRed = 1;
    21332186  for (j=0; j<nRing; j++)
    21342187  {
    2135     (*diff_weight)[j] = mpz_get_si(vec[j]);
    2136   }
    2137   while(MivAbsMax(diff_weight) >= 5)
    2138   {
    2139     for (j=0; j<nRing; j++)
    2140     {
    2141       if(mpz_cmp_si(ggt,1)==0)
    2142       {
    2143         (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5);
    2144         // Print("\n//  vector[%d] = %d \n",j+1, (*diff_weight1)[j]);
    2145       }
    2146       else
    2147       {
    2148         mpz_divexact(vec[j], vec[j], ggt);
    2149         (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5);
    2150         // Print("\n//  vector[%d] = %d \n",j+1, (*diff_weight1)[j]);
    2151       }
    2152 /*
    2153       if((*diff_weight1)[j] == 0)
    2154       {
    2155         kkk = kkk + 1;
    2156       }
    2157 */
    2158     }
    2159 
    2160 
    2161 /*
    2162     if(kkk > nRing - 1)
    2163     {
    2164       // diff_weight was reduced to zero
    2165       // Print("\n // MwalkNextWeightCC: geaenderter Vector gleich Null! \n");
    2166       goto TEST_OVERFLOW;
    2167     }
    2168 */
    2169 
    2170     if(test_w_in_ConeCC(G,diff_weight1) != 0)
    2171     {
    2172       Print("\n// MwalkNextWeightCC: geaenderter vector liegt in Groebnerkegel! \n");
    2173       for (j=0; j<nRing; j++)
    2174       {
    2175         (*diff_weight)[j] = (*diff_weight1)[j];
    2176       }
    2177       if(MivAbsMax(diff_weight) < 5)
    2178       {
    2179         checkRed = 1;
    2180         goto SIMPLIFY_GCD;
    2181       }
    2182     }
    2183     else
    2184     {
    2185       // Print("\n// MwalkNextWeightCC: geaenderter vector liegt nicht in Groebnerkegel! \n");
    2186       break;
    2187     }
     2188    (*diff_weight1)[j] = mpz_get_si(vec[j]);
     2189  }
     2190  while(test_w_in_ConeCC(G,diff_weight1))
     2191  {
     2192    for(j=0; j<nRing; j++)
     2193    {
     2194      (*diff_weight)[j] = (*diff_weight1)[j];
     2195      mpz_set_si(vec[j], (*diff_weight)[j]);     
     2196    }
     2197    for(j=0; j<nRing; j++)
     2198    {
     2199      (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5);
     2200    }
     2201  }
     2202  if(MivAbsMax(diff_weight)>10000)
     2203  {
     2204    for(j=0; j<nRing; j++)
     2205    {
     2206      (*diff_weight1)[j] = (*diff_weight)[j];
     2207    }
     2208    j = 0;
     2209    while(test_w_in_ConeCC(G,diff_weight1))
     2210    {
     2211      (*diff_weight)[j] = (*diff_weight1)[j];
     2212      mpz_set_si(vec[j], (*diff_weight)[j]);
     2213      j = MivAbsMaxArg(diff_weight1);
     2214      (*diff_weight1)[j] = floor(0.1*(*diff_weight1)[j] + 0.5);
     2215    }
     2216    goto SIMPLIFY_GCD;
    21882217  }
    21892218
     
    22242253   mpz_clear(t_null);
    22252254
    2226 
    2227 
    22282255  if(Overflow_Error == FALSE)
    22292256  {
    22302257    Overflow_Error = nError;
    22312258  }
    2232  rComplete(currRing);
    2233   for(kkk=0; kkk<IDELEMS(G);kkk++)
    2234   {
    2235     poly p=G->m[kkk];
     2259  rComplete(currRing);
     2260  for(j=0; j<IDELEMS(G); j++)
     2261  {
     2262    poly p=G->m[j];
    22362263    while(p!=NULL)
    22372264    {
     
    22732300}
    22742301
    2275 /**************************************************************
     2302/********************************************************************
    22762303 * define and execute a new ring which order is (a(vb),a(va),lp,C)  *
    2277  * ************************************************************/
     2304 * ******************************************************************/
    22782305static void VMrHomogeneous(intvec* va, intvec* vb)
    22792306{
     
    44454472    {
    44464473      next_weight2 = MkInterRedNextWeight(next_weight22,target_weight,G);
     4474      if(MivAbsMax(next_weight2)>1147483647)
     4475      {
     4476        for(i=0; i<nV; i++)
     4477        {
     4478          (*next_weight22)[i] = (*next_weight2)[i];
     4479        }
     4480        i = 0;
     4481        while(test_w_in_ConeCC(G,next_weight22))
     4482        {
     4483          (*next_weight2)[i] = (*next_weight22)[i];
     4484          i = MivAbsMaxArg(next_weight22);
     4485          (*next_weight22)[i] = floor(0.1*(*next_weight22)[i] + 0.5);
     4486        }
     4487      }
    44474488      delete next_weight22;
    44484489      break;
     
    45754616    else
    45764617    {
    4577       rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung
     4618      rChangeCurrRing(VMrDefault(orig_target_weight));
    45784619    }
    45794620    TargetRing = currRing;
     
    46464687    else
    46474688    {
    4648       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung
     4689      rChangeCurrRing(VMrDefault(curr_weight));
    46494690    }
    46504691    newRing = currRing;
     
    47554796    else
    47564797    {
    4757       rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung
     4798      rChangeCurrRing(VMrDefault(orig_target_weight));
    47584799    }
    47594800    F1 = idrMoveR(G, newRing,currRing);
     
    47864827      else
    47874828      {
    4788         rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung
     4829        rChangeCurrRing(VMrDefault(orig_target_weight));
    47894830      }
    47904831    KSTD_Finish:
     
    48844925      tim = clock();
    48854926      /*
    4886         Print("\n// **** Grᅵbnerwalk took %d steps and ", nwalk);
     4927        Print("\n// **** Groebnerwalk took %d steps and ", nwalk);
    48874928        PrintS("\n// **** call the rec. Pert. Walk to compute a red GB of:");
    48884929        idElements(Gomega, "G_omega");
     
    49144955      oldRing = currRing;
    49154956
    4916       /* create a new ring newRing */
     4957      // create a new ring newRing
    49174958       if (rParameter(currRing) != NULL)
    49184959       {
     
    49214962       else
    49224963       {
    4923          rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung
     4964         rChangeCurrRing(VMrDefault(curr_weight));
    49244965       }
    49254966      newRing = currRing;
     
    49474988      else
    49484989      {
    4949         rChangeCurrRing(VMrDefault(curr_weight));  //Aenderung
     4990        rChangeCurrRing(VMrDefault(curr_weight));
    49504991      }
    49514992      newRing = currRing;
     
    50185059      else
    50195060      {
    5020         rChangeCurrRing(VMrDefault(target_weight)); // Aenderung
     5061        rChangeCurrRing(VMrDefault(target_weight));
    50215062      }
    50225063      F1 = idrMoveR(G, newRing,currRing);
     
    57925833
    57935834  to = clock();
    5794   /* perturbs the original vector */
     5835  // perturbs the original vector
    57955836  if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) := "dp"
    57965837  {
     
    58095850      DefRingPar(curr_weight);
    58105851    else
    5811       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 1
     5852      rChangeCurrRing(VMrDefault(curr_weight));
    58125853
    58135854    G = idrMoveR(Go, XXRing,currRing);
     
    58245865  ring HelpRing = currRing;
    58255866
    5826   /* perturbs the target weight vector */
     5867  // perturbs the target weight vector
    58275868  if(tp_deg > 1 && tp_deg <= nV)
    58285869  {
     
    58305871      DefRingPar(target_weight);
    58315872    else
    5832       rChangeCurrRing(VMrDefault(target_weight)); // Aenderung 2
     5873      rChangeCurrRing(VMrDefault(target_weight));
    58335874
    58345875    TargetRing = currRing;
     
    58915932      DefRingPar(curr_weight);
    58925933    else
    5893       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 3
     5934      rChangeCurrRing(VMrDefault(curr_weight));
    58945935
    58955936    newRing = currRing;
     
    60146055        DefRingPar(orig_target);
    60156056      else
    6016         rChangeCurrRing(VMrDefault(orig_target)); //Aenderung
     6057        rChangeCurrRing(VMrDefault(orig_target));
    60176058
    60186059    TargetRing=currRing;
     
    61926233          DefRingPar(omtmp);
    61936234        else
    6194           rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung3
     6235          rChangeCurrRing(VMrDefault1(omtmp));
    61956236
    61966237        testring = currRing;
     
    62426283      else
    62436284      {
    6244         rChangeCurrRing(VMrDefault1(omtmp)); // Aenderung4
     6285        rChangeCurrRing(VMrDefault1(omtmp));
    62456286      }
    62466287#ifdef TEST_OVERFLOW
     
    62806321        DefRingPar(omtmp);
    62816322      else
    6282         rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung5
     6323        rChangeCurrRing(VMrDefault1(omtmp));
    62836324
    62846325      testring = currRing;
     
    63476388            DefRingPar(Xivinput);
    63486389          else
    6349             rChangeCurrRing(VMrDefault1(Xivinput)); //Aenderung6
     6390            rChangeCurrRing(VMrDefault1(Xivinput));
    63506391
    63516392        testring = currRing;
     
    63946435      DefRingPar(omega);
    63956436    else
    6396       rChangeCurrRing(VMrDefault1(omega)); //Aenderung7
     6437      rChangeCurrRing(VMrDefault1(omega));
    63976438
    63986439    Gomega1 = idrMoveR(Gomega, oRing,currRing);
     
    65176558    /* determine the next border */
    65186559    next_vect = MWalkRandomNextWeight(G, omega,omega2, weight_rad, 1+nlev);
    6519     //next_vect = MkInterRedNextWeight(omega,omega2,G);
     6560    if(isNolVector(next_vect))
     6561    {
     6562      next_vect = MkInterRedNextWeight(omega,omega2,G);
     6563    }
    65206564    xtnw=xtnw+clock()-to;
    65216565#ifdef PRINT_VECTORS
     
    65396583          DefRingPar(omtmp);
    65406584        else
    6541           rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung3
     6585          rChangeCurrRing(VMrDefault1(omtmp));
    65426586
    65436587        testring = currRing;
     
    65896633      else
    65906634      {
    6591         rChangeCurrRing(VMrDefault1(omtmp)); // Aenderung4
     6635        rChangeCurrRing(VMrDefault1(omtmp));
    65926636      }
    65936637#ifdef TEST_OVERFLOW
     
    66276671        DefRingPar(omtmp);
    66286672      else
    6629         rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung5
     6673        rChangeCurrRing(VMrDefault1(omtmp));
    66306674
    66316675      testring = currRing;
     
    66946738            DefRingPar(Xivinput);
    66956739          else
    6696             rChangeCurrRing(VMrDefault1(Xivinput)); //Aenderung6
     6740            rChangeCurrRing(VMrDefault1(Xivinput));
    66976741
    66986742        testring = currRing;
     
    67416785      DefRingPar(omega);
    67426786    else
    6743       rChangeCurrRing(VMrDefault1(omega)); //Aenderung7
     6787      rChangeCurrRing(VMrDefault1(omega));
    67446788
    67456789    Gomega1 = idrMoveR(Gomega, oRing,currRing);
     
    68746918      DefRingPar(ivtarget);
    68756919    else
    6876       rChangeCurrRing(VMrDefault1(ivtarget)); //Aenderung1
     6920      rChangeCurrRing(VMrDefault1(ivtarget));
    68776921
    68786922    I1 = idrMoveR(I, oldRing,currRing);
     
    69036947    DefRingPar(ivstart);
    69046948  else
    6905     rChangeCurrRing(VMrDefault1(ivstart)); //Aenderung2
     6949    rChangeCurrRing(VMrDefault1(ivstart));
    69066950
    69076951  I = idrMoveR(I1,tRing,currRing);
     
    70007044      DefRingPar(ivtarget);
    70017045    else
    7002       rChangeCurrRing(VMrDefault1(ivtarget)); //Aenderung1
     7046      rChangeCurrRing(VMrDefault1(ivtarget));
    70037047
    70047048    I1 = idrMoveR(I, oldRing,currRing);
     
    70297073    DefRingPar(ivstart);
    70307074  else
    7031     rChangeCurrRing(VMrDefault1(ivstart)); //Aenderung2
     7075    rChangeCurrRing(VMrDefault1(ivstart));
    70327076
    70337077  I = idrMoveR(I1,tRing,currRing);
     
    71017145  intvec* hilb_func;
    71027146#endif
    7103   /* to avoid (1,0,...,0) as the target vector */
     7147  // to avoid (1,0,...,0) as the target vector
    71047148  intvec* last_omega = new intvec(nV);
    71057149  for(i=nV-1; i>0; i--)
     
    71167160
    71177161  to=clock();
    7118   /* compute a red. GB w.r.t. the help ring */
     7162  // compute a red. GB w.r.t. the help ring
    71197163  if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) = "dp"
    71207164    G = MstdCC(G);
     
    71257169      DefRingPar(curr_weight);
    71267170    else
    7127       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 4
     7171      rChangeCurrRing(VMrDefault(curr_weight));
    71287172    G = idrMoveR(G, XXRing,currRing);
    71297173    G = MstdCC(G);
     
    71517195      DefRingPar(curr_weight);
    71527196    else
    7153       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 5
     7197      rChangeCurrRing(VMrDefault(curr_weight));
    71547198    to=clock();
    71557199    Gw = idrMoveR(G, exring,currRing);
     
    71867230      DefRingPar(curr_weight);
    71877231    else
    7188       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 6
     7232      rChangeCurrRing(VMrDefault(curr_weight));
    71897233
    71907234    newRing = currRing;
     
    72717315          DefRingPar(target_tmp);
    72727316        else
    7273           rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 8
     7317          rChangeCurrRing(VMrDefault(target_tmp));
    72747318
    72757319      lpRing = currRing;
     
    73317375          DefRingPar(target_tmp);
    73327376        else
    7333           rChangeCurrRing(VMrDefault(target_tmp)); //Aenderung 9
     7377          rChangeCurrRing(VMrDefault(target_tmp));
    73347378
    73357379      lpRing = currRing;
     
    75347578    else
    75357579    {
    7536       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 10
     7580      rChangeCurrRing(VMrDefault(curr_weight));
    75377581    }
    75387582    G = idrMoveR(G, XXRing,currRing);
     
    75677611    else
    75687612    {
    7569       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 11
     7613      rChangeCurrRing(VMrDefault(curr_weight));
    75707614    }
    75717615    to=clock();
     
    76107654    else
    76117655    {
    7612       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 12
     7656      rChangeCurrRing(VMrDefault(curr_weight));
    76137657    }
    76147658    newRing = currRing;
     
    77797823        else
    77807824        {
    7781           rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 13
     7825          rChangeCurrRing(VMrDefault(target_tmp));
    77827826        }
    77837827      }
     
    78527896        else
    78537897        {
    7854           rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 14
     7898          rChangeCurrRing(VMrDefault(target_tmp));
    78557899        }
    78567900      }
     
    80958139    else
    80968140    {
    8097       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 15
     8141      rChangeCurrRing(VMrDefault(curr_weight));
    80988142    }
    80998143    newRing = currRing;
     
    85178561        else
    85188562        {
    8519           rChangeCurrRing(VMrDefault(cw_tmp)); // Aenderung 16
     8563          rChangeCurrRing(VMrDefault(cw_tmp));
    85208564        }
    85218565        G = idrMoveR(Go, XXRing,currRing);
     
    85918635    else
    85928636    {
    8593       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 17
     8637      rChangeCurrRing(VMrDefault(curr_weight));
    85948638    }
    85958639    newRing = currRing;
     
    86538697      else
    86548698      {
    8655         rChangeCurrRing(VMrDefault(target_weight)); // Aenderung 18
     8699        rChangeCurrRing(VMrDefault(target_weight));
    86568700      }
    86578701      F1 = idrMoveR(G, newRing,currRing);
  • Singular/walk.h

    • Property mode changed from 100644 to 100755
  • Tst/Short/bug_interpol.res.gz.uu

    r635bdd rf2ba60d  
    1 begin 640 bug_interpol.res.gz
    2 M'XL("$\INT8``V)U9U]I;G1E<G!O;"YR97,`C5C+;ALW%-W[*]B@"RDRE.&;
    3 MC"(5*+H)4!0HTE6--/%CG(X@2X8DNP&*_GLYA]20(P[']D*V+P\OSSV'3WWZ
    4 MXY>/OQ%"Z(K\^O%G\N9X.,XWS<V;Q<6GT,)6Q`6_--OF.)DN+MK?9+4B-T_?
    5 M7.Q8[Q]WF_FV_F=^.%X?NTY\1;J_Q9R\>T=.V.MCL]N28WTXON\0<A[1:DXV
    6 MS>%(-I&!7K6]G^M;\AR#9M5/.=E</CMZKN4G<KNK[^^;VZ;>'LE]4V_NR.'O
    7 MW9/[=5.3/Q_);D]^_\$CZ_W>_;>[O7W:[^L[EY'X_)MF6Q/SGGP=&.-KQ\&"
    8 M`]DN:55US&CEHP\N&H/4!]<QXG3=-]MO9+]DE]\G=#[?3B_O'F.[D["YJZ\W
    9 M)(F)%;G?[2=MIF9)%\V'AT4SFTV[=B?DO]T_3LGVI^VP=N#UA^5VL4[1Q@.Z
    10 M'JSR`4(>K]:?E]\GZ^EL?[V]VSU,JDLZ[6@PYG'_=0'A`YNKYO,RTF6!P7,;
    11 MIC'LQHU=[;"/7ZYHR\#*Z<Q]:GP:?-KVTPD^=1@&C$!<G2-;S(PZ%`>*HH4'
    12 MK`L+A*NLL^UUEBW*V.$ASK`*6-,;*,WK(!H0A(T/LV)J!S>`RPQN$A$L,"(9
    13 MM5\^K0#@"4`GW2F$-@Q_0U!#L_'X.;V8'>J:JE\T6B"PM@4Y<C<IM-8F&9V'
    14 M5%!6CS)J4P$+B;7J9TD&;S'05<LR-62"LEH,JW&:@E!7\XR:RJDQ2*U91@U>
    15 M,XBO:=9Z)GL+A>BZ2@;U*2"YLL.UGSI#9F6*`J7V,BBO=`(>FOD,HJO7S6O?
    16 M`Q:H?&J7>\`.)<YYA[(XC%"I$66^'$ZHW`DU!(8QBKY$,NT"@U259<Z]Y/!,
    17 MVM?QAG<R]>X%U3@,E+I0:1\+%V7N8C</@8)S,EL\D22,DOFZ*6_1`N9)_KHN
    18 M;0<8*%EAV0V.`1MEOKF=/&\Q\$U68VNCKYF`?<(.F"5@EACR4<`5\>(6VT)A
    19 MBDA-Z1.`'4)F\\<7!"]$[D78XR2$%]GAX-K;5J@L"OK&,Q+*BO%C(]"54%A4
    20 M&;9LG(3$W!;`I\10F^=+(]O])<3GV7G:98+BO'2"0%<)U?G("=(AX0`OG"*E
    21 M7@J^\'Q!I`>F@CT\W<5*9ZN"13P_7(;\5/"(I\=+/B\57&%G-R-TAQ.L=,#T
    22 MM%;P@NFLS@&'%7QAN2^#=S$8Q-)E,2XX;&*BAV\O;#""\0*UL(PTG&`L*P,3
    23 M3D-\1I.L4)BEJZ!\!=50FMHL>?'FHN$`'5D+0$%[F@P?AX345`W8UK9"6SIZ
    24 M=L=4$);F\Q_2&,A+\WD^L-,9B$S32OH;A8'.M#3)T]EK8`"M,FW\M=N_#<86
    25 MRQDU_TPH>P.0O\66%T1DYZ]3!7W/BO;'<3:3>M7Z4V"@6*2P?K-)FGO%63^Y
    26 MRUN11WGQ"S,ZK]$&!ZKI7RR)>N7M]&U(W67K]87<+FE$G5J@L1OT;0Q!3,=F
    27 M/"5D=+J,HR"DJS^F=[_@O<[)T(J&:E"BGUNT8I&\/=T;T,`C=YM/OMY>2"L1
    28 MJ[*VYPJ:92RG/XB*%73]T*!C&?T>)O#U11@?M`E7$]<S]:_-P,OTYR.(^_=F
    29 M8):^E3L`2QB:A&%X:B9CFC"F"&0\PQ"4"9'"];=[`JN$4X[M*^\?F('?R&TG
    30 M?23[!V>@_N(`-C#WY2C_,J\2BJHW*III0BKT8,F8*ILA_@WINOM10AJ1I.&)
    31 M]O[1&)+Q-,UI/ODT`9W.)9:F.>D`=&M?^!Z(5_$;0T[G^,JQ_4;QZ>"VE,6/
    32 +%_\#Q"61#Z@4````
     1begin 644 bug_interpol.res.gz
     2M'XL(")QR;U0``V)U9U]I;G1E<G!O;"YR97,`C5C+;ALW%-WG*XB@"RDVE.&;
     3MC"(5*+H)4&23[HPT\6,:C"!+ACQV`Q3]]W(.J2$I#F5[(=N7AY?GGL.GOOSY
     4M^Z?/A!"Z)G]\^HV\[1_[Q;:[>;M\\R6TL#5QP6_=KNMG\^6;X3=9K\G-TP\7
     5MZ]O#PWZ[V+7_+![[ZW[LQ-=D_%LLR/OWY(B][KO]CO3M8_]A1,A%1*L%V7:/
     6M/=E&!GH]]'YN;\ES#)IUGG*VO7QV]%S+KV2W)X=N]X-<W_;=<^MC[>&P/Y#]
     7M[>W3X=#>N;[$_7O3_KT_M,3GW':[EI@/Y/M$WN_CN!;CDMV*-LW(AC8^>N^B
     8M,4A]<!,C3DL0.ZS8Y<\972QV\\N[A]CN9.ONVNLM26)B31S)V9"I6]%E]_%^
     9MV5U<S,=V)]Z_XS].O>%GZ+!QX,W'U6ZY2='&`\8>K/$!0AZN-E]7/V>;^<7A
     10M>G>WOY\UEW0^TF#,X_X;`\('ME?=UU6DRP*#YR%,8]B-&[O::>^^7=&!@97S
     11M"_>I\6GP:8=/)_C<81@P`G%UBAPP%]2A.%`4+3Q@75@@W!2=;=99#BACIX<X
     12MP2I@3390FM=!-"`(&Q]FU=0.;@"7!=PD(EA@1#)J7CYM`.`)0"?=*80V#']#
     13M4$.+\?@IO9@=ZIHF+QHM$%C;BAREFQ1::Y.,SD,J**O/,AI2`0N)M<JS)(,/
     14M&.BJ99T:,D%9+:;5.$Y!J*MY04V5U!BDUJR@!J\9Q->T:#V1?8!"=-TD@_H4
     15MD%S9Z=J/G2&S,E6!4GL9E%<Z`4_-?`;1U>OFM>\!"U0YM>L]8(<2I[Q#61Q&
     16MJ-2(.E\.)U3IA)H"PQA%7R*9=H%!JBDREUYR>";MZWC#.YEZ]X)J'`9*7:DT
     17MQ\)%6;HXSD.@X)PL%D\D":-DN6[J6[2`>9*_KLO0`09*5EEVDV/`1EEN;D?/
     18M!PQ\D\VYM9%K)F"?L!-F"9@EIGP4<$6\N,4.4)@B4E-R`K!#R&+^^(+@A2B]
     19M"'N<A/"B.!Q<^]`*E45%WWA&0EEQ_M@(="44%DV!K1LG(3&W%?`Q,=3FY=(H
     20M=G\)\7EQGHZ9H#BOG2#054)U?N8$&9%P@%=.D5HO!5]XN2#2`U/!'I[N8K6S
     21M5<$B7AXN4WXJ>,33XZ6<EPJNL).;$;K#"58[8#*M%;Q@NJASPF$%7UCIR^1=
     22M#`:Q=%F<%QPV,9'AAPL;C&"\0BTL(PTG&"O*P(33$)_1)"L49NDJJ%]!-92F
     23MMDA>O;EH.$#/K`6@H#U-AH]#0FJJ)FP;6J$M/7MVQU00EI;S'](8R$O+>3ZQ
     24MTQF(3--*\HW"0&=:F^3I[#4P@#:%-O[:[=\&YQ;+"37_3*A[`Y"_Q=871&3G
     25MKU,5?4^*]L=Q,9.R:OTI,%$L4EB_V23-67'63^[Z5N117OS*C"YKM,&!9OX7
     26M2Z)>>3M_%U*/V;*^D-LEC:AC"S1V@[Z+(8CIV)Q/"1F=+N=1$-+5'].[7_!>
     27MEV1H0T,U*-'/+=JP2-X>[PUHX)&[+2=?MA?21L2JK,U<0;.,Y>2#J%C!V`\-
     28M.I:1]S"!KR_"^*!-N)JXGJE_;09>)I^/(.[?FX%9^E8>`2QA:!*&X:F9C&G"
     29MF"*0\0Q#4"9$*M??\0FL$DXE-E?>/S`#OS.WG?21[!^<@?J+`]C`W)>C_,N\
     30M22BJ;%0TTX14Z,&2,54Q0_P;TG7WHX0T(DG#$^W]HS$DXVF:XWSR:0(ZG4LL
     31G37/4`>C!OO`]$&_BMX2<+O`UX_`MXM.CVU*6O[SY'YL/6_J<%```
    3332`
    3433end
  • Tst/Short/ok_s.lst

    r635bdd rf2ba60d  
    33bug_minpoly
    44bug_newstruct
     5bug_ring
    56bug_ringlist
    67bug_tr237
     
    2627bug_tr667
    2728bug_tr668
     29bug_tr671
    2830bug_genus_etc
    2931facstd
  • factory/facFqFactorize.cc

    r635bdd rf2ba60d  
    26212621      iter2.getItem() *= power (xx, degree (LC (iter.getItem(),1), xx));
    26222622  }
    2623   CanonicalForm tmp;
     2623  CanonicalForm tmp, quot1, quot2, quot3;
    26242624  iter2= vars1;
    26252625  for (iter= leadingCoeffs[lengthAeval-1]; iter.hasItem(); iter++, iter2++)
     
    26612661            {
    26622662              tmp= ii.getItem().factor();
    2663               iter2.getItem() /= tmp;
    2664               CFListIterator iter3= evaluation;
    2665               for (int jj= A.level(); jj > 2; jj--, iter3++)
    2666                 tmp= tmp (iter3.getItem(), jj);
    2667               if (!tmp.inCoeffDomain())
     2663              if (fdivides (tmp, iter2.getItem(), quot1))
    26682664              {
    2669                 int index3= 1;
    2670                 for (iter3= biFactors; iter3.hasItem(); iter3++, index3++)
     2665                CFListIterator iter3= evaluation;
     2666                for (int jj= A.level(); jj > 2; jj--, iter3++)
     2667                  tmp= tmp (iter3.getItem(), jj);
     2668                if (!tmp.inCoeffDomain())
    26712669                {
    2672                   if (index3 == index2)
     2670                  int index3= 1;
     2671                  for (iter3= biFactors; iter3.hasItem(); iter3++, index3++)
    26732672                  {
    2674                     iter3.getItem() /= tmp;
    2675                     iter3.getItem() /= Lc (iter3.getItem());
    2676                     break;
     2673                    if (index3 == index2)
     2674                    {
     2675                      if (fdivides (tmp, iter3.getItem(), quot2))
     2676                      {
     2677                        if (fdivides (ii.getItem().factor(), A, quot3))
     2678                        {
     2679                          A               = quot3;
     2680                          iter2.getItem() = quot2;
     2681                          iter3.getItem() = quot3;
     2682                          iter3.getItem() /= Lc (iter3.getItem());
     2683                          break;
     2684                        }
     2685                      }
     2686                    }
    26772687                  }
    26782688                }
    26792689              }
    2680               A /= ii.getItem().factor();
    26812690            }
    26822691          }
     
    26992708            {
    27002709              tmp= power (ii.getItem().factor(), ii.getItem().exp());
    2701               iter2.getItem() /= tmp;
    2702               A /= tmp;
    2703               CFListIterator iter3= evaluation;
    2704               for (int jj= A.level(); jj > 2; jj--, iter3++)
    2705                 tmp= tmp (iter3.getItem(), jj);
    2706               if (!tmp.inCoeffDomain())
     2710              if (fdivides (tmp, A, quot1))
    27072711              {
    2708                 int index3= 1;
    2709                 for (iter3= biFactors; iter3.hasItem(); iter3++, index3++)
     2712                if (fdivides (tmp, iter2.getItem()))
    27102713                {
    2711                   if (index3 == index2)
     2714                  CFListIterator iter3= evaluation;
     2715                  for (int jj= A.level(); jj > 2; jj--, iter3++)
     2716                    tmp= tmp (iter3.getItem(), jj);
     2717                  if (!tmp.inCoeffDomain())
    27122718                  {
    2713                     iter3.getItem() /= tmp;
    2714                     iter3.getItem() /= Lc (iter3.getItem());
    2715                     break;
     2719                    int index3= 1;
     2720                    for (iter3= biFactors; iter3.hasItem(); iter3++, index3++)
     2721                    {
     2722                      if (index3 == index2)
     2723                      {
     2724                        if (fdivides (tmp, iter3.getItem(), quot3))
     2725                        {
     2726                          A               =  quot1;
     2727                          iter2.getItem() =  quot2;
     2728                          iter3.getItem() =  quot3;
     2729                          iter3.getItem() /= Lc (iter3.getItem());
     2730                          break;
     2731                        }
     2732                      }
     2733                    }
    27162734                  }
    27172735                }
  • kernel/GBEngine/tgb.cc

    r635bdd rf2ba60d  
    4040#if 1
    4141static omBin lm_bin = NULL;
     42static int add_to_reductors(slimgb_alg* c, poly h, int len, int ecart, BOOLEAN simplified=FALSE);
     43static void multi_reduction(red_object* los, int & losl, slimgb_alg* c);
     44static void multi_reduce_step(find_erg & erg, red_object* r, slimgb_alg* c);
     45static BOOLEAN extended_product_criterion(poly p1, poly gcd1, poly p2, poly gcd2, slimgb_alg* c);
     46static poly gcd_of_terms(poly p, ring r);
     47static int tgb_pair_better_gen(const void* ap,const void* bp);
     48static BOOLEAN pair_better(sorted_pair_node* a,sorted_pair_node* b, slimgb_alg* c=NULL);
     49static BOOLEAN state_is(calc_state state, const int & i, const int & j, slimgb_alg* c);
     50static void super_clean_top_of_pair_list(slimgb_alg* c);
     51static int simple_posInS (kStrategy strat, poly p,int len, wlen_type wlen);
     52static int* make_connections(int from, int to, poly bound, slimgb_alg* c);
     53static BOOLEAN has_t_rep(const int & arg_i, const int & arg_j, slimgb_alg* state);
     54static void shorten_tails(slimgb_alg* c, poly monom);
     55static poly redNF2 (poly h,slimgb_alg* c , int &len, number&  m,int n=0);
     56static poly redNFTail (poly h,const int sl,kStrategy strat, int len);
     57static int bucket_guess(kBucket* bucket);
    4258
    4359static void simplify_poly (poly p, ring r)
  • kernel/GBEngine/tgb_internal.h

    r635bdd rf2ba60d  
    309309    //SOONTREP
    310310  };
    311 //static BOOLEAN pair_cmp(sorted_pair_node* a,sorted_pair_node* b);
    312311template <class len_type, class set_type>  int pos_helper(kStrategy strat, poly p, len_type len, set_type setL, polyset set);
    313 static int add_to_reductors(slimgb_alg* c, poly h, int len, int ecart, BOOLEAN simplified=FALSE);
    314 static int bucket_guess(kBucket* bucket);
    315 static poly redNFTail (poly h,const int sl,kStrategy strat, int len);
    316 static poly redNF2 (poly h,slimgb_alg* c , int &len, number&  m,int n=0);
    317312void free_sorted_pair_node(sorted_pair_node* s, ring r);
    318 static void shorten_tails(slimgb_alg* c, poly monom);
    319 static void replace_pair(int & i, int & j, slimgb_alg* c);
    320 //static sorted_pair_node** add_to_basis(poly h, int i, int j,slimgb_alg* c, int* ip=NULL);
    321 //static void do_this_spoly_stuff(int i,int j,slimgb_alg* c);
    322 //ideal t_rep_gb(ring r,ideal arg_I);
    323313ideal do_t_rep_gb(ring r,ideal arg_I, int syz_comp, BOOLEAN F4_mode,int deg_pos);
    324 static BOOLEAN has_t_rep(const int & arg_i, const int & arg_j, slimgb_alg* state);
    325 //static int* make_connections(int from, poly bound, slimgb_alg* c);
    326 static int* make_connections(int from, int to, poly bound, slimgb_alg* c);
    327314void now_t_rep(const int & arg_i, const int & arg_j, slimgb_alg* c);
    328 //static void soon_t_rep(const int & arg_i, const int & arg_j, slimgb_alg* c);
    329 //static int pLcmDeg(poly a, poly b);
    330 static int simple_posInS (kStrategy strat, poly p,int len, wlen_type wlen);
    331 //static BOOLEAN find_next_pair(slimgb_alg* c, BOOLEAN go_higher=TRUE);
    332 
    333 //static sorted_pair_node* pop_pair(slimgb_alg* c);
    334 //static BOOLEAN no_pairs(slimgb_alg* c);
     315
    335316void clean_top_of_pair_list(slimgb_alg* c);
    336 static void super_clean_top_of_pair_list(slimgb_alg* c);
    337 static BOOLEAN state_is(calc_state state, const int & i, const int & j, slimgb_alg* c);
    338 static BOOLEAN pair_better(sorted_pair_node* a,sorted_pair_node* b, slimgb_alg* c=NULL);
    339 static int tgb_pair_better_gen(const void* ap,const void* bp);
    340 static poly redTailShort(poly h, kStrategy strat);
    341 static poly gcd_of_terms(poly p, ring r);
    342 static BOOLEAN extended_product_criterion(poly p1, poly gcd1, poly p2, poly gcd2, slimgb_alg* c);
    343 //static poly kBucketGcd(kBucket* b, ring r);
    344 static void multi_reduction(red_object* los, int & losl, slimgb_alg* c);
    345317int slim_nsize(number n, ring r);
    346318sorted_pair_node* quick_pop_pair(slimgb_alg* c);
     
    351323int tgb_pair_better_gen2(const void* ap,const void* bp);
    352324int kFindDivisibleByInS_easy(kStrategy strat,poly p, long sev);
    353 //static int quality(poly p, int len, slimgb_alg* c);
    354325/**
    355326   makes on each red_object in a region a single_step
     
    402373
    403374};
    404 
    405 static void multi_reduce_step(find_erg & erg, red_object* r, slimgb_alg* c);
    406 //static void finalize_reduction_step(reduction_step* r);
    407375
    408376template <class len_type, class set_type>  int pos_helper(kStrategy strat, poly p, len_type len, set_type setL, polyset set)
     
    14571425}
    14581426#endif
    1459 static wlen_type pair_weighted_length(int i, int j, slimgb_alg* c);
    14601427wlen_type pELength(poly p, ring r);
    14611428int terms_sort_crit(const void* a, const void* b);
  • libpolys/coeffs/Makefile.am

    r635bdd rf2ba60d  
    2424libcoeffs_la_include_HEADERS = \
    2525  coeffs.h numbers.h si_gmp.h gnumpc.h gnumpfl.h longrat.h modulop.h ffields.h rintegers.h rmodulo2m.h rmodulon.h \
    26   shortfl.h mpr_complex.h mpr_global.h \
     26  shortfl.h mpr_complex.h mpr_global.h numstats.h \
    2727  bigintmat.h Enumerator.h AE.h OPAE.h AEp.h OPAEp.h AEQ.h OPAEQ.h
    2828
  • libpolys/coeffs/OPAE.cc

    r635bdd rf2ba60d  
    298298    // r->is_field, r->is_domain?
    299299    r->ch = 0;
    300     r->cfKillChar = ndKillChar; /* dummy */
    301     r->nCoeffIsEqual=ndCoeffIsEqual;
     300    //r->cfKillChar = ndKillChar; /* dummy */
     301    //r->nCoeffIsEqual=ndCoeffIsEqual;
    302302    r->cfMult  = nAEMult;
    303303    r->cfSub   = nAESub;
  • libpolys/coeffs/OPAEQ.cc

    r635bdd rf2ba60d  
    290290    // r->is_field,is_domain?
    291291    r->ch=0;
    292     r->cfKillChar=ndKillChar;
    293     r->nCoeffIsEqual=ndCoeffIsEqual;
     292    //r->cfKillChar=ndKillChar;
     293    //r->nCoeffIsEqual=ndCoeffIsEqual;
    294294    r->cfMult  = nAEQMult;
    295295    r->cfSub   = nAEQSub;
  • libpolys/coeffs/OPAEp.cc

    r635bdd rf2ba60d  
    316316    r->ch=c;
    317317    r->cfKillChar=NULL;
    318     r->nCoeffIsEqual=ndCoeffIsEqual;
     318    //r->nCoeffIsEqual=ndCoeffIsEqual;
    319319    r->cfMult  = nAEpMult;
    320320    r->cfSub   = nAEpSub;
  • libpolys/coeffs/bigintmat.cc

    r635bdd rf2ba60d  
    15571557    char * s;
    15581558    ::Print("mat over Z is \n");
    1559     ::Print("%s\n", s = basecoeffs()->cfCoeffString(basecoeffs()));
     1559    ::Print("%s\n", s = nCoeffString(basecoeffs()));
    15601560    omFree(s);
    15611561    Print();
  • libpolys/coeffs/coeffs.h

    r635bdd rf2ba60d  
    1717
    1818#include <coeffs/si_gmp.h>
    19 
    2019#include <coeffs/Enumerator.h>
     20#include <coeffs/numstats.h> // for STATISTIC(F) counting macro
    2121
    2222class CanonicalForm;
     
    268268   nMapFunc (*cfSetMap)(const coeffs src, const coeffs dst);
    269269
    270    /// io via ssi:
    271270   void    (*cfWriteFd)(number a, FILE *f, const coeffs r);
    272271   number  (*cfReadFd)( s_buff f, const coeffs r);
     
    416415#endif
    417416};
    418 //
     417
    419418// test properties and type
    420419/// Returns the type of coeffs domain
    421 static inline n_coeffType getCoeffType(const coeffs r)
    422 {
    423   assume(r != NULL);
    424   return r->type;
    425 }
     420static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
     421{ assume(r != NULL); return r->type; }
    426422
    427423/// one-time initialisations for new coeffs
     
    430426
    431427/// "copy" coeffs, i.e. increment ref
    432 static inline coeffs nCopyCoeff(const coeffs cf) { cf->ref++; return cf;}
     428static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
     429{ assume(r!=NULL); r->ref++; return r;}
    433430
    434431/// undo all initialisations
     
    436433
    437434/// initialisations after each ring change
    438 static inline void nSetChar(const coeffs r)
    439 {
    440   assume(r!=NULL); // r==NULL is an error
    441   assume(r->cfSetChar != NULL);
    442   r->cfSetChar(r);
    443 }
     435static FORCE_INLINE void nSetChar(const coeffs r)
     436{ STATISTIC(nSetChar);  assume(r!=NULL); assume(r->cfSetChar != NULL); r->cfSetChar(r); }
    444437
    445438void           nNew(number * a);
     
    448441
    449442/// Return the characteristic of the coeff. domain.
    450 static inline int n_GetChar(const coeffs r)
    451 {
    452   assume(r != NULL);
    453   return r->ch;
    454 }
     443static FORCE_INLINE int n_GetChar(const coeffs r)
     444{ STATISTIC(n_GetChar); assume(r != NULL); return r->ch; }
    455445
    456446
     
    458448
    459449/// return a copy of 'n'
    460 static inline number n_Copy(number n,    const coeffs r)
    461 {   assume(r != NULL); assume(r->cfCopy!=NULL); return r->cfCopy(n, r); }
     450static FORCE_INLINE number n_Copy(number n,    const coeffs r)
     451{ STATISTIC(n_Copy);   assume(r != NULL); assume(r->cfCopy!=NULL); return r->cfCopy(n, r); }
    462452
    463453/// delete 'p'
    464 static inline void   n_Delete(number* p, const coeffs r)
    465 {   assume(r != NULL); assume(r->cfDelete!= NULL); r->cfDelete(p, r); }
     454static FORCE_INLINE void   n_Delete(number* p, const coeffs r)
     455{ STATISTIC(n_Delete);   assume(r != NULL); assume(r->cfDelete!= NULL); r->cfDelete(p, r); }
    466456
    467457/// TRUE iff 'a' and 'b' represent the same number;
    468458/// they may have different representations
    469 static inline BOOLEAN n_Equal(number a, number b, const coeffs r)
    470 { assume(r != NULL); assume(r->cfEqual!=NULL); return r->cfEqual(a, b, r); }
     459static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
     460{ STATISTIC(n_Equal); assume(r != NULL); assume(r->cfEqual!=NULL); return r->cfEqual(a, b, r); }
    471461
    472462/// TRUE iff 'n' represents the zero element
    473 static inline BOOLEAN n_IsZero(number n, const coeffs r)
    474 { assume(r != NULL); assume(r->cfIsZero!=NULL); return r->cfIsZero(n,r); }
     463static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
     464{ STATISTIC(n_IsZero); assume(r != NULL); assume(r->cfIsZero!=NULL); return r->cfIsZero(n,r); }
    475465
    476466/// TRUE iff 'n' represents the one element
    477 static inline BOOLEAN n_IsOne(number n,  const coeffs r)
    478 { assume(r != NULL); assume(r->cfIsOne!=NULL); return r->cfIsOne(n,r); }
     467static FORCE_INLINE BOOLEAN n_IsOne(number n,  const coeffs r)
     468{ STATISTIC(n_IsOne); assume(r != NULL); assume(r->cfIsOne!=NULL); return r->cfIsOne(n,r); }
    479469
    480470/// TRUE iff 'n' represents the additive inverse of the one element, i.e. -1
    481 static inline BOOLEAN n_IsMOne(number n, const coeffs r)
    482 { assume(r != NULL); assume(r->cfIsMOne!=NULL); return r->cfIsMOne(n,r); }
     471static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
     472{ STATISTIC(n_IsMOne); assume(r != NULL); assume(r->cfIsMOne!=NULL); return r->cfIsMOne(n,r); }
    483473
    484474/// ordered fields: TRUE iff 'n' is positive;
     
    501491///     start with -
    502492///
    503 static inline BOOLEAN n_GreaterZero(number n, const coeffs r)
    504 {
    505   assume(r != NULL); assume(r->cfGreaterZero!=NULL);
    506   return r->cfGreaterZero(n,r);
    507 }
     493static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
     494{ STATISTIC(n_GreaterZero); assume(r != NULL); assume(r->cfGreaterZero!=NULL); return r->cfGreaterZero(n,r); }
    508495
    509496/// ordered fields: TRUE iff 'a' is larger than 'b';
     
    521508/// !!! Recommendation: remove implementations for unordered fields
    522509/// !!!                 and raise errors instead, in these cases
    523 static inline BOOLEAN n_Greater(number a, number b, const coeffs r)
    524 { assume(r != NULL); assume(r->cfGreater!=NULL); return r->cfGreater(a,b,r); }
     510static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
     511{ STATISTIC(n_Greater); assume(r != NULL); assume(r->cfGreater!=NULL); return r->cfGreater(a,b,r); }
    525512
    526513#ifdef HAVE_RINGS
    527 static inline int n_DivComp(number a, number b, const coeffs r)
    528 { assume(r != NULL); assume(r->cfDivComp!=NULL); return r->cfDivComp (a,b,r); }
     514static FORCE_INLINE int n_DivComp(number a, number b, const coeffs r)
     515{ STATISTIC(n_DivComp); assume(r != NULL); assume(r->cfDivComp!=NULL); return r->cfDivComp (a,b,r); }
    529516
    530517/// TRUE iff n has a multiplicative inverse in the given coeff field/ring r
    531 static inline BOOLEAN n_IsUnit(number n, const coeffs r)
    532 { assume(r != NULL); assume(r->cfIsUnit!=NULL); return r->cfIsUnit(n,r); }
     518static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
     519{ STATISTIC(n_IsUnit); assume(r != NULL); assume(r->cfIsUnit!=NULL); return r->cfIsUnit(n,r); }
    533520
    534521/// in Z: 1
     
    539526// CF: shold imply that n/GetUnit(n) is normalized in Z/kZ
    540527//   it would make more sense to return the inverse...
    541 static inline number n_GetUnit(number n, const coeffs r)
    542 { assume(r != NULL); assume(r->cfGetUnit!=NULL); return r->cfGetUnit(n,r); }
    543 
    544 static inline coeffs n_CoeffRingQuot1(number c, const coeffs r)
    545 { assume(r != NULL); assume(r->cfQuot1 != NULL); return r->cfQuot1(c, r); }
     528static FORCE_INLINE number n_GetUnit(number n, const coeffs r)
     529{ STATISTIC(n_GetUnit); assume(r != NULL); assume(r->cfGetUnit!=NULL); return r->cfGetUnit(n,r); }
     530
     531static FORCE_INLINE coeffs n_CoeffRingQuot1(number c, const coeffs r)
     532{ STATISTIC(n_CoeffRingQuot1); assume(r != NULL); assume(r->cfQuot1 != NULL); return r->cfQuot1(c, r); }
    546533#endif
    547534
    548535/// a number representing i in the given coeff field/ring r
    549 static inline number n_Init(long i,       const coeffs r)
    550 { assume(r != NULL); assume(r->cfInit!=NULL); return r->cfInit(i,r); }
     536static FORCE_INLINE number n_Init(long i,       const coeffs r)
     537{ STATISTIC(n_Init); assume(r != NULL); assume(r->cfInit!=NULL); return r->cfInit(i,r); }
    551538
    552539/// conversion of a GMP integer to number
    553 static inline number n_InitMPZ(mpz_t n,     const coeffs r)
    554 { assume(r != NULL); assume(r->cfInitMPZ != NULL); return r->cfInitMPZ(n,r); }
     540static FORCE_INLINE number n_InitMPZ(mpz_t n,     const coeffs r)
     541{ STATISTIC(n_InitMPZ); assume(r != NULL); assume(r->cfInitMPZ != NULL); return r->cfInitMPZ(n,r); }
    555542
    556543/// conversion of n to an int; 0 if not possible
    557544/// in Z/pZ: the representing int lying in (-p/2 .. p/2]
    558 static inline int n_Int(number &n,       const coeffs r)
    559 { assume(r != NULL); assume(r->cfInt!=NULL); return r->cfInt(n,r); }
     545static FORCE_INLINE int n_Int(number &n,       const coeffs r)
     546{ STATISTIC(n_Int); assume(r != NULL); assume(r->cfInt!=NULL); return r->cfInt(n,r); }
    560547
    561548/// conversion of n to a GMP integer; 0 if not possible
    562 static inline void n_MPZ(mpz_t result, number &n,       const coeffs r)
    563 { assume(r != NULL); assume(r->cfMPZ!=NULL); r->cfMPZ(result, n, r); }
     549static FORCE_INLINE void n_MPZ(mpz_t result, number &n,       const coeffs r)
     550{ STATISTIC(n_MPZ); assume(r != NULL); assume(r->cfMPZ!=NULL); r->cfMPZ(result, n, r); }
    564551
    565552
    566553/// in-place negation of n
    567554/// MUST BE USED: n = n_InpNeg(n) (no copy is returned)
    568 static inline number n_InpNeg(number n,     const coeffs r)
    569 { assume(r != NULL); assume(r->cfInpNeg!=NULL); return r->cfInpNeg(n,r); }
     555static FORCE_INLINE number n_InpNeg(number n,     const coeffs r)
     556{ STATISTIC(n_InpNeg); assume(r != NULL); assume(r->cfInpNeg!=NULL); return r->cfInpNeg(n,r); }
    570557
    571558/// return the multiplicative inverse of 'a';
     
    573560///
    574561/// !!! Recommendation: rename to 'n_Inverse'
    575 static inline number n_Invers(number a,  const coeffs r)
    576 { assume(r != NULL); assume(r->cfInvers!=NULL); return r->cfInvers(a,r); }
     562static FORCE_INLINE number n_Invers(number a,  const coeffs r)
     563{ STATISTIC(n_Invers); assume(r != NULL); assume(r->cfInvers!=NULL); return r->cfInvers(a,r); }
    577564
    578565/// return a non-negative measure for the complexity of n;
    579566/// return 0 only when n represents zero;
    580567/// (used for pivot strategies in matrix computations with entries from r)
    581 static inline int    n_Size(number n,    const coeffs r)
    582 { assume(r != NULL); assume(r->cfSize!=NULL); return r->cfSize(n,r); }
     568static FORCE_INLINE int    n_Size(number n,    const coeffs r)
     569{ STATISTIC(n_Size); assume(r != NULL); assume(r->cfSize!=NULL); return r->cfSize(n,r); }
    583570
    584571/// inplace-normalization of n;
     
    587574/// !!! Recommendation: remove this method from the user-interface, i.e.,
    588575/// !!!                 this should be hidden
    589 static inline void   n_Normalize(number& n, const coeffs r)
    590 { assume(r != NULL); assume(r->cfNormalize!=NULL); r->cfNormalize(n,r); }
     576static FORCE_INLINE void   n_Normalize(number& n, const coeffs r)
     577{ STATISTIC(n_Normalize); assume(r != NULL); assume(r->cfNormalize!=NULL); r->cfNormalize(n,r); }
    591578
    592579/// write to the output buffer of the currently used reporter
    593580//CF: the "&" should be removed, as one wants to write constants as well
    594 static inline void   n_WriteLong(number& n,  const coeffs r)
    595 { assume(r != NULL); assume(r->cfWriteLong!=NULL); r->cfWriteLong(n,r); }
     581static FORCE_INLINE void   n_WriteLong(number& n,  const coeffs r)
     582{ STATISTIC(n_WriteLong); assume(r != NULL); assume(r->cfWriteLong!=NULL); r->cfWriteLong(n,r); }
    596583
    597584/// write to the output buffer of the currently used reporter
    598585/// in a shortest possible way, e.g. in K(a): a2 instead of a^2
    599 static inline void   n_WriteShort(number& n,  const coeffs r)
    600 { assume(r != NULL); assume(r->cfWriteShort!=NULL); r->cfWriteShort(n,r); }
    601 
    602 static inline void   n_Write(number& n,  const coeffs r, const BOOLEAN bShortOut = TRUE)
    603 { if (bShortOut) n_WriteShort(n, r); else n_WriteLong(n, r); }
     586static FORCE_INLINE void   n_WriteShort(number& n,  const coeffs r)
     587{ STATISTIC(n_WriteShort); assume(r != NULL); assume(r->cfWriteShort!=NULL); r->cfWriteShort(n,r); }
     588
     589static FORCE_INLINE void   n_Write(number& n,  const coeffs r, const BOOLEAN bShortOut = TRUE)
     590{ STATISTIC(n_Write); if (bShortOut) n_WriteShort(n, r); else n_WriteLong(n, r); }
    604591
    605592
     
    607594/// !!!                 interface. As defined here, it is merely a helper
    608595/// !!!                 method for parsing number input strings.
    609 static inline const char *n_Read(const char * s, number * a, const coeffs r)
    610 { assume(r != NULL); assume(r->cfRead!=NULL); return r->cfRead(s, a, r); }
     596static FORCE_INLINE const char *n_Read(const char * s, number * a, const coeffs r)
     597{ STATISTIC(n_Read); assume(r != NULL); assume(r->cfRead!=NULL); return r->cfRead(s, a, r); }
    611598
    612599/// return the denominator of n
    613600/// (if elements of r are by nature not fractional, result is 1)
    614 static inline number n_GetDenom(number& n, const coeffs r)
    615 { assume(r != NULL); assume(r->cfGetDenom!=NULL); return r->cfGetDenom(n, r); }
     601static FORCE_INLINE number n_GetDenom(number& n, const coeffs r)
     602{ STATISTIC(n_GetDenom); assume(r != NULL); assume(r->cfGetDenom!=NULL); return r->cfGetDenom(n, r); }
    616603
    617604/// return the numerator of n
    618605/// (if elements of r are by nature not fractional, result is n)
    619 static inline number n_GetNumerator(number& n, const coeffs r)
    620 { assume(r != NULL); assume(r->cfGetNumerator!=NULL); return r->cfGetNumerator(n, r); }
    621 
    622 /// fill res with the power a^b
    623 static inline void   n_Power(number a, int b, number *res, const coeffs r)
    624 { assume(r != NULL); assume(r->cfPower!=NULL); r->cfPower(a,b,res,r); }
    625 
    626 /// return the product of 'a' and 'b', i.e., a*b
    627 static inline number n_Mult(number a, number b, const coeffs r)
    628 { assume(r != NULL); assume(r->cfMult!=NULL); return r->cfMult(a, b, r); }
    629 
    630 /// multiplication of 'a' and 'b';
    631 /// replacement of 'a' by the product a*b
    632 static inline void n_InpMult(number &a, number b, const coeffs r)
    633 { assume(r != NULL); assume(r->cfInpMult!=NULL); r->cfInpMult(a,b,r); }
    634 
    635 /// addition of 'a' and 'b';
    636 /// replacement of 'a' by the sum a+b
    637 static inline void n_InpAdd(number &a, number b, const coeffs r)
    638 { assume(r != NULL); assume(r->cfInpAdd!=NULL); r->cfInpAdd(a,b,r); }
    639 
    640 /// return the difference of 'a' and 'b', i.e., a-b
    641 static inline number n_Sub(number a, number b, const coeffs r)
    642 { assume(r != NULL); assume(r->cfSub!=NULL); return r->cfSub(a, b, r); }
    643 
    644 /// return the sum of 'a' and 'b', i.e., a+b
    645 static inline number n_Add(number a, number b, const coeffs r)
    646 { assume(r != NULL); assume(r->cfAdd!=NULL); return r->cfAdd(a, b, r); }
     606static FORCE_INLINE number n_GetNumerator(number& n, const coeffs r)
     607{ STATISTIC(n_GetNumerator); assume(r != NULL); assume(r->cfGetNumerator!=NULL); return r->cfGetNumerator(n, r); }
    647608
    648609/// return the quotient of 'a' and 'b', i.e., a/b;
    649610/// raise an error if 'b' is not invertible in r
    650 static inline number n_Div(number a, number b, const coeffs r)
    651 { assume(r != NULL); assume(r->cfDiv!=NULL); return r->cfDiv(a,b,r); }
    652 
    653 /// for r a field, return n_Init(0,r)
    654 /// otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
    655 static inline number n_IntMod(number a, number b, const coeffs r)
    656 { assume(r != NULL); return r->cfIntMod(a,b,r); }
     611static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
     612{ STATISTIC(n_Div); assume(r != NULL); assume(r->cfDiv!=NULL); return r->cfDiv(a,b,r); }
    657613
    658614/// assume that there is a canonical subring in cf and we know
     
    660616/// n_ExactDiv performs it, may skip additional tests.
    661617/// Can always be substituted by n_Div at the cost of larger  computing time.
    662 static inline number n_ExactDiv(number a, number b, const coeffs r)
    663 { assume(r != NULL); assume(r->cfExactDiv!=NULL); return r->cfExactDiv(a,b,r); }
     618static FORCE_INLINE number n_ExactDiv(number a, number b, const coeffs r)
     619{ STATISTIC(n_ExactDiv); assume(r != NULL); assume(r->cfExactDiv!=NULL); return r->cfExactDiv(a,b,r); }
     620
     621/// for r a field, return n_Init(0,r)
     622/// otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
     623static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
     624{ STATISTIC(n_IntMod); assume(r != NULL); return r->cfIntMod(a,b,r); }
     625
     626/// fill res with the power a^b
     627static FORCE_INLINE void   n_Power(number a, int b, number *res, const coeffs r)
     628{ STATISTIC(n_Power); assume(r != NULL); assume(r->cfPower!=NULL); r->cfPower(a,b,res,r); }
     629
     630/// return the product of 'a' and 'b', i.e., a*b
     631static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
     632{ STATISTIC(n_Mult); assume(r != NULL); assume(r->cfMult!=NULL); return r->cfMult(a, b, r); }
     633
     634/// multiplication of 'a' and 'b';
     635/// replacement of 'a' by the product a*b
     636static FORCE_INLINE void n_InpMult(number &a, number b, const coeffs r)
     637{ STATISTIC(n_InpMult); assume(r != NULL); assume(r->cfInpMult!=NULL); r->cfInpMult(a,b,r); }
     638
     639/// addition of 'a' and 'b';
     640/// replacement of 'a' by the sum a+b
     641static FORCE_INLINE void n_InpAdd(number &a, number b, const coeffs r)
     642{ STATISTIC(n_InpAdd); assume(r != NULL); assume(r->cfInpAdd!=NULL); r->cfInpAdd(a,b,r);
     643
     644#ifdef HAVE_NUMSTATS
     645  // avoid double counting
     646  if( r->cfIsZero(a,r) ) STATISTIC(n_CancelOut);
     647#endif
     648}
     649
     650/// return the sum of 'a' and 'b', i.e., a+b
     651static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
     652{ STATISTIC(n_Add); assume(r != NULL); assume(r->cfAdd!=NULL); const number sum = r->cfAdd(a, b, r);
     653   
     654#ifdef HAVE_NUMSTATS
     655  // avoid double counting
     656  if( r->cfIsZero(sum,r) ) STATISTIC(n_CancelOut);
     657#endif
     658   
     659 return sum;
     660}
     661
     662
     663/// return the difference of 'a' and 'b', i.e., a-b
     664static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
     665{ STATISTIC(n_Sub); assume(r != NULL); assume(r->cfSub!=NULL); const number d = r->cfSub(a, b, r);
     666
     667#ifdef HAVE_NUMSTATS
     668  // avoid double counting
     669  if( r->cfIsZero(d,r) ) STATISTIC(n_CancelOut);
     670#endif
     671
     672  return d;
     673}
    664674
    665675/// in Z: return the gcd of 'a' and 'b'
     
    669679/// in K(a)/<p(a)>: not implemented
    670680/// in K(t_1, ..., t_n): not implemented
    671 static inline number n_Gcd(number a, number b, const coeffs r)
    672 { assume(r != NULL); assume(r->cfGcd!=NULL); return r->cfGcd(a,b,r); }
    673 static inline number n_SubringGcd(number a, number b, const coeffs r)
    674 { assume(r != NULL); assume(r->cfSubringGcd!=NULL); return r->cfSubringGcd(a,b,r); }
     681static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
     682{ STATISTIC(n_Gcd); assume(r != NULL); assume(r->cfGcd!=NULL); return r->cfGcd(a,b,r); }
     683static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
     684{ STATISTIC(n_SubringGcd); assume(r != NULL); assume(r->cfSubringGcd!=NULL); return r->cfSubringGcd(a,b,r); }
    675685
    676686/// beware that ExtGCD is only relevant for a few chosen coeff. domains
    677687/// and may perform something unexpected in some cases...
    678 static inline number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
    679 { assume(r != NULL); assume(r->cfExtGcd!=NULL); return r->cfExtGcd (a,b,s,t,r); }
    680 static inline number n_XExtGcd(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
    681 { assume(r != NULL); assume(r->cfXExtGcd!=NULL); return r->cfXExtGcd (a,b,s,t,u,v,r); }
    682 static inline number  n_EucNorm(number a, const coeffs r)
    683 { assume(r != NULL); assume(r->cfEucNorm!=NULL); return r->cfEucNorm (a,r); }
     688static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
     689{ STATISTIC(n_ExtGcd); assume(r != NULL); assume(r->cfExtGcd!=NULL); return r->cfExtGcd (a,b,s,t,r); }
     690static FORCE_INLINE number n_XExtGcd(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
     691{ STATISTIC(n_XExtGcd); assume(r != NULL); assume(r->cfXExtGcd!=NULL); return r->cfXExtGcd (a,b,s,t,u,v,r); }
     692static FORCE_INLINE number  n_EucNorm(number a, const coeffs r)
     693{ STATISTIC(n_EucNorm); assume(r != NULL); assume(r->cfEucNorm!=NULL); return r->cfEucNorm (a,r); }
    684694/// if r is a ring with zero divisors, return an annihilator!=0 of b
    685695/// otherwise return NULL
    686 static inline number  n_Ann(number a, const coeffs r)
    687 { assume(r != NULL); return r->cfAnn (a,r); }
    688 static inline number  n_QuotRem(number a, number b, number *q, const coeffs r)
    689 { assume(r != NULL); assume(r->cfQuotRem!=NULL); return r->cfQuotRem (a,b,q,r); }
     696static FORCE_INLINE number  n_Ann(number a, const coeffs r)
     697{ STATISTIC(n_Ann); assume(r != NULL); return r->cfAnn (a,r); }
     698static FORCE_INLINE number  n_QuotRem(number a, number b, number *q, const coeffs r)
     699{ STATISTIC(n_QuotRem); assume(r != NULL); assume(r->cfQuotRem!=NULL); return r->cfQuotRem (a,b,q,r); }
    690700
    691701
     
    695705/// in K(a)/<p(a)>: not implemented
    696706/// in K(t_1, ..., t_n): not implemented
    697 static inline number n_Lcm(number a, number b, const coeffs r)
    698 { assume(r != NULL); assume(r->cfLcm!=NULL); return r->cfLcm(a,b,r); }
     707static FORCE_INLINE number n_Lcm(number a, number b, const coeffs r)
     708{ STATISTIC(n_Lcm); assume(r != NULL); assume(r->cfLcm!=NULL); return r->cfLcm(a,b,r); }
    699709
    700710/// assume that r is a quotient field (otherwise, return 1)
    701711/// for arguments (a1/a2,b1/b2) return (lcm(a1,b2)/1)
    702 static inline number n_NormalizeHelper(number a, number b, const coeffs r)
    703 { assume(r != NULL); assume(r->cfNormalizeHelper!=NULL); return r->cfNormalizeHelper(a,b,r); }
     712static FORCE_INLINE number n_NormalizeHelper(number a, number b, const coeffs r)
     713{ STATISTIC(n_NormalizeHelper); assume(r != NULL); assume(r->cfNormalizeHelper!=NULL); return r->cfNormalizeHelper(a,b,r); }
    704714
    705715/// set the mapping function pointers for translating numbers from src to dst
    706 static inline nMapFunc n_SetMap(const coeffs src, const coeffs dst)
    707 { assume(src != NULL && dst != NULL); assume(dst->cfSetMap!=NULL); return dst->cfSetMap(src,dst); }
    708 
     716static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
     717{ STATISTIC(n_SetMap); assume(src != NULL && dst != NULL); assume(dst->cfSetMap!=NULL); return dst->cfSetMap(src,dst); }
     718
     719#ifdef LDEBUG
    709720/// test whether n is a correct number;
    710721/// only used if LDEBUG is defined
    711 #ifdef LDEBUG
    712 static inline BOOLEAN n_DBTest(number n, const char *filename, const int linenumber, const coeffs r)
     722static FORCE_INLINE BOOLEAN n_DBTest(number n, const char *filename, const int linenumber, const coeffs r)
     723{ STATISTIC(n_Test); assume(r != NULL); assume(r->cfDBTest != NULL); return r->cfDBTest(n, filename, linenumber, r); }
    713724#else
    714 static inline BOOLEAN n_DBTest(number, const char*, const int, const coeffs) // is it really necessary to define this function in any case?
     725// is it really necessary to define this function in any case?
     726/// test whether n is a correct number;
     727/// only used if LDEBUG is defined
     728static FORCE_INLINE BOOLEAN n_DBTest(number, const char*, const int, const coeffs)
     729{ STATISTIC(n_Test);  return TRUE; }
    715730#endif
    716 {
    717 #ifndef LDEBUG
    718   return TRUE;
    719 #else
    720   assume(r != NULL); assume(r->cfDBTest != NULL);
    721   return r->cfDBTest(n, filename, linenumber, r);
    722 #endif
    723 }
    724731
    725732/// output the coeff description
    726 static inline void   n_CoeffWrite(const coeffs r, BOOLEAN details = TRUE)
    727 { assume(r != NULL); assume(r->cfCoeffWrite != NULL); r->cfCoeffWrite(r, details); }
     733static FORCE_INLINE void   n_CoeffWrite(const coeffs r, BOOLEAN details = TRUE)
     734{ STATISTIC(n_CoeffWrite); assume(r != NULL); assume(r->cfCoeffWrite != NULL); r->cfCoeffWrite(r, details); }
    728735
    729736// Tests:
    730 static inline BOOLEAN nCoeff_is_Ring_2toM(const coeffs r)
     737static FORCE_INLINE BOOLEAN nCoeff_is_Ring_2toM(const coeffs r)
    731738{ assume(r != NULL); return (getCoeffType(r)==n_Z2m); }
    732739
    733 static inline BOOLEAN nCoeff_is_Ring_ModN(const coeffs r)
     740static FORCE_INLINE BOOLEAN nCoeff_is_Ring_ModN(const coeffs r)
    734741{ assume(r != NULL); return (getCoeffType(r)==n_Zn); }
    735742
    736 static inline BOOLEAN nCoeff_is_Ring_PtoM(const coeffs r)
     743static FORCE_INLINE BOOLEAN nCoeff_is_Ring_PtoM(const coeffs r)
    737744{ assume(r != NULL); return (getCoeffType(r)==n_Znm); }
    738745
    739 static inline BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
     746static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
    740747{ assume(r != NULL); return (getCoeffType(r)==n_Z); }
    741748
    742 static inline BOOLEAN nCoeff_is_Ring(const coeffs r)
     749static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
    743750{ assume(r != NULL); return (r->is_field==0); }
    744751
    745752/// returns TRUE, if r is a field or r has no zero divisors (i.e is a domain)
    746 static inline BOOLEAN nCoeff_is_Domain(const coeffs r)
     753static FORCE_INLINE BOOLEAN nCoeff_is_Domain(const coeffs r)
    747754{
    748755  assume(r != NULL);
     
    758765/// in Z/2^kZ: TRUE iff ((a = 0 mod 2^k) and (b = 0 or b is a power of 2))
    759766///                  or ((a, b <> 0) and (b/gcd(a, b) is odd))
    760 static inline BOOLEAN n_DivBy(number a, number b, const coeffs r)
    761 {
    762   assume(r != NULL);
     767static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
     768{ STATISTIC(n_DivBy); assume(r != NULL);
    763769#ifdef HAVE_RINGS
    764770  if( nCoeff_is_Ring(r) )
     
    770776}
    771777
    772 static inline number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym,const coeffs r)
    773 {
    774   assume(r != NULL); assume(r->cfChineseRemainder != NULL); return r->cfChineseRemainder(a,b,rl,sym,r);
    775 }
    776 
    777 static inline number n_Farey(number a, number b, const coeffs r)
    778 {
    779   assume(r != NULL); assume(r->cfFarey != NULL); return r->cfFarey(a,b,r);
    780 }
    781 
    782 static inline int n_ParDeg(number n, const coeffs r)
    783 {
    784   assume(r != NULL); assume(r->cfParDeg != NULL); return r->cfParDeg(n,r);
    785 }
     778static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym,const coeffs r)
     779{ STATISTIC(n_ChineseRemainderSym); assume(r != NULL); assume(r->cfChineseRemainder != NULL); return r->cfChineseRemainder(a,b,rl,sym,r); }
     780
     781static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
     782{ STATISTIC(n_Farey); assume(r != NULL); assume(r->cfFarey != NULL); return r->cfFarey(a,b,r); }
     783
     784static FORCE_INLINE int n_ParDeg(number n, const coeffs r)
     785{ STATISTIC(n_ParDeg); assume(r != NULL); assume(r->cfParDeg != NULL); return r->cfParDeg(n,r); }
    786786
    787787/// Returns the number of parameters
    788 static inline int n_NumberOfParameters(const coeffs r){ return r->iNumberOfParameters; }
     788static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
     789{ STATISTIC(n_NumberOfParameters); assume(r != NULL); return r->iNumberOfParameters; }
    789790
    790791/// Returns a (const!) pointer to (const char*) names of parameters
    791 static inline char const * * n_ParameterNames(const coeffs r){ return r->pParameterNames; }
    792 
     792static FORCE_INLINE char const * * n_ParameterNames(const coeffs r)
     793{ STATISTIC(n_ParameterNames); assume(r != NULL); return r->pParameterNames; }
    793794
    794795/// return the (iParameter^th) parameter as a NEW number
    795796/// NOTE: parameter numbering: 1..n_NumberOfParameters(...)
    796 static inline number n_Param(const int iParameter, const coeffs r)
    797 {
    798   assume(r != NULL);
     797static FORCE_INLINE number n_Param(const int iParameter, const coeffs r)
     798{ assume(r != NULL);
    799799  assume((iParameter >= 1) || (iParameter <= n_NumberOfParameters(r)));
    800800  assume(r->cfParameter != NULL);
    801   return r->cfParameter(iParameter, r);
     801  STATISTIC(n_Param); return r->cfParameter(iParameter, r);
    802802}
    803803
    804 static inline number  n_RePart(number i, const coeffs cf)
    805 {
    806   assume(cf != NULL); assume(cf->cfRePart!=NULL);
    807   return cf->cfRePart(i,cf);
    808 }
    809 static inline number  n_ImPart(number i, const coeffs cf)
    810 {
    811   assume(cf != NULL); assume(cf->cfImPart!=NULL);
    812   return cf->cfImPart(i,cf);
    813 }
     804static FORCE_INLINE number  n_RePart(number i, const coeffs cf)
     805{ STATISTIC(n_RePart); assume(cf != NULL); assume(cf->cfRePart!=NULL); return cf->cfRePart(i,cf); }
     806
     807static FORCE_INLINE number  n_ImPart(number i, const coeffs cf)
     808{ STATISTIC(n_ImPart); assume(cf != NULL); assume(cf->cfImPart!=NULL); return cf->cfImPart(i,cf); }
    814809
    815810/// returns TRUE, if r is not a field and r has non-trivial units
    816 static inline BOOLEAN nCoeff_has_Units(const coeffs r)
     811static FORCE_INLINE BOOLEAN nCoeff_has_Units(const coeffs r)
    817812{ assume(r != NULL); return ((getCoeffType(r)==n_Zn) || (getCoeffType(r)==n_Z2m) || (getCoeffType(r)==n_Znm)); }
    818813
    819 static inline BOOLEAN nCoeff_is_Zp(const coeffs r)
     814static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
    820815{ assume(r != NULL); return getCoeffType(r)==n_Zp; }
    821816
    822 static inline BOOLEAN nCoeff_is_Zp(const coeffs r, int p)
     817static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r, int p)
    823818{ assume(r != NULL); return ((getCoeffType(r)==n_Zp) && (r->ch == p)); }
    824819
    825 static inline BOOLEAN nCoeff_is_Q(const coeffs r)
     820static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
    826821{ assume(r != NULL); return getCoeffType(r)==n_Q && (r->is_field); }
    827822
    828 static inline BOOLEAN nCoeff_is_numeric(const coeffs r) /* R, long R, long C */
     823static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r) /* R, long R, long C */
    829824{ assume(r != NULL);  return (getCoeffType(r)==n_R) || (getCoeffType(r)==n_long_R) || (getCoeffType(r)==n_long_C); }
    830825// (r->ringtype == 0) && (r->ch ==  -1); ??
    831826
    832 static inline BOOLEAN nCoeff_is_R(const coeffs r)
     827static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r)
    833828{ assume(r != NULL); return getCoeffType(r)==n_R; }
    834829
    835 static inline BOOLEAN nCoeff_is_GF(const coeffs r)
     830static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
    836831{ assume(r != NULL); return getCoeffType(r)==n_GF; }
    837832
    838 static inline BOOLEAN nCoeff_is_GF(const coeffs r, int q)
     833static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r, int q)
    839834{ assume(r != NULL); return (getCoeffType(r)==n_GF) && (r->ch == q); }
    840835
    841836/* TRUE iff r represents an algebraic or transcendental extension field */
    842 static inline BOOLEAN nCoeff_is_Extension(const coeffs r)
     837static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
    843838{
    844839  assume(r != NULL);
     
    853848   height above some field of characteristic p (may be Z/pZ or some
    854849   Galois field of characteristic p) */
    855 static inline BOOLEAN nCoeff_is_Zp_a(const coeffs r)
     850static FORCE_INLINE BOOLEAN nCoeff_is_Zp_a(const coeffs r)
    856851{
    857852  assume(r != NULL);
     
    866861   height above some field of characteristic p (may be Z/pZ or some
    867862   Galois field of characteristic p) */
    868 static inline BOOLEAN nCoeff_is_Zp_a(const coeffs r, int p)
     863static FORCE_INLINE BOOLEAN nCoeff_is_Zp_a(const coeffs r, int p)
    869864{
    870865  assume(r != NULL);
     
    879874   actually: TRUE iff the given r is an extension tower of arbitrary
    880875   height above some field of characteristic 0 (may be Q, R, or C) */
    881 static inline BOOLEAN nCoeff_is_Q_a(const coeffs r)
     876static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r)
    882877{
    883878  assume(r != NULL);
     
    888883
    889884
    890 static inline BOOLEAN nCoeff_is_long_R(const coeffs r)
     885static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
    891886{ assume(r != NULL); return getCoeffType(r)==n_long_R; }
    892887
    893 static inline BOOLEAN nCoeff_is_long_C(const coeffs r)
     888static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
    894889{ assume(r != NULL); return getCoeffType(r)==n_long_C; }
    895890
    896 static inline BOOLEAN nCoeff_is_CF(const coeffs r)
     891static FORCE_INLINE BOOLEAN nCoeff_is_CF(const coeffs r)
    897892{ assume(r != NULL); return getCoeffType(r)==n_CF; }
    898893
    899894/// TRUE, if the computation of the inverse is fast,
    900895/// i.e. prefer leading coeff. 1 over content
    901 static inline BOOLEAN nCoeff_has_simple_inverse(const coeffs r)
     896static FORCE_INLINE BOOLEAN nCoeff_has_simple_inverse(const coeffs r)
    902897{ assume(r != NULL); return r->has_simple_Inverse; }
    903898
    904899/// TRUE if n_Delete/n_New are empty operations
    905 static inline BOOLEAN nCoeff_has_simple_Alloc(const coeffs r)
     900static FORCE_INLINE BOOLEAN nCoeff_has_simple_Alloc(const coeffs r)
    906901{ assume(r != NULL); return r->has_simple_Alloc; }
    907902
    908903/// TRUE iff r represents an algebraic extension field
    909 static inline BOOLEAN nCoeff_is_algExt(const coeffs r)
     904static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
    910905{ assume(r != NULL); return (getCoeffType(r)==n_algExt); }
    911906
    912907/// is it an alg. ext. of Q?
    913 static inline BOOLEAN nCoeff_is_Q_algext(const coeffs r)
     908static FORCE_INLINE BOOLEAN nCoeff_is_Q_algext(const coeffs r)
    914909{ assume(r != NULL); return ((n_GetChar(r) == 0) && nCoeff_is_algExt(r)); }
    915910
    916911/// TRUE iff r represents a transcendental extension field
    917 static inline BOOLEAN nCoeff_is_transExt(const coeffs r)
     912static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
    918913{ assume(r != NULL); return (getCoeffType(r)==n_transExt); }
    919914
     
    928923/// NOTE/TODO: see also the description by Hans
    929924/// TODO: rename into n_ClearIntegerContent
    930 static inline void n_ClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs r)
    931 {
    932   assume(r != NULL);
    933   r->cfClearContent(numberCollectionEnumerator, c, r);
    934 }
     925static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs r)
     926{ STATISTIC(n_ClearContent); assume(r != NULL); r->cfClearContent(numberCollectionEnumerator, c, r); }
    935927
    936928/// (inplace) Clears denominators on a collection of numbers
     
    938930/// with which all the number coeffs. were multiplied)
    939931/// NOTE/TODO: see also the description by Hans
    940 static inline void n_ClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, number& d, const coeffs r)
    941 {
    942   assume(r != NULL);
    943   r->cfClearDenominators(numberCollectionEnumerator, d, r);
    944 }
     932static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, number& d, const coeffs r)
     933{ STATISTIC(n_ClearDenominators); assume(r != NULL); r->cfClearDenominators(numberCollectionEnumerator, d, r); }
    945934
    946935// convenience helpers (no number returned - but the input enumeration
     
    950939// *p_Content) and p_Cleardenom_n (which doesn't)!!!
    951940
    952 static inline void n_ClearContent(ICoeffsEnumerator& numberCollectionEnumerator, const coeffs r)
    953 {
    954   number c;
    955   n_ClearContent(numberCollectionEnumerator, c, r);
    956   n_Delete(&c, r);
    957 }
    958 
    959 static inline void n_ClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, const coeffs r)
    960 {
    961   assume(r != NULL);
    962   number d;
    963   n_ClearDenominators(numberCollectionEnumerator, d, r);
    964   n_Delete(&d, r);
    965 }
     941static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator& numberCollectionEnumerator, const coeffs r)
     942{ STATISTIC(n_ClearContent); number c; n_ClearContent(numberCollectionEnumerator, c, r); n_Delete(&c, r); }
     943
     944static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, const coeffs r)
     945{ STATISTIC(n_ClearDenominators); assume(r != NULL); number d; n_ClearDenominators(numberCollectionEnumerator, d, r); n_Delete(&d, r); }
    966946
    967947
     
    970950void   n_Print(number& a,  const coeffs r);
    971951
     952
     953
     954/// TODO: make it a virtual method of coeffs, together with:
     955/// Decompose & Compose, rParameter & rPar
     956static FORCE_INLINE char * nCoeffString(const coeffs cf)
     957{ STATISTIC(nCoeffString); assume( cf != NULL ); return cf->cfCoeffString(cf); }
     958
     959
     960static FORCE_INLINE char * nCoeffName (const coeffs cf)
     961{ STATISTIC(nCoeffName); assume( cf != NULL ); return cf->cfCoeffName(cf); }
     962
     963static FORCE_INLINE number n_Random(siRandProc p, number p1, number p2, const coeffs cf)
     964{ STATISTIC(n_Random); assume( cf != NULL ); assume( cf->cfRandom != NULL );  return cf->cfRandom(p, p1, p2, cf); }
     965
     966/// io via ssi:
     967static FORCE_INLINE void n_WriteFd(number a, FILE *f, const coeffs r)
     968{ STATISTIC(n_WriteFd); assume(r != NULL); assume(r->cfWriteFd != NULL); return r->cfWriteFd(a, f, r); }
     969
     970/// io via ssi:
     971static FORCE_INLINE number n_ReadFd( s_buff f, const coeffs r)
     972{ STATISTIC(n_ReadFd); assume(r != NULL); assume(r->cfReadFd != NULL); return r->cfReadFd(f, r); }
     973
     974
     975// the following wrappers went to numbers.cc since they needed factory
     976// knowledge!
     977number n_convFactoryNSingN( const CanonicalForm n, const coeffs r);
     978
     979CanonicalForm n_convSingNFactoryN( number n, BOOLEAN setChar, const coeffs r );
     980
    972981#endif
    973982
  • libpolys/coeffs/gnumpc.cc

    r635bdd rf2ba60d  
    482482
    483483  n->cfDelete  = ngcDelete;
    484   n->cfNormalize=ndNormalize;
     484  //n->cfNormalize=ndNormalize;
    485485  n->cfInit   = ngcInit;
    486486  n->cfInt    = ngcInt;
     
    511511    // cfSize  = ndSize;
    512512#ifdef LDEBUG
    513   n->cfDBTest  = ndDBTest; // not yet implemented: ngcDBTest
     513  //n->cfDBTest  = ndDBTest; // not yet implemented: ngcDBTest
    514514#endif
    515515
  • libpolys/coeffs/gnumpfl.cc

    r635bdd rf2ba60d  
    418418  n->rep=n_rep_gmp_float;
    419419
    420   n->cfKillChar = ndKillChar; /* dummy */
     420  //n->cfKillChar = ndKillChar; /* dummy */
    421421
    422422  n->cfSetChar = ngfSetChar;
     
    425425
    426426  n->cfDelete  = ngfDelete;
    427   n->cfNormalize=ndNormalize;
     427  //n->cfNormalize=ndNormalize;
    428428  n->cfInit   = ngfInit;
    429429  n->cfInt    = ngfInt;
     
    448448  n->cfCoeffWrite = ngfCoeffWrite;
    449449#ifdef LDEBUG
    450   n->cfDBTest  = ndDBTest; // not yet implemented: ngfDBTest
     450  //n->cfDBTest  = ndDBTest; // not yet implemented: ngfDBTest
    451451#endif
    452452
  • libpolys/coeffs/longrat.cc

    r635bdd rf2ba60d  
    30683068
    30693069  r->nCoeffIsEqual=nlCoeffIsEqual;
    3070   r->cfKillChar = ndKillChar; /* dummy */
     3070  //r->cfKillChar = ndKillChar; /* dummy */
    30713071  r->cfCoeffString=nlCoeffString;
    30723072  r->cfCoeffName=nlCoeffName;
  • libpolys/coeffs/modulop.cc

    r635bdd rf2ba60d  
    503503  r->cfGreaterZero = npGreaterZero;
    504504  //r->cfPower = npPower;
    505   r->cfGetDenom = ndGetDenom;
    506   r->cfGetNumerator = ndGetNumerator;
     505  //r->cfGetDenom = ndGetDenom;
     506  //r->cfGetNumerator = ndGetNumerator;
    507507  //r->cfGcd  = ndGcd;
    508508  //r->cfLcm  = ndGcd;
     
    510510  r->cfSetMap = npSetMap;
    511511  //r->cfName = ndName;
    512   r->cfInpMult=ndInpMult;
     512  //r->cfInpMult=ndInpMult;
    513513#ifdef NV_OPS
    514514  if (c>NV_MAX_PRIME)
  • libpolys/coeffs/numbers.cc

    r635bdd rf2ba60d  
    1010#include <stdlib.h>
    1111
    12 
    13 
    14 
    1512#include <misc/auxiliary.h>
    16 
     13#include <omalloc/omalloc.h>
    1714#include <factory/factory.h>
    1815
    19 #include "coeffs.h"
     16#include <reporter/reporter.h>
     17
     18#include <coeffs/coeffs.h>
    2019#include <coeffs/numbers.h>
    2120
    22 #include <reporter/reporter.h>
    23 #include <omalloc/omalloc.h>
    2421#include <coeffs/numbers.h>
    2522#include <coeffs/longrat.h>
     
    4239
    4340
     41#ifdef HAVE_NUMSTATS
     42struct SNumberStatistic number_stats;
     43#endif /* HAVE_NUMSTATS */
    4444
    4545//static int characteristic = 0;
     
    4949
    5050void   nNew(number* d) { *d=NULL; }
    51 void   ndDelete(number* d, const coeffs) { *d=NULL; }
    52 number ndAnn(number, const coeffs) { return NULL;}
    53 char* ndCoeffString(const coeffs r)
     51
     52
     53static void   ndDelete(number* d, const coeffs) { *d=NULL; }
     54static number ndAnn(number, const coeffs) { return NULL;}
     55static char* ndCoeffString(const coeffs r)
    5456{
    5557  char *s=(char *)omAlloc(11);snprintf(s,11,"Coeffs(%d)",r->type);
    5658  return s;
    5759}
    58 void   ndInpMult(number &a, number b, const coeffs r)
    59 {
    60   number n=n_Mult(a,b,r);
    61   n_Delete(&a,r);
     60static void   ndInpMult(number &a, number b, const coeffs r)
     61{
     62  number n=r->cfMult(a,b,r);
     63  r->cfDelete(&a,r);
    6264  a=n;
    6365}
    64 void ndInpAdd(number &a, number b, const coeffs r)
    65 {
    66   number n=n_Add(a,b,r);
    67   n_Delete(&a,r);
     66static void ndInpAdd(number &a, number b, const coeffs r)
     67{
     68  number n=r->cfAdd(a,b,r);
     69  r->cfDelete(&a,r);
    6870  a=n;
    6971}
    7072
    71 void ndPower(number a, int i, number * res, const coeffs r)
     73static void ndPower(number a, int i, number * res, const coeffs r)
    7274{
    7375  if (i==0) {
    74     *res = n_Init(1, r);
     76    *res = r->cfInit(1, r);
    7577  } else if (i==1) {
    76     *res = n_Copy(a, r);
     78    *res = r->cfCopy(a, r);
    7779  } else if (i==2) {
    78     *res = n_Mult(a, a, r);
     80    *res = r->cfMult(a, a, r);
    7981  } else if (i<0) {
    80     number b = n_Invers(a, r);
     82    number b = r->cfInvers(a, r);
    8183    ndPower(b, -i, res, r);
    82     n_Delete(&b, r);
     84    r->cfDelete(&b, r);
    8385  } else {
    8486    ndPower(a, i/2, res, r);
    85     n_InpMult(*res, *res, r);
     87    r->cfInpMult(*res, *res, r);
    8688    if (i&1) {
    87       n_InpMult(*res, a, r);
     89      r->cfInpMult(*res, a, r);
    8890    }
    8991  }
    9092}
     93
    9194#ifdef LDEBUG
    92 void   nDBDummy1(number* d,char *, int) { *d=NULL; }
    93 BOOLEAN ndDBTest(number, const char *, const int, const coeffs)
    94 {
    95   return TRUE;
    96 }
    97 #endif
    98 
    99 number ndFarey(number,number,const coeffs r)
     95// static void   nDBDummy1(number* d,char *, int) { *d=NULL; }
     96static BOOLEAN ndDBTest(number, const char *, const int, const coeffs){ return TRUE; }
     97#endif
     98
     99static number ndFarey(number,number,const coeffs r)
    100100{
    101101  Werror("farey not implemented for %s (c=%d)",r->cfCoeffString(r),getCoeffType(r));
    102102  return NULL;
    103103}
    104 number ndChineseRemainder(number *,number *,int,BOOLEAN,const coeffs r)
     104static number ndChineseRemainder(number *,number *,int,BOOLEAN,const coeffs r)
    105105{
    106106  Werror("ChineseRemainder not implemented for %s (c=%d)",r->cfCoeffString(r),getCoeffType(r));
    107   return n_Init(0,r);
     107  return r->cfInit(0,r);
    108108}
    109109
    110110static int ndParDeg(number n, const coeffs r)
    111111{
    112   return (-n_IsZero(n,r));
     112  return (-r->cfIsZero(n,r));
    113113}
    114114
     
    134134}
    135135
    136 void   ndNormalize(number&, const coeffs) { }
    137 
    138 number ndReturn0(number, const coeffs r) { return n_Init(0,r); }
    139 
    140 number ndGcd(number, number, const coeffs r) { return n_Init(1,r); }
    141 
    142 number ndIntMod(number, number, const coeffs r) { return n_Init(0,r); }
    143 
    144 number ndGetDenom(number &, const coeffs r) { return n_Init(1,r); }
    145 number ndGetNumerator(number &a,const coeffs r) { return n_Copy(a,r); }
    146 
    147 int ndSize(number a, const coeffs r) { return (int)n_IsZero(a,r)==FALSE; }
    148 
    149 char * ndCoeffName(const coeffs r)
    150 {
    151   return r->cfCoeffString(r);
    152 }
    153 void ndClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs r)
     136static void   ndNormalize(number&, const coeffs) { }
     137static number ndReturn0(number, const coeffs r)        { return r->cfInit(0,r); }
     138static number ndGcd(number, number, const coeffs r)    { return r->cfInit(1,r); }
     139static number ndIntMod(number, number, const coeffs r) { return r->cfInit(0,r); }
     140static number ndGetDenom(number &, const coeffs r)     { return r->cfInit(1,r); }
     141static number ndGetNumerator(number &a,const coeffs r) { return r->cfCopy(a,r); }
     142static int    ndSize(number a, const coeffs r)         { return (int)r->cfIsZero(a,r)==FALSE; }
     143static char * ndCoeffName(const coeffs r)              { return r->cfCoeffString(r); }
     144
     145static void ndClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs r)
    154146{
    155147  assume(r != NULL);
     
    225217}
    226218
    227 void ndClearDenominators(ICoeffsEnumerator& /*numberCollectionEnumerator*/, number& d, const coeffs r)
     219static void ndClearDenominators(ICoeffsEnumerator& /*numberCollectionEnumerator*/, number& d, const coeffs r)
    228220{
    229221  assume( r != NULL );
     
    234226}
    235227
    236 number ndCopy(number a, const coeffs) { return a; }
     228static number ndCopy(number a, const coeffs) { return a; }
    237229number ndCopyMap(number a, const coeffs aRing, const coeffs r)
    238230{
     
    241233    return a;
    242234  else
    243     return n_Copy(a, r);
    244 }
    245 void ndKillChar(coeffs) {}
    246 void ndSetChar(const coeffs) {}
    247 
    248 number nd_Copy(number a, const coeffs r) { return n_Copy(a, r); }
     235    return r->cfCopy(a, r);
     236}
     237
     238static void ndKillChar(coeffs) {}
     239static void ndSetChar(const coeffs) {}
     240
     241number nd_Copy(number a, const coeffs r) { return r->cfCopy(a, r); }
    249242
    250243#ifdef HAVE_RINGS
    251 BOOLEAN ndDivBy(number, number, const coeffs) { return TRUE; } // assume a,b !=0
    252 int ndDivComp(number, number, const coeffs) { return 2; }
    253 BOOLEAN ndIsUnit(number a, const coeffs r) { return !n_IsZero(a,r); }
    254 number  ndExtGcd (number, number, number *, number *, const coeffs r) { return n_Init(1,r); }
    255 #endif
    256 
    257 CanonicalForm ndConvSingNFactoryN( number, BOOLEAN /*setChar*/, const coeffs)
     244static BOOLEAN ndDivBy(number, number, const coeffs) { return TRUE; } // assume a,b !=0
     245static int ndDivComp(number, number, const coeffs) { return 2; }
     246static BOOLEAN ndIsUnit(number a, const coeffs r) { return !r->cfIsZero(a,r); }
     247static number  ndExtGcd (number, number, number *, number *, const coeffs r) { return r->cfInit(1,r); }
     248#endif
     249
     250static CanonicalForm ndConvSingNFactoryN( number, BOOLEAN /*setChar*/, const coeffs)
    258251{
    259252  CanonicalForm term(0);
     
    262255}
    263256
    264 number ndConvFactoryNSingN( const CanonicalForm, const coeffs)
     257static number ndConvFactoryNSingN( const CanonicalForm, const coeffs)
    265258{
    266259  Werror("no conversion from factory");
     
    271264/**< [out] the GMP equivalent    */
    272265/// Converts a non-negative bigint number into a GMP number.
    273 void ndMPZ(mpz_t result, number &n, const coeffs r)
    274 {
    275   mpz_init_set_si( result, n_Int(n, r) );
    276 }
    277 
    278 number ndInitMPZ(mpz_t m, const coeffs r)
    279 {
    280   return n_Init( mpz_get_si(m), r);
    281 }
    282 
    283 
    284 BOOLEAN ndCoeffIsEqual(const coeffs r, n_coeffType n, void *)
     266static void ndMPZ(mpz_t result, number &n, const coeffs r)
     267{
     268  mpz_init_set_si( result, r->cfInt(n, r) );
     269}
     270
     271static number ndInitMPZ(mpz_t m, const coeffs r)
     272{
     273  return r->cfInit( mpz_get_si(m), r);
     274}
     275
     276
     277static BOOLEAN ndCoeffIsEqual(const coeffs r, n_coeffType n, void *)
    285278{
    286279  /* test, if r is an instance of nInitCoeffs(n,parameter) */
     
    359352    n->cfCoeffName = ndCoeffName;
    360353
    361     // n->cfKillChar = ndKillChar; /* dummy */
     354    n->cfKillChar = ndKillChar; /* dummy */
    362355    n->cfSetChar = ndSetChar; /* dummy */
    363356    // temp. removed to catch all the coeffs which miss to implement this!
     
    380373#endif
    381374
     375#ifdef LDEBUG
     376    n->cfDBTest=ndDBTest;
     377#endif
     378     
    382379    n->convSingNFactoryN=ndConvSingNFactoryN;
    383380    n->convFactoryNSingN=ndConvFactoryNSingN;
     
    461458    assume(n->cfClearDenominators != NULL);
    462459
    463 #ifdef LDEBUG
    464     if(n->cfDBTest==NULL)
    465     { n->cfDBTest=ndDBTest;Warn("cfDBTest is NULL for coeff %d",t); }
    466 #endif
    467460    assume(n->type==t);
    468461
     
    475468
    476469   if( n->nNULL == NULL )
    477      n->nNULL = n_Init(0, n); // may still remain NULL
     470     n->nNULL = n->cfInit(0, n); // may still remain NULL
    478471  }
    479472  else
     
    486479void nKillChar(coeffs r)
    487480{
     481  STATISTIC(nKillChar);
    488482  if (r!=NULL)
    489483  {
     
    499493        n->next=n->next->next;
    500494        if (cf_root==r) cf_root=n->next;
    501         r->cfDelete(&(r->nNULL),r);
    502         if (r->cfKillChar!=NULL) r->cfKillChar(r);
     495        n_Delete(&(r->nNULL),r);
     496        assume (r->cfKillChar!=NULL); r->cfKillChar(r); // STATISTIC(nKillChar);
    503497        omFreeSize((void *)r, sizeof(n_Procs_s));
    504498        r=NULL;
     
    553547   { char* s = StringEndS(); Print("%s", s); omFree(s); }
    554548}
     549
     550
     551number n_convFactoryNSingN( const CanonicalForm n, const coeffs r)
     552{ STATISTIC(n_convFactoryNSingN); assume(r != NULL); assume(r->convFactoryNSingN != NULL); return r->convFactoryNSingN(n, r); }
     553
     554
     555
     556CanonicalForm n_convSingNFactoryN( number n, BOOLEAN setChar, const coeffs r )
     557{ STATISTIC(n_convSingNFactoryN); assume(r != NULL); assume(r->convSingNFactoryN != NULL); return r->convSingNFactoryN(n, setChar, r); }
  • libpolys/coeffs/numbers.h

    r635bdd rf2ba60d  
    5050
    5151/* the dummy routines: */
    52 void nDummy1(number* d);
    53 void ndDelete(number* d, const coeffs r);
    54 number ndGcd(number a, number b, const coeffs);
    55 number ndCopy(number a, const coeffs r);
     52// void nDummy1(number* d);
     53// void ndDelete(number* d, const coeffs r);
     54// number ndGcd(number a, number b, const coeffs);
     55// number ndCopy(number a, const coeffs r);
    5656number ndCopyMap(number a, const coeffs src, const coeffs dst);
    57 int ndSize(number a, const coeffs r);
    58 number ndGetDenom(number &n, const coeffs r);
    59 number ndGetNumerator(number &a,const coeffs r);
    60 number ndReturn0(number n, const coeffs r);
    61 number ndIntMod(number a, number b, const coeffs r);
     57// int ndSize(number a, const coeffs r);
     58// number ndGetDenom(number &n, const coeffs r);
     59// number ndGetNumerator(number &a,const coeffs r);
     60// number ndReturn0(number n, const coeffs r);
     61// number ndIntMod(number a, number b, const coeffs r);
    6262
    63 void   ndInpMult(number &a, number b, const coeffs r);
    64 void   ndInpAdd(number &a, number b, const coeffs r);
     63// void   ndInpMult(number &a, number b, const coeffs r);
     64// void   ndInpAdd(number &a, number b, const coeffs r);
    6565
    66 void ndKillChar(coeffs);
     66// void ndKillChar(coeffs);
    6767
    68 number  ndInit_bigint(number i, const coeffs dummy, const coeffs dst);
     68// number  ndInit_bigint(number i, const coeffs dummy, const coeffs dst);
    6969
    70 BOOLEAN ndCoeffIsEqual(const coeffs r, n_coeffType n, void * parameter);
     70// BOOLEAN ndCoeffIsEqual(const coeffs r, n_coeffType n, void * parameter);
    7171
    7272/// Test whether a is a zero divisor in r
     
    7676BOOLEAN n_IsZeroDivisor( number a, const coeffs r);
    7777
    78 #ifdef LDEBUG
    79 void nDBDummy1(number* d,char *f, int l);
    80 BOOLEAN ndDBTest(number a, const char *f, const int l, const coeffs r);
    81 #endif
    82 
    83 #define nDivBy0 "div by 0"
     78const char* const nDivBy0 = "div by 0";
    8479
    8580// dummy routines
    86 void   ndNormalize(number& d, const coeffs); // nNormalize...
     81// void   ndNormalize(number& d, const coeffs); // nNormalize...
    8782
    8883/// initialize an object of type coeff, return FALSE in case of success
     
    9186
    9287/// divide by the first (leading) number and return it, i.e. make monic
    93 void ndClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs r);
     88// void ndClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs r);
    9489
    9590/// does nothing (just returns a dummy one number)
    96 void ndClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, number& d, const coeffs r);
     91// void ndClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, number& d, const coeffs r);
    9792
    9893#endif
  • libpolys/coeffs/rintegers.cc

    r635bdd rf2ba60d  
    438438  r->rep=n_rep_gmp;
    439439
    440   r->nCoeffIsEqual = ndCoeffIsEqual;
     440  //r->nCoeffIsEqual = ndCoeffIsEqual;
    441441  r->cfCoeffString = nrzCoeffString;
    442   r->cfKillChar = ndKillChar;
     442  //r->cfKillChar = ndKillChar;
    443443  r->cfMult  = nrzMult;
    444444  r->cfSub   = nrzSub;
     
    16651665  r->rep=n_rep_gap_gmp;
    16661666
    1667   r->nCoeffIsEqual = ndCoeffIsEqual;
     1667  //r->nCoeffIsEqual = ndCoeffIsEqual;
    16681668  r->cfCoeffString = nrzCoeffString;
    1669   r->cfKillChar = ndKillChar;
     1669  //r->cfKillChar = ndKillChar;
    16701670  r->cfMult  = nrzMult;
    16711671  r->cfSub   = nrzSub;
  • libpolys/coeffs/rmodulo2m.cc

    r635bdd rf2ba60d  
    107107  r->rep=n_rep_int;
    108108
    109   r->cfKillChar    = ndKillChar; /* dummy*/
     109  //r->cfKillChar    = ndKillChar; /* dummy*/
    110110  r->nCoeffIsEqual = nr2mCoeffIsEqual;
    111111  r->cfCoeffString = nr2mCoeffString;
     
    121121
    122122  r->cfInit        = nr2mInit;
    123   r->cfCopy        = ndCopy;
     123  //r->cfCopy        = ndCopy;
    124124  r->cfInt         = nr2mInt;
    125125  r->cfAdd         = nr2mAdd;
     
    144144  r->cfPower       = nr2mPower;
    145145  r->cfSetMap      = nr2mSetMap;
    146   r->cfNormalize   = ndNormalize;
     146//  r->cfNormalize   = ndNormalize; // default
    147147  r->cfLcm         = nr2mLcm;
    148148  r->cfGcd         = nr2mGcd;
  • libpolys/coeffs/rmodulon.cc

    r635bdd rf2ba60d  
    160160  r->cfPower       = nrnPower;
    161161  r->cfSetMap      = nrnSetMap;
    162   r->cfNormalize   = ndNormalize;
     162  //r->cfNormalize   = ndNormalize;
    163163  r->cfLcm         = nrnLcm;
    164164  r->cfGcd         = nrnGcd;
  • libpolys/coeffs/shortfl.cc

    r635bdd rf2ba60d  
    709709  n->rep=n_rep_float;
    710710
    711   n->cfKillChar = ndKillChar; /* dummy */
     711  //n->cfKillChar = ndKillChar; /* dummy */
    712712  n->ch = 0;
    713713  n->cfCoeffString = nrCoeffString;
     
    722722  n->cfInpNeg   = nrNeg;
    723723  n->cfInvers= nrInvers;
    724   n->cfCopy  = ndCopy;
     724  //n->cfCopy  = ndCopy;
    725725  n->cfGreater = nrGreater;
    726726  n->cfEqual = nrEqual;
     
    738738    /*nSize  = ndSize;*/
    739739#ifdef LDEBUG
    740   n->cfDBTest=ndDBTest; // not yet implemented: nrDBTest;
     740  //n->cfDBTest=ndDBTest; // not yet implemented: nrDBTest;
    741741#endif
    742742
    743   n->nCoeffIsEqual = ndCoeffIsEqual;
     743  //n->nCoeffIsEqual = ndCoeffIsEqual;
    744744
    745745  n->float_len = SHORT_REAL_LENGTH;
  • libpolys/coeffs/test.cc

    r635bdd rf2ba60d  
    186186  assume( r->cfAdd != NULL );
    187187  assume( r->cfDelete != NULL );
    188 
    189   if( type == n_Q )
    190   {
    191     assume( r->cfInit == nlInit );
    192     assume( r->cfAdd == nlAdd );
    193     assume( r->cfDelete == nlDelete );
    194   }
    195   else if( type == n_long_R )
    196   {
    197     assume( r->cfInit == ngfInit );
    198     assume( r->cfAdd == ngfAdd );
    199     assume( r->cfDelete == ngfDelete );
    200   }
    201   else if( type == n_long_C )
    202   {
    203 //     assume( r->cfInit == ngcInit );
    204 //     assume( r->cfAdd == ngcAdd );
    205 //     assume( r->cfDelete == ngcDelete );
    206   }
    207   else if( type == n_R )
    208   {
    209     assume( r->cfInit == nrInit );
    210     assume( r->cfAdd == nrAdd );
    211 //    assume( r->cfDelete == nrDelete ); // No?
    212   }
    213 #ifdef HAVE_RINGS
    214   else if( type == n_Z2m )
    215   {
    216     assume( r->cfInit == nr2mInit );
    217     assume( r->cfAdd == nr2mAdd );
    218     assume( r->cfDelete == ndDelete );
    219   }
    220   else if( type == n_Zn )
    221   {
    222     assume( r->cfInit == nrnInit );
    223     assume( r->cfAdd == nrnAdd );
    224     assume( r->cfDelete == nrnDelete );
    225   }
    226 #endif
    227   else if( type == n_GF )
    228   {
    229 //     assume( r->cfInit == nfInit );
    230 //     assume( r->cfAdd == nfAdd );
    231     //assume( r->cfDelete == nfDelete );
    232   }
    233   else
    234   {
    235     // ...
    236   }
    237 
     188  assume( r->cfKillChar != NULL );
     189   
    238190  bool ret = TestArith( r );
    239191
  • libpolys/misc/auxiliary.h.in

    r635bdd rf2ba60d  
    6262#endif
    6363
     64
     65#ifndef HAVE_NUMSTATS
     66// #define HAVE_NUMSTATS
     67#undef HAVE_NUMSTATS
     68#endif
    6469// ----------------  end of parts/extensions
    6570
  • libpolys/polys/clapsing.cc

    r635bdd rf2ba60d  
    16301630    for(j=m->cols();j>0;j--)
    16311631    {
    1632       M(i,j)=cf->convSingNFactoryN(BIMATELEM(*m,i,j),setchar,cf);
     1632      M(i,j)=n_convSingNFactoryN(BIMATELEM(*m,i,j),setchar,cf);
    16331633      setchar=FALSE;
    16341634    }
    16351635  }
    1636   number res= cf->convFactoryNSingN( determinant(M,m->rows()),cf ) ;
     1636  number res=n_convFactoryNSingN( determinant(M,m->rows()),cf ) ;
    16371637  return res;
    16381638}
  • libpolys/polys/coeffrings.h

    r635bdd rf2ba60d  
    66#include <polys/monomials/ring.h>
    77
    8 static inline number n_Copy(number n, const ring r){ return n_Copy(n, r->cf); }
    9 static inline void n_Delete(number* p, const ring r){ n_Delete(p, r->cf); }
    10 static inline BOOLEAN n_Equal(number a, number b, const ring r){ return n_Equal(a, b, r->cf); }
    11 static inline nMapFunc n_SetMap(const ring src, const ring dst){ return dst->cf->cfSetMap(src->cf,dst->cf); }
    12 static inline int n_GetChar(const ring r){ return n_GetChar(r->cf); }
     8static FORCE_INLINE number n_Copy(number n, const ring r){ return n_Copy(n, r->cf); }
     9static FORCE_INLINE void n_Delete(number* p, const ring r){ n_Delete(p, r->cf); }
     10static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const ring r){ return n_Equal(a, b, r->cf); }
     11static FORCE_INLINE nMapFunc n_SetMap(const ring src, const ring dst){ return n_SetMap(src->cf,dst->cf); }
     12static FORCE_INLINE int n_GetChar(const ring r){ return n_GetChar(r->cf); }
    1313
    14 // static inline BOOLEAN n_Test(number n, const char *filename, const int linenumber, const ring r){ return n_DBTest( n, filename, linenumber, r->cf); }
    15 // static inline BOOLEAN n_Test(number a, const ring r){  return n_DBTest(a, __FILE__, __LINE__, r); }
     14// static FORCE_INLINE BOOLEAN n_Test(number n, const char *filename, const int linenumber, const ring r){ return n_Test( n, r->cf); }
     15// static FORCE_INLINE BOOLEAN n_Test(number a, const ring r){  return n_Test(a, r); }
    1616// #define n_Test(a,r)
    1717
    1818
    1919
    20 static inline BOOLEAN n_IsZero(number n, const ring r){ return n_IsZero(n,r->cf); }
    21 static inline BOOLEAN n_IsOne(number n,  const ring r){ return n_IsOne(n,r->cf); }
    22 static inline BOOLEAN n_IsMOne(number n, const ring r){ return n_IsMOne(n,r->cf); }
    23 static inline BOOLEAN n_GreaterZero(number n, const ring r){ return n_GreaterZero(n,r->cf); }
    24 static inline number n_Init(int i,       const ring r){ return n_Init(i,r->cf); }
    25 static inline number n_InpNeg(number n,     const ring r){ return n_InpNeg(n,r->cf); }
    26 static inline number n_Invers(number a,  const ring r){ return n_Invers(a,r->cf); }
    27 static inline int    n_Size(number n,    const ring r){ return n_Size(n,r->cf); }
    28 static inline void   n_Normalize(number& n, const ring r){ return n_Normalize(n,r->cf); }
    29 static inline void   n_Write(number& n,  const ring r){ return n_Write(n, r->cf, rShortOut(r)); }
    30 static inline number n_GetDenom(number& n, const ring r){ return n_GetDenom(n, r->cf);}
    31 static inline number n_GetNumerator(number& n, const ring r){ return n_GetNumerator(n, r->cf);}
    32 static inline void   n_Power(number a, int b, number *res, const ring r){ n_Power(a,b,res,r->cf); }
    33 static inline number n_Mult(number a, number b, const ring r){ return n_Mult(a, b, r->cf);}
    34 static inline void n_InpMult(number &a, number b, const ring r){ n_InpMult(a,b,r->cf); }
    35 static inline number n_Sub(number a, number b, const ring r){ return n_Sub(a, b, r->cf);}
    36 static inline number n_Add(number a, number b, const ring r){ return n_Add(a, b, r->cf);}
    37 static inline number n_Div(number a, number b, const ring r){ return n_Div(a,b, r->cf);}
    38 static inline number n_ExactDiv(number a, number b, const ring r){ return n_ExactDiv(a,b, r->cf);}
    39 static inline number n_Gcd(number a, number b, const ring r){ return n_Gcd(a,b, r->cf);}
     20static FORCE_INLINE BOOLEAN n_IsZero(number n, const ring r){ return n_IsZero(n,r->cf); }
     21static FORCE_INLINE BOOLEAN n_IsOne(number n,  const ring r){ return n_IsOne(n,r->cf); }
     22static FORCE_INLINE BOOLEAN n_IsMOne(number n, const ring r){ return n_IsMOne(n,r->cf); }
     23static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const ring r){ return n_GreaterZero(n,r->cf); }
     24static FORCE_INLINE number n_Init(int i,       const ring r){ return n_Init(i,r->cf); }
     25static FORCE_INLINE number n_InpNeg(number n,     const ring r){ return n_InpNeg(n,r->cf); }
     26static FORCE_INLINE number n_Invers(number a,  const ring r){ return n_Invers(a,r->cf); }
     27static FORCE_INLINE int    n_Size(number n,    const ring r){ return n_Size(n,r->cf); }
     28static FORCE_INLINE void   n_Normalize(number& n, const ring r){ return n_Normalize(n,r->cf); }
     29static FORCE_INLINE void   n_Write(number& n,  const ring r){ return n_Write(n, r->cf, rShortOut(r)); }
     30static FORCE_INLINE number n_GetDenom(number& n, const ring r){ return n_GetDenom(n, r->cf);}
     31static FORCE_INLINE number n_GetNumerator(number& n, const ring r){ return n_GetNumerator(n, r->cf);}
     32static FORCE_INLINE void   n_Power(number a, int b, number *res, const ring r){ n_Power(a,b,res,r->cf); }
     33static FORCE_INLINE number n_Mult(number a, number b, const ring r){ return n_Mult(a, b, r->cf);}
     34static FORCE_INLINE void n_InpMult(number &a, number b, const ring r){ n_InpMult(a,b,r->cf); }
     35static FORCE_INLINE number n_Sub(number a, number b, const ring r){ return n_Sub(a, b, r->cf);}
     36static FORCE_INLINE number n_Add(number a, number b, const ring r){ return n_Add(a, b, r->cf);}
     37static FORCE_INLINE number n_Div(number a, number b, const ring r){ return n_Div(a,b, r->cf);}
     38static FORCE_INLINE number n_ExactDiv(number a, number b, const ring r){ return n_ExactDiv(a,b, r->cf);}
     39static FORCE_INLINE number n_Gcd(number a, number b, const ring r){ return n_Gcd(a,b, r->cf);}
    4040
    4141#ifdef HAVE_RINGS
    42 static inline BOOLEAN n_IsUnit(number n, const ring r){ return n_IsUnit(n, r->cf);}
    43 static inline number n_GetUnit(number n, const ring r){ return n_GetUnit(n, r->cf);}
    44 static inline BOOLEAN n_DivBy(number a, number b, const ring r){ return n_DivBy(a,b, r->cf);}
     42static FORCE_INLINE BOOLEAN n_IsUnit(number n, const ring r){ return n_IsUnit(n, r->cf);}
     43static FORCE_INLINE number n_GetUnit(number n, const ring r){ return n_GetUnit(n, r->cf);}
     44static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const ring r){ return n_DivBy(a,b, r->cf);}
    4545#endif
    4646
    47 static inline int n_ParDeg(number n, const ring r){ assume(r != NULL); assume(r->cf != NULL); return n_ParDeg(n,r->cf); }
     47static FORCE_INLINE int n_ParDeg(number n, const ring r){ assume(r != NULL); assume(r->cf != NULL); return n_ParDeg(n,r->cf); }
    4848
    4949#endif /* COEFFRINGS_H */
  • libpolys/polys/monomials/p_polys.cc

    r635bdd rf2ba60d  
    13611361  int i,j;
    13621362  rc = p_Init(r);
    1363   const char *s = r->cf->cfRead(st,&(rc->coef),r->cf);
     1363  const char *s = n_Read(st,&(p_GetCoeff(rc, r)),r->cf);
    13641364  if (s==st)
    13651365  /* i.e. it does not start with a coeff: test if it is a ringvar*/
     
    27652765      while (p!=NULL)
    27662766      {
    2767         /* should be:
     2767        /* should be: // NOTE: don't use ->coef!!!!
    27682768        * number hh;
    27692769        * nGetDenom(p->coef,&hh);
     
    29062906      while (p!=NULL)
    29072907      {
    2908         /* should be:
     2908        /* should be: // NOTE: don't use ->coef!!!!
    29092909        * number hh;
    29102910        * nGetDenom(p->coef,&hh);
     
    29412941            while (p!=NULL)
    29422942            {
    2943               /* should be:
     2943              /* should be: // NOTE: don't use ->coef!!!!
    29442944              * number hh;
    29452945              * nGetDenom(p->coef,&hh);
  • libpolys/polys/monomials/ring.cc

    r635bdd rf2ba60d  
    617617/// TODO: make it a virtual method of coeffs, together with:
    618618/// Decompose & Compose, rParameter & rPar
    619 char * rCharStr(ring r)
    620 { return r->cf->cfCoeffString(r->cf); }
     619char * rCharStr(const ring r){ assume( r != NULL ); return nCoeffString(r->cf); }
    621620
    622621char * rParStr(ring r)
  • libpolys/polys/nc/gb_hack.h

    r635bdd rf2ba60d  
    3737
    3838# define STR_EXPAND(tok) #tok
    39 # define D(A)    A{ WerrorS("This is a hack. Function is not defined: " STR_EXPAND(A) ); return NULL; }
     39# define D(A)    A{ WerrorS("This is a hack. Function is not defined: " STR_EXPAND(A) ); return NULL; (void)(_currRing); }
    4040
    4141D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing))
  • libpolys/polys/pDebug.cc

    r635bdd rf2ba60d  
    249249    // number/coef check
    250250    _pPolyAssumeReturnMsg(p->coef != NULL || (n_GetChar(r->cf) >= 2), "NULL coef",p,r);
     251
    251252    #ifdef LDEBUG
    252     _pPolyAssumeReturnMsg(r->cf->cfDBTest(p->coef,__FILE__,__LINE__,r->cf),"coeff err",p,r);
     253    _pPolyAssumeReturnMsg(n_Test(p->coef,r->cf),"coeff err",p,r);
    253254    #endif
    254255    _pPolyAssumeReturnMsg(!n_IsZero(p->coef, r->cf), "Zero coef",p,r);
  • libpolys/polys/templates/p_Numbers.h

    r635bdd rf2ba60d  
    1111#define P_NUMBERS_H
    1212
     13#include <misc/auxiliary.h>
    1314#include <coeffs/coeffs.h>
    1415#include <coeffs/numbers.h>
    1516#include <polys/monomials/ring.h>
    1617
    17 static inline number n_Copy_FieldGeneral(number n,    const ring r)
    18 { return r->cf->cfCopy(n,r->cf); }
     18static FORCE_INLINE number n_Copy_FieldGeneral(number n,    const ring r)
     19{ return n_Copy(n,r->cf); }
    1920
    20 static inline void   n_Delete_FieldGeneral(number* p, const ring r)
    21 { r->cf->cfDelete(p,r->cf); }
     21static FORCE_INLINE void   n_Delete_FieldGeneral(number* p, const ring r)
     22{ n_Delete(p,r->cf); }
    2223
    23 static inline number n_Mult_FieldGeneral(number n1, number n2, const ring r)
    24 { return r->cf->cfMult(n1, n2, r->cf); }
     24static FORCE_INLINE number n_Mult_FieldGeneral(number n1, number n2, const ring r)
     25{ return n_Mult(n1, n2, r->cf); }
    2526
    26 static inline number n_Add_FieldGeneral(number n1, number n2, const ring r)
    27 { return r->cf->cfAdd(n1, n2, r->cf); }
     27static FORCE_INLINE number n_Add_FieldGeneral(number n1, number n2, const ring r)
     28{ return n_Add(n1, n2, r->cf); }
    2829
    29 static inline BOOLEAN n_IsZero_FieldGeneral(number n, const ring r)
    30 { return r->cf->cfIsZero(n, r->cf); }
     30static FORCE_INLINE BOOLEAN n_IsZero_FieldGeneral(number n, const ring r)
     31{ return n_IsZero(n, r->cf); }
    3132
    32 static inline BOOLEAN n_Equal_FieldGeneral(number n1, number n2, const ring r)
    33 { return r->cf->cfEqual(n1, n2, r->cf); }
     33static FORCE_INLINE BOOLEAN n_Equal_FieldGeneral(number n1, number n2, const ring r)
     34{ return n_Equal(n1, n2, r->cf); }
    3435
    35 static inline number n_Neg_FieldGeneral(number n,     const ring r)
    36 { return r->cf->cfInpNeg(n, r->cf); }
     36static FORCE_INLINE number n_Neg_FieldGeneral(number n,     const ring r)
     37{ return n_InpNeg(n, r->cf); }
    3738
    38 static inline number n_Sub_FieldGeneral(number n1, number n2, const ring r)
    39 { return r->cf->cfSub(n1, n2, r->cf); }
     39static FORCE_INLINE number n_Sub_FieldGeneral(number n1, number n2, const ring r)
     40{ return n_Sub(n1, n2, r->cf); }
    4041
    41 static inline void n_InpMult_FieldGeneral(number &n1, number n2, const ring r)
    42 { ndInpMult(n1, n2, r->cf); }
     42static FORCE_INLINE void n_InpMult_FieldGeneral(number &n1, number n2, const ring r)
     43{ n_InpMult(n1, n2, r->cf); }
    4344
    44 static inline void n_InpAdd_FieldGeneral(number &n1, number n2, const ring r)
     45static FORCE_INLINE void n_InpAdd_FieldGeneral(number &n1, number n2, const ring r)
    4546{ n_InpAdd(n1, n2, r->cf); }
    4647
    4748#ifdef HAVE_RINGS
    48 #define n_Copy_RingGeneral(n, r)           r->cf->cfCopy(n,r->cf)
    49 #define n_Delete_RingGeneral(n, r)         r->cf->cfDelete(n,r->cf)
    50 #define n_Mult_RingGeneral(n1, n2, r)      r->cf->cfMult(n1, n2, r->cf)
    51 #define n_Add_RingGeneral(n1, n2, r)       r->cf->cfAdd(n1, n2, r->cf)
    52 #define n_IsZero_RingGeneral(n, r)         r->cf->cfIsZero(n, r->cf)
    53 #define n_Equal_RingGeneral(n1, n2, r)     r->cf->cfEqual(n1, n2, r->cf)
    54 #define n_Neg_RingGeneral(n, r)            r->cf->cfInpNeg(n, r->cf)
    55 #define n_Sub_RingGeneral(n1, n2, r)       r->cf->cfSub(n1, n2, r->cf)
    56 //#define n_InpMult_RingGeneral(n1, n2, r)   r->cf->nInpMult(n1, n2, r->cf)
    57 #define n_InpMult_RingGeneral(n1, n2, r)   ndInpMult(n1, n2, r->cf)
    58 static inline void n_InpAdd_RingGeneral(number &n1, number n2, const ring r)
    59 { assume(rField_is_Ring(r)); n_InpAdd(n1, n2, r->cf); }
     49#define n_Copy_RingGeneral(n, r)           n_Copy_FieldGeneral(n, r)
     50#define n_Delete_RingGeneral(n, r)         n_Delete_FieldGeneral(n, r)
     51#define n_Mult_RingGeneral(n1, n2, r)      n_Mult_FieldGeneral(n1, n2, r)
     52#define n_Add_RingGeneral(n1, n2, r)       n_Add_FieldGeneral(n1, n2, r)
     53#define n_IsZero_RingGeneral(n, r)         n_IsZero_FieldGeneral(n, r)
     54#define n_Equal_RingGeneral(n1, n2, r)     n_Equal_FieldGeneral(n1, n2, r)
     55#define n_Neg_RingGeneral(n, r)            n_Neg_FieldGeneral(n, r)
     56#define n_Sub_RingGeneral(n1, n2, r)       n_Sub_FieldGeneral(n1, n2, r)
     57//#define n_InpMult_RingGeneral(n1, n2, r)   n_InpMult_FieldGeneral(n1, n2, r)
     58#define n_InpMult_RingGeneral(n1, n2, r)   n_InpMult_FieldGeneral(n1, n2, r)
     59
     60static FORCE_INLINE void n_InpAdd_RingGeneral(number &n1, number n2, const ring r)
     61{  assume(rField_is_Ring(r)); n_InpAdd(n1, n2, r->cf); }
    6062#endif
    6163
    6264#include <coeffs/modulop.h>
     65
    6366#define n_Copy_FieldZp(n, r)        n
    6467#define n_Delete_FieldZp(n, r)      do {} while (0)
    65 #define n_Mult_FieldZp(n1, n2, r)   npMultM(n1,n2, r->cf)
    66 #define n_Add_FieldZp(n1, n2, r)    npAddM(n1, n2, r->cf)
    67 #define n_IsZero_FieldZp(n, r)      npIsZeroM(n, r->cf)
    68 #define n_Equal_FieldZp(n1, n2, r)  npEqualM(n1, n2, r->cf)
    69 #define n_Neg_FieldZp(n, r)         npNegM(n, r->cf)
    70 #define n_Sub_FieldZp(n1, n2, r)    npSubM(n1, n2, r->cf)
    71 #define n_InpMult_FieldZp(n1, n2, r) n1=npMultM(n1, n2, r->cf)
    7268
    73 static inline void n_InpAdd_FieldZp(number &n1, number n2, const ring r)
    74 { assume(rField_is_Zp(r)); n1=npAddM(n1, n2, r->cf); }
     69static FORCE_INLINE number n_Mult_FieldZp(number n1, number n2, const ring r)
     70{ STATISTIC(n_Mult); return npMultM(n1, n2, r->cf); }
    7571
    76 #define DO_LINLINE
    77 #include <coeffs/longrat.cc> // TODO: fix this Uglyness?!!!
     72static FORCE_INLINE number n_Add_FieldZp(number n1, number n2, const ring r)
     73{ STATISTIC(n_Add); const number sum = npAddM(n1, n2, r->cf);   
     74#ifdef HAVE_NUMSTATS
     75  // avoid double counting
     76  if( npIsZeroM(sum,r->cf) ) STATISTIC(n_CancelOut);
     77#endif
     78 return sum;
    7879
    79 #define n_Copy_FieldQ(n, r)        nlCopy(n, r->cf)
    80 #define n_Delete_FieldQ(n, r)      nlDelete(n,r->cf)
    81 #define n_Mult_FieldQ(n1, n2, r)   nlMult(n1,n2, r->cf)
    82 #define n_Add_FieldQ(n1, n2, r)    nlAdd(n1, n2, r->cf)
    83 #define n_IsZero_FieldQ(n, r)      nlIsZero(n, r->cf)
    84 #define n_Equal_FieldQ(n1, n2, r)  nlEqual(n1, n2, r->cf)
    85 #define n_Neg_FieldQ(n, r)         nlNeg(n, r->cf)
    86 #define n_Sub_FieldQ(n1, n2, r)    nlSub(n1, n2, r->cf)
    87 #define n_InpMult_FieldQ(n1, n2, r) nlInpMult(n1, n2, r->cf)
     80}
    8881
    89 static inline void n_InpAdd_FieldQ(number &n1, number n2, const ring r)
    90 { assume(rField_is_Q(r)); nlInpAdd(n1, n2, r->cf); }
     82static FORCE_INLINE number n_Sub_FieldZp(number n1, number n2, const ring r)
     83{ STATISTIC(n_Sub); const number d = npSubM(n1, n2, r->cf);   
     84#ifdef HAVE_NUMSTATS
     85  // avoid double counting
     86  if( npIsZeroM(d,r->cf) ) STATISTIC(n_CancelOut);
     87#endif 
     88  return d;
     89}
     90
     91static FORCE_INLINE BOOLEAN n_IsZero_FieldZp(number n, const ring r)
     92{ STATISTIC(n_IsZero); return npIsZeroM(n, r->cf); }
     93
     94static FORCE_INLINE BOOLEAN n_Equal_FieldZp(number n1, number n2, const ring r)
     95{ STATISTIC(n_Equal); return  npEqualM(n1, n2, r->cf); }
     96
     97static FORCE_INLINE number n_Neg_FieldZp(number n,     const ring r)
     98{ STATISTIC(n_InpNeg); return npNegM(n, r->cf); }
     99
     100static FORCE_INLINE void n_InpMult_FieldZp(number &n1, number n2, const ring r)
     101{ STATISTIC(n_InpMult); n1=npMultM(n1, n2, r->cf);  }
     102
     103static FORCE_INLINE void n_InpAdd_FieldZp(number &n1, number n2, const ring r)
     104{
     105  STATISTIC(n_InpAdd); assume(rField_is_Zp(r)); n1=npAddM(n1, n2, r->cf);
     106
     107#ifdef HAVE_NUMSTATS
     108  // avoid double counting
     109  if( npIsZeroM(n1,r->cf) ) STATISTIC(n_CancelOut);
    91110#endif
     111}
     112
     113#define DO_LFORCE_INLINE
     114#include <coeffs/longrat.cc> // for inlining... TODO: fix this Uglyness?!!!
     115
     116static FORCE_INLINE number n_Copy_FieldQ(number n,    const ring r)
     117{ STATISTIC(n_Copy); return nlCopy(n, r->cf); }
     118
     119static FORCE_INLINE void   n_Delete_FieldQ(number* n, const ring r)
     120{ STATISTIC(n_Delete); nlDelete(n,r->cf); }
     121
     122static FORCE_INLINE number n_Mult_FieldQ(number n1, number n2, const ring r)
     123{ STATISTIC(n_Mult); return nlMult(n1,n2, r->cf); }
     124
     125static FORCE_INLINE number n_Add_FieldQ(number n1, number n2, const ring r)
     126{ STATISTIC(n_Add); const number sum = nlAdd(n1, n2, r->cf);
     127
     128#ifdef HAVE_NUMSTATS
     129  // avoid double counting
     130  if( nlIsZero(sum,r->cf) ) STATISTIC(n_CancelOut);
     131#endif
     132
     133 return sum;
     134}
     135
     136static FORCE_INLINE number n_Sub_FieldQ(number n1, number n2, const ring r)
     137{ STATISTIC(n_Sub); const number d = nlSub(n1, n2, r->cf);
     138
     139#ifdef HAVE_NUMSTATS
     140  // avoid double counting
     141  if( nlIsZero(d,r->cf) ) STATISTIC(n_CancelOut);
     142#endif
     143
     144  return d;
     145}
     146
     147static FORCE_INLINE BOOLEAN n_IsZero_FieldQ(number n, const ring r)
     148{ STATISTIC(n_IsZero); return nlIsZero(n, r->cf); }
     149
     150static FORCE_INLINE BOOLEAN n_Equal_FieldQ(number n1, number n2, const ring r)
     151{ STATISTIC(n_Equal); return  nlEqual(n1, n2, r->cf); }
     152
     153static FORCE_INLINE number n_Neg_FieldQ(number n,     const ring r)
     154{ STATISTIC(n_InpNeg); return nlNeg(n, r->cf); }
     155
     156static FORCE_INLINE void n_InpMult_FieldQ(number &n1, number n2, const ring r)
     157{ STATISTIC(n_InpMult); nlInpMult(n1, n2, r->cf); }
     158
     159static FORCE_INLINE void n_InpAdd_FieldQ(number &n1, number n2, const ring r)
     160{ STATISTIC(n_InpAdd); assume(rField_is_Q(r)); nlInpAdd(n1, n2, r->cf);
     161
     162#ifdef HAVE_NUMSTATS
     163  // avoid double counting
     164  if( nlIsZero(n1,r->cf) ) STATISTIC(n_CancelOut);
     165#endif
     166}
     167
     168#endif
  • libpolys/tests/coeffs_test.h

    r635bdd rf2ba60d  
    4545  s = n_Init(N  , r);
    4646  i = n_Init(N+1, r);
    47   ndInpMult(s, i, r);
     47  n_InpMult(s, i, r);
    4848  n_Delete(&i, r);
    4949
     
    8787  {
    8888    i = n_Init(k, r);
    89     ndInpAdd(s, i, r); // s += i
     89    n_InpAdd(s, i, r); // s += i
    9090
    9191    i = n_InpNeg(i, r);
    92     ndInpAdd(ss, i, r); // ss -= i
     92    n_InpAdd(ss, i, r); // ss -= i
    9393
    9494    n_Delete(&i, r);
     
    121121
    122122  number t = n_Init(1, r);
    123   ndInpAdd(t, t, r);
     123  n_InpAdd(t, t, r);
    124124  TS_ASSERT( n_Equal(two, t, r) );
    125125  n_Delete(&t, r);
     
    128128  {
    129129    number t = n_Init(1, r);
    130     nlInpAdd(t, t, r);
     130    n_InpAdd(t, t, r);
    131131    TS_ASSERT( n_Equal(two, t, r) );
    132132    n_Delete(&t, r);
  • libpolys/tests/polys_test.h

    r635bdd rf2ba60d  
    16781678
    16791679    number t = n_Init(1, r);
    1680     ndInpAdd(t, t, r);
     1680    n_InpAdd(t, t, r);
    16811681    TS_ASSERT( n_Equal(two, t, r) );
    16821682    n_Delete(&t, r);
     
    16851685    {
    16861686      number t = n_Init(1, r);
    1687       nlInpAdd(t, t, r);
     1687      n_InpAdd(t, t, r);
    16881688      TS_ASSERT( n_Equal(two, t, r) );
    16891689      n_Delete(&t, r);
     
    17721772    s = n_Init(N  , r);
    17731773    i = n_Init(N+1, r);
    1774     ndInpMult(s, i, r);
     1774    n_InpMult(s, i, r);
    17751775    n_Delete(&i, r);
    17761776
     
    18141814    {
    18151815      i = n_Init(k, r);
    1816       ndInpAdd(s, i, r); // s += i
     1816      n_InpAdd(s, i, r); // s += i
    18171817
    18181818      i = n_InpNeg(i, r);
    1819       ndInpAdd(ss, i, r); // ss -= i
     1819      n_InpAdd(ss, i, r); // ss -= i
    18201820
    18211821      n_Delete(&i, r);
Note: See TracChangeset for help on using the changeset viewer.