Changeset 638ecc in git


Ignore:
Timestamp:
Nov 24, 2014, 4:44:46 PM (9 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
Children:
6ee080bd6cd0610fcc4933b669ef3e1fc6b1a67d
Parents:
cecb7ea8a22076db547d32bfdc5c879d5283420d57210380e33b596aa5c3868aecc8db1b364aad04
Message:
Merge pull request #671 from malex984/numstat

Adding _optional_ counting for operations with numbers
Files:
4 added
42 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/schreyer.lib

    rcecb7e r638ecc  
    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/calcSVD.cc

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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/gentable.cc

    r572103 r638ecc  
    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

    rcecb7e r638ecc  
    18001800    if (nMap==NULL)
    18011801    {
    1802       Werror("not implemented: map bigint -> %s",cf->cfCoeffString(cf));
     1802      Werror("not implemented: map bigint -> %s", nCoeffString(cf));
    18031803      return TRUE;
    18041804    }
     
    23392339err_fetch:
    23402340  Werror("no identity map from %s (%s -> %s)",u->Fullname(),
    2341     r->cf->cfCoeffString(r->cf),
    2342     currRing->cf->cfCoeffString(currRing->cf));
     2341         nCoeffString(r->cf),
     2342         nCoeffString(currRing->cf));
    23432343  return TRUE;
    23442344}
     
    37503750  else
    37513751  {
    3752     Werror("cannot convert bigint to cring %s",currRing->cf->cfCoeffString(currRing->cf));
     3752    Werror("cannot convert bigint to cring %s", nCoeffString(currRing->cf));
    37533753    bo=TRUE;
    37543754  }
     
    62686268  if ((cf!=NULL) && (cf->cfRandom!=NULL))
    62696269  {
    6270     number n=cf->cfRandom(siRand,(number)v->Data(),(number)w->Data(),cf);
     6270    number n= n_Random(siRand,(number)v->Data(),(number)w->Data(),cf);
    62716271    number2 nn=(number2)omAlloc(sizeof(*nn));
    62726272    nn->cf=cf;
  • Singular/ipconv.cc

    rcecb7e r638ecc  
    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/ipprint.cc

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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    1919    return omStrDup("oo");
    2020  }
    21   return omStrDup(c->cfCoeffName(c));
     21  return omStrDup(nCoeffName(c));
    2222}
    2323void crPrint(coeffs c)
  • Tst/Short/bug_interpol.res.gz.uu

    r572103 r638ecc  
    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

    r572103 r638ecc  
    33bug_minpoly
    44bug_newstruct
     5bug_ring
    56bug_ringlist
    67bug_tr237
  • kernel/ideals.cc

    r572103 r638ecc  
    23682368  if ((w !=NULL)&&(*w!=NULL) &&(del>0))
    23692369  {
    2370     intvec *wtmp=new intvec((*w)->length()-del);
     2370    int nl=si_max((*w)->length()-del,1);
     2371    intvec *wtmp=new intvec(nl);
    23712372    for(i=0;i<res->rank;i++) (*wtmp)[i]=(**w)[i];
    23722373    delete *w;
  • libpolys/coeffs/Makefile.am

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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/pDebug.cc

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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

    rcecb7e r638ecc  
    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.