Changeset 638ecc in git
- Timestamp:
- Nov 24, 2014, 4:44:46 PM (9 years ago)
- Branches:
- (u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
- Children:
- 6ee080bd6cd0610fcc4933b669ef3e1fc6b1a67d
- Parents:
- cecb7ea8a22076db547d32bfdc5c879d5283420d57210380e33b596aa5c3868aecc8db1b364aad04
- Files:
-
- 4 added
- 42 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/schreyer.lib
rcecb7e r638ecc 2259 2259 exportto(Schreyer, Syzextra::ComputeResolution); 2260 2260 2261 exportto(Top, Syzextra::NumberStatsInit); 2262 exportto(Top, Syzextra::NumberStatsPrint); 2263 2261 2264 newstruct("SRES","ring r,resolution rsltn"); // http://www.singular.uni-kl.de/Manual/latest/sing_179.htm#SEC218 2262 2265 newstruct("SSYZ","ring r,module szg"); // http://www.singular.uni-kl.de/Manual/latest/sing_179.htm#SEC218 … … 2581 2584 proc s_res(def I, int l) 2582 2585 { 2586 int @prot = (find(option(),"prot") != 0); 2583 2587 def R=SSinit(I); setring R; int @l = size(RES); 2584 2588 SRES ret; ret.r = R; 2589 if(@prot){ NumberStatsInit(); } 2585 2590 ret.rsltn = ComputeResolution(RES[@l], LRES[@l], TRES[@l], l); 2591 if(@prot){ NumberStatsPrint("Number statistic for s_res with ComputeResolution"); } 2586 2592 return (ret); 2587 2593 } -
Singular/calcSVD.cc
rcecb7e r638ecc 18 18 { 19 19 poly p=pInit(); 20 currRing->cf->nRead(s,&pGetCoeff(p));20 n_Read(s, &pGetCoeff(p), currRing->cf); 21 21 return p; 22 22 } -
Singular/dyn_modules/syzextra/mod_main.cc
rcecb7e r638ecc 263 263 const ring r = currRing; 264 264 265 #ifdef LDEBUG 266 r->cf->cfDBTest(n,__FILE__,__LINE__,r->cf); 267 #endif 265 n_Test(n, r->cf); 268 266 269 267 StringSetS(""); … … 1931 1929 } 1932 1930 1933 1931 // no args. 1932 // init num stats 1933 static 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 1954 static 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 } 1934 1972 1935 1973 END_NAMESPACE … … 1991 2029 // ADD("GetAMData", FALSE, GetAMData); 1992 2030 2031 ADD("NumberStatsInit", FALSE, _NumberStatsInit); 2032 ADD("NumberStatsPrint", FALSE, _NumberStatsPrint); 2033 1993 2034 // ADD("", FALSE, ); 1994 2035 -
Singular/gentable.cc
r572103 r638ecc 20 20 #include "grammar.h" 21 21 #include "tok.h" 22 23 inline int RingDependend(int t) { return (BEGIN_RING<t)&&(t<END_RING); } 22 24 23 25 // to produce convert_table.texi for doc: … … 348 350 Tok2Cmdname(dArith1[i].arg), 349 351 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 } 350 356 i++; 351 357 } … … 362 368 Tok2Cmdname(dArith2[i].arg2), 363 369 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 } 364 376 i++; 365 377 } … … 377 389 Tok2Cmdname(dArith3[i].arg3), 378 390 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 } 379 398 i++; 380 399 } -
Singular/iparith.cc
rcecb7e r638ecc 1800 1800 if (nMap==NULL) 1801 1801 { 1802 Werror("not implemented: map bigint -> %s", cf->cfCoeffString(cf));1802 Werror("not implemented: map bigint -> %s", nCoeffString(cf)); 1803 1803 return TRUE; 1804 1804 } … … 2339 2339 err_fetch: 2340 2340 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)); 2343 2343 return TRUE; 2344 2344 } … … 3750 3750 else 3751 3751 { 3752 Werror("cannot convert bigint to cring %s", currRing->cf->cfCoeffString(currRing->cf));3752 Werror("cannot convert bigint to cring %s", nCoeffString(currRing->cf)); 3753 3753 bo=TRUE; 3754 3754 } … … 6268 6268 if ((cf!=NULL) && (cf->cfRandom!=NULL)) 6269 6269 { 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); 6271 6271 number2 nn=(number2)omAlloc(sizeof(*nn)); 6272 6272 nn->cf=cf; -
Singular/ipconv.cc
rcecb7e r638ecc 58 58 if (nMap==NULL) 59 59 { 60 Werror("no conversion from bigint to %s", currRing->cf->cfCoeffString(currRing->cf));60 Werror("no conversion from bigint to %s", nCoeffString(currRing->cf)); 61 61 return NULL; 62 62 } … … 79 79 if (nMap==NULL) 80 80 { 81 Werror("no conversion from bigint to %s", currRing->cf->cfCoeffString(currRing->cf));81 Werror("no conversion from bigint to %s", nCoeffString(currRing->cf)); 82 82 return NULL; 83 83 } … … 102 102 if (nMap==NULL) 103 103 { 104 Werror("no conversion from bigint to %s", currRing->cf->cfCoeffString(currRing->cf));104 Werror("no conversion from bigint to %s", nCoeffString(currRing->cf)); 105 105 return NULL; 106 106 } … … 186 186 if (nMap==NULL) 187 187 { 188 Werror("no conversion from bigint to %s", currRing->cf->cfCoeffString(currRing->cf));188 Werror("no conversion from bigint to %s", nCoeffString(currRing->cf)); 189 189 return NULL; 190 190 } -
Singular/ipprint.cc
rcecb7e r638ecc 222 222 } 223 223 else PrintS("field: "); 224 PrintS( r->cfCoeffName(r));224 PrintS(nCoeffName(r)); 225 225 return FALSE; 226 226 } -
Singular/ipshell.cc
rcecb7e r638ecc 228 228 case CNUMBER_CMD: 229 229 { number2 n=(number2)IDDATA(h); 230 Print(" (%s)",n ->cf->cfCoeffName(n->cf));230 Print(" (%s)",nCoeffName(n->cf)); 231 231 break; 232 232 } … … 235 235 Print(" %d x %d (%s)", 236 236 b->rows(),b->cols(), 237 b->basecoeffs()->cfCoeffName(b->basecoeffs()));237 nCoeffName(b->basecoeffs())); 238 238 break; 239 239 } -
Singular/links/ssiLink.cc
rcecb7e r638ecc 120 120 void ssiWriteBigInt(const ssiInfo *d, const number n) 121 121 { 122 coeffs_BIGINT->cfWriteFd(n,d->f_write,coeffs_BIGINT);122 n_WriteFd(n,d->f_write,coeffs_BIGINT); 123 123 } 124 124 … … 146 146 else if (cf->cfWriteFd!=NULL) 147 147 { 148 cf->cfWriteFd(n,d->f_write,cf);148 n_WriteFd(n,d->f_write,cf); 149 149 } 150 150 else WerrorS("coeff field not implemented"); … … 390 390 if (cf->cfReadFd!=NULL) 391 391 { 392 return cf->cfReadFd(d->f_read,cf);392 return n_ReadFd(d->f_read,cf); 393 393 } 394 394 else if (getCoeffType(cf) == n_transExt) -
Singular/number2.cc
rcecb7e r638ecc 19 19 return omStrDup("oo"); 20 20 } 21 return omStrDup( c->cfCoeffName(c));21 return omStrDup(nCoeffName(c)); 22 22 } 23 23 void 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```` 1 begin 644 bug_interpol.res.gz 2 M'XL(")QR;U0``V)U9U]I;G1E<G!O;"YR97,`C5C+;ALW%-WG*XB@"RDVE.&; 3 MC"(5*+H)4&23[HPT\6,:C"!+ACQV`Q3]]W(.J2$I#F5[(=N7AY?GGL.GOOSY 4 M^Z?/A!"Z)G]\^HV\[1_[Q;:[>;M\\R6TL#5QP6_=KNMG\^6;X3=9K\G-TP\7 5 MZ]O#PWZ[V+7_+![[ZW[LQ-=D_%LLR/OWY(B][KO]CO3M8_]A1,A%1*L%V7:/ 6 M/=E&!GH]]'YN;\ES#)IUGG*VO7QV]%S+KV2W)X=N]X-<W_;=<^MC[>&P/Y#] 7 M[>W3X=#>N;[$_7O3_KT_M,3GW':[EI@/Y/M$WN_CN!;CDMV*-LW(AC8^>N^B 8 M,4A]<!,C3DL0.ZS8Y<\972QV\\N[A]CN9.ONVNLM26)B31S)V9"I6]%E]_%^ 9 MV5U<S,=V)]Z_XS].O>%GZ+!QX,W'U6ZY2='&`\8>K/$!0AZN-E]7/V>;^<7A 10 M>G>WOY\UEW0^TF#,X_X;`\('ME?=UU6DRP*#YR%,8]B-&[O::>^^7=&!@97S 11 M"_>I\6GP:8=/)_C<81@P`G%UBAPP%]2A.%`4+3Q@75@@W!2=;=99#BACIX<X 12 MP2I@3390FM=!-"`(&Q]FU=0.;@"7!=PD(EA@1#)J7CYM`.`)0"?=*80V#']# 13 M4$.+\?@IO9@=ZIHF+QHM$%C;BAREFQ1::Y.,SD,J**O/,AI2`0N)M<JS)(,/ 14 M&.BJ99T:,D%9+:;5.$Y!J*MY04V5U!BDUJR@!J\9Q->T:#V1?8!"=-TD@_H4 15 MD%S9Z=J/G2&S,E6!4GL9E%<Z`4_-?`;1U>OFM>\!"U0YM>L]8(<2I[Q#61Q& 16 MJ-2(.E\.)U3IA)H"PQA%7R*9=H%!JBDREUYR>";MZWC#.YEZ]X)J'`9*7:DT 17 MQ\)%6;HXSD.@X)PL%D\D":-DN6[J6[2`>9*_KLO0`09*5EEVDV/`1EEN;D?/ 18 M!PQ\D\VYM9%K)F"?L!-F"9@EIGP4<$6\N,4.4)@B4E-R`K!#R&+^^(+@A2B] 19 M"'N<A/"B.!Q<^]`*E45%WWA&0EEQ_M@(="44%DV!K1LG(3&W%?`Q,=3FY=(H 20 M=G\)\7EQGHZ9H#BOG2#054)U?N8$&9%P@%=.D5HO!5]XN2#2`U/!'I[N8K6S 21 M5<$B7AXN4WXJ>,33XZ6<EPJNL).;$;K#"58[8#*M%;Q@NJASPF$%7UCIR^1= 22 M#`:Q=%F<%QPV,9'AAPL;C&"\0BTL(PTG&"O*P(33$)_1)"L49NDJJ%]!-92F 23 MMDA>O;EH.$#/K`6@H#U-AH]#0FJJ)FP;6J$M/7MVQU00EI;S'](8R$O+>3ZQ 24 MTQF(3--*\HW"0&=:F^3I[#4P@#:%-O[:[=\&YQ;+"37_3*A[`Y"_Q=871&3G 25 MKU,5?4^*]L=Q,9.R:OTI,%$L4EB_V23-67'63^[Z5N117OS*C"YKM,&!9OX7 26 M2Z)>>3M_%U*/V;*^D-LEC:AC"S1V@[Z+(8CIV)Q/"1F=+N=1$-+5'].[7_!> 27 MEV1H0T,U*-'/+=JP2-X>[PUHX)&[+2=?MA?21L2JK,U<0;.,Y>2#J%C!V`\- 28 M.I:1]S"!KR_"^*!-N)JXGJE_;09>)I^/(.[?FX%9^E8>`2QA:!*&X:F9C&G" 29 MF"*0\0Q#4"9$*M??\0FL$DXE-E?>/S`#OS.WG?21[!^<@?J+`]C`W)>C_,N\ 30 M22BJ;%0TTX14Z,&2,54Q0_P;TG7WHX0T(DG#$^W]HS$DXVF:XWSR:0(ZG4LL 31 G37/4`>C!OO`]$&_BMX2<+O`UX_`MXM.CVU*6O[SY'YL/6_J<%``` 33 32 ` 34 33 end -
Tst/Short/ok_s.lst
r572103 r638ecc 3 3 bug_minpoly 4 4 bug_newstruct 5 bug_ring 5 6 bug_ringlist 6 7 bug_tr237 -
kernel/ideals.cc
r572103 r638ecc 2368 2368 if ((w !=NULL)&&(*w!=NULL) &&(del>0)) 2369 2369 { 2370 intvec *wtmp=new intvec((*w)->length()-del); 2370 int nl=si_max((*w)->length()-del,1); 2371 intvec *wtmp=new intvec(nl); 2371 2372 for(i=0;i<res->rank;i++) (*wtmp)[i]=(**w)[i]; 2372 2373 delete *w; -
libpolys/coeffs/Makefile.am
rcecb7e r638ecc 24 24 libcoeffs_la_include_HEADERS = \ 25 25 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 \ 27 27 bigintmat.h Enumerator.h AE.h OPAE.h AEp.h OPAEp.h AEQ.h OPAEQ.h 28 28 -
libpolys/coeffs/OPAE.cc
rcecb7e r638ecc 298 298 // r->is_field, r->is_domain? 299 299 r->ch = 0; 300 r->cfKillChar = ndKillChar; /* dummy */301 r->nCoeffIsEqual=ndCoeffIsEqual;300 //r->cfKillChar = ndKillChar; /* dummy */ 301 //r->nCoeffIsEqual=ndCoeffIsEqual; 302 302 r->cfMult = nAEMult; 303 303 r->cfSub = nAESub; -
libpolys/coeffs/OPAEQ.cc
rcecb7e r638ecc 290 290 // r->is_field,is_domain? 291 291 r->ch=0; 292 r->cfKillChar=ndKillChar;293 r->nCoeffIsEqual=ndCoeffIsEqual;292 //r->cfKillChar=ndKillChar; 293 //r->nCoeffIsEqual=ndCoeffIsEqual; 294 294 r->cfMult = nAEQMult; 295 295 r->cfSub = nAEQSub; -
libpolys/coeffs/OPAEp.cc
rcecb7e r638ecc 316 316 r->ch=c; 317 317 r->cfKillChar=NULL; 318 r->nCoeffIsEqual=ndCoeffIsEqual;318 //r->nCoeffIsEqual=ndCoeffIsEqual; 319 319 r->cfMult = nAEpMult; 320 320 r->cfSub = nAEpSub; -
libpolys/coeffs/bigintmat.cc
rcecb7e r638ecc 1557 1557 char * s; 1558 1558 ::Print("mat over Z is \n"); 1559 ::Print("%s\n", s = basecoeffs()->cfCoeffString(basecoeffs()));1559 ::Print("%s\n", s = nCoeffString(basecoeffs())); 1560 1560 omFree(s); 1561 1561 Print(); -
libpolys/coeffs/coeffs.h
rcecb7e r638ecc 17 17 18 18 #include <coeffs/si_gmp.h> 19 20 19 #include <coeffs/Enumerator.h> 20 #include <coeffs/numstats.h> // for STATISTIC(F) counting macro 21 21 22 22 class CanonicalForm; … … 268 268 nMapFunc (*cfSetMap)(const coeffs src, const coeffs dst); 269 269 270 /// io via ssi:271 270 void (*cfWriteFd)(number a, FILE *f, const coeffs r); 272 271 number (*cfReadFd)( s_buff f, const coeffs r); … … 416 415 #endif 417 416 }; 418 // 417 419 418 // test properties and type 420 419 /// 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 } 420 static FORCE_INLINE n_coeffType getCoeffType(const coeffs r) 421 { assume(r != NULL); return r->type; } 426 422 427 423 /// one-time initialisations for new coeffs … … 430 426 431 427 /// "copy" coeffs, i.e. increment ref 432 static inline coeffs nCopyCoeff(const coeffs cf) { cf->ref++; return cf;} 428 static FORCE_INLINE coeffs nCopyCoeff(const coeffs r) 429 { assume(r!=NULL); r->ref++; return r;} 433 430 434 431 /// undo all initialisations … … 436 433 437 434 /// 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 } 435 static FORCE_INLINE void nSetChar(const coeffs r) 436 { STATISTIC(nSetChar); assume(r!=NULL); assume(r->cfSetChar != NULL); r->cfSetChar(r); } 444 437 445 438 void nNew(number * a); … … 448 441 449 442 /// 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 } 443 static FORCE_INLINE int n_GetChar(const coeffs r) 444 { STATISTIC(n_GetChar); assume(r != NULL); return r->ch; } 455 445 456 446 … … 458 448 459 449 /// 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); }450 static 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); } 462 452 463 453 /// 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); }454 static 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); } 466 456 467 457 /// TRUE iff 'a' and 'b' represent the same number; 468 458 /// 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); }459 static 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); } 471 461 472 462 /// 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); }463 static 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); } 475 465 476 466 /// 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); }467 static 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); } 479 469 480 470 /// 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); }471 static 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); } 483 473 484 474 /// ordered fields: TRUE iff 'n' is positive; … … 501 491 /// start with - 502 492 /// 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 } 493 static 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); } 508 495 509 496 /// ordered fields: TRUE iff 'a' is larger than 'b'; … … 521 508 /// !!! Recommendation: remove implementations for unordered fields 522 509 /// !!! 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); }510 static 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); } 525 512 526 513 #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); }514 static 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); } 529 516 530 517 /// 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); }518 static 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); } 533 520 534 521 /// in Z: 1 … … 539 526 // CF: shold imply that n/GetUnit(n) is normalized in Z/kZ 540 527 // 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); }528 static 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 531 static 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); } 546 533 #endif 547 534 548 535 /// 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); }536 static 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); } 551 538 552 539 /// 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); }540 static 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); } 555 542 556 543 /// conversion of n to an int; 0 if not possible 557 544 /// 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); }545 static 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); } 560 547 561 548 /// 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); }549 static 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); } 564 551 565 552 566 553 /// in-place negation of n 567 554 /// 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); }555 static 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); } 570 557 571 558 /// return the multiplicative inverse of 'a'; … … 573 560 /// 574 561 /// !!! 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); }562 static 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); } 577 564 578 565 /// return a non-negative measure for the complexity of n; 579 566 /// return 0 only when n represents zero; 580 567 /// (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); }568 static 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); } 583 570 584 571 /// inplace-normalization of n; … … 587 574 /// !!! Recommendation: remove this method from the user-interface, i.e., 588 575 /// !!! 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); }576 static 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); } 591 578 592 579 /// write to the output buffer of the currently used reporter 593 580 //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); }581 static 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); } 596 583 597 584 /// write to the output buffer of the currently used reporter 598 585 /// 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); }586 static 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 589 static 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); } 604 591 605 592 … … 607 594 /// !!! interface. As defined here, it is merely a helper 608 595 /// !!! 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); }596 static 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); } 611 598 612 599 /// return the denominator of n 613 600 /// (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); }601 static 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); } 616 603 617 604 /// return the numerator of n 618 605 /// (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); } 606 static 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); } 647 608 648 609 /// return the quotient of 'a' and 'b', i.e., a/b; 649 610 /// 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); } 611 static 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); } 657 613 658 614 /// assume that there is a canonical subring in cf and we know … … 660 616 /// n_ExactDiv performs it, may skip additional tests. 661 617 /// 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); } 618 static 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 623 static 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 627 static 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 631 static 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 636 static 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 641 static 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 651 static 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 664 static 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 } 664 674 665 675 /// in Z: return the gcd of 'a' and 'b' … … 669 679 /// in K(a)/<p(a)>: not implemented 670 680 /// 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); }681 static 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); } 683 static 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); } 675 685 676 686 /// beware that ExtGCD is only relevant for a few chosen coeff. domains 677 687 /// 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); }688 static 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); } 690 static 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); } 692 static 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); } 684 694 /// if r is a ring with zero divisors, return an annihilator!=0 of b 685 695 /// 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); }696 static FORCE_INLINE number n_Ann(number a, const coeffs r) 697 { STATISTIC(n_Ann); assume(r != NULL); return r->cfAnn (a,r); } 698 static 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); } 690 700 691 701 … … 695 705 /// in K(a)/<p(a)>: not implemented 696 706 /// 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); }707 static 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); } 699 709 700 710 /// assume that r is a quotient field (otherwise, return 1) 701 711 /// 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); }712 static 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); } 704 714 705 715 /// 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 716 static 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 709 720 /// test whether n is a correct number; 710 721 /// 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) 722 static 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); } 713 724 #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 728 static FORCE_INLINE BOOLEAN n_DBTest(number, const char*, const int, const coeffs) 729 { STATISTIC(n_Test); return TRUE; } 715 730 #endif 716 {717 #ifndef LDEBUG718 return TRUE;719 #else720 assume(r != NULL); assume(r->cfDBTest != NULL);721 return r->cfDBTest(n, filename, linenumber, r);722 #endif723 }724 731 725 732 /// 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); }733 static 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); } 728 735 729 736 // Tests: 730 static inlineBOOLEAN nCoeff_is_Ring_2toM(const coeffs r)737 static FORCE_INLINE BOOLEAN nCoeff_is_Ring_2toM(const coeffs r) 731 738 { assume(r != NULL); return (getCoeffType(r)==n_Z2m); } 732 739 733 static inlineBOOLEAN nCoeff_is_Ring_ModN(const coeffs r)740 static FORCE_INLINE BOOLEAN nCoeff_is_Ring_ModN(const coeffs r) 734 741 { assume(r != NULL); return (getCoeffType(r)==n_Zn); } 735 742 736 static inlineBOOLEAN nCoeff_is_Ring_PtoM(const coeffs r)743 static FORCE_INLINE BOOLEAN nCoeff_is_Ring_PtoM(const coeffs r) 737 744 { assume(r != NULL); return (getCoeffType(r)==n_Znm); } 738 745 739 static inlineBOOLEAN nCoeff_is_Ring_Z(const coeffs r)746 static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r) 740 747 { assume(r != NULL); return (getCoeffType(r)==n_Z); } 741 748 742 static inlineBOOLEAN nCoeff_is_Ring(const coeffs r)749 static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r) 743 750 { assume(r != NULL); return (r->is_field==0); } 744 751 745 752 /// returns TRUE, if r is a field or r has no zero divisors (i.e is a domain) 746 static inlineBOOLEAN nCoeff_is_Domain(const coeffs r)753 static FORCE_INLINE BOOLEAN nCoeff_is_Domain(const coeffs r) 747 754 { 748 755 assume(r != NULL); … … 758 765 /// in Z/2^kZ: TRUE iff ((a = 0 mod 2^k) and (b = 0 or b is a power of 2)) 759 766 /// 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); 767 static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r) 768 { STATISTIC(n_DivBy); assume(r != NULL); 763 769 #ifdef HAVE_RINGS 764 770 if( nCoeff_is_Ring(r) ) … … 770 776 } 771 777 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 } 778 static 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 781 static 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 784 static 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); } 786 786 787 787 /// Returns the number of parameters 788 static inline int n_NumberOfParameters(const coeffs r){ return r->iNumberOfParameters; } 788 static FORCE_INLINE int n_NumberOfParameters(const coeffs r) 789 { STATISTIC(n_NumberOfParameters); assume(r != NULL); return r->iNumberOfParameters; } 789 790 790 791 /// Returns a (const!) pointer to (const char*) names of parameters 791 static inline char const * * n_ParameterNames(const coeffs r){ return r->pParameterNames; }792 792 static FORCE_INLINE char const * * n_ParameterNames(const coeffs r) 793 { STATISTIC(n_ParameterNames); assume(r != NULL); return r->pParameterNames; } 793 794 794 795 /// return the (iParameter^th) parameter as a NEW number 795 796 /// NOTE: parameter numbering: 1..n_NumberOfParameters(...) 796 static inline number n_Param(const int iParameter, const coeffs r) 797 { 798 assume(r != NULL); 797 static FORCE_INLINE number n_Param(const int iParameter, const coeffs r) 798 { assume(r != NULL); 799 799 assume((iParameter >= 1) || (iParameter <= n_NumberOfParameters(r))); 800 800 assume(r->cfParameter != NULL); 801 return r->cfParameter(iParameter, r);801 STATISTIC(n_Param); return r->cfParameter(iParameter, r); 802 802 } 803 803 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 } 804 static 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 807 static 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); } 814 809 815 810 /// returns TRUE, if r is not a field and r has non-trivial units 816 static inlineBOOLEAN nCoeff_has_Units(const coeffs r)811 static FORCE_INLINE BOOLEAN nCoeff_has_Units(const coeffs r) 817 812 { assume(r != NULL); return ((getCoeffType(r)==n_Zn) || (getCoeffType(r)==n_Z2m) || (getCoeffType(r)==n_Znm)); } 818 813 819 static inlineBOOLEAN nCoeff_is_Zp(const coeffs r)814 static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r) 820 815 { assume(r != NULL); return getCoeffType(r)==n_Zp; } 821 816 822 static inlineBOOLEAN nCoeff_is_Zp(const coeffs r, int p)817 static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r, int p) 823 818 { assume(r != NULL); return ((getCoeffType(r)==n_Zp) && (r->ch == p)); } 824 819 825 static inlineBOOLEAN nCoeff_is_Q(const coeffs r)820 static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r) 826 821 { assume(r != NULL); return getCoeffType(r)==n_Q && (r->is_field); } 827 822 828 static inlineBOOLEAN nCoeff_is_numeric(const coeffs r) /* R, long R, long C */823 static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r) /* R, long R, long C */ 829 824 { assume(r != NULL); return (getCoeffType(r)==n_R) || (getCoeffType(r)==n_long_R) || (getCoeffType(r)==n_long_C); } 830 825 // (r->ringtype == 0) && (r->ch == -1); ?? 831 826 832 static inlineBOOLEAN nCoeff_is_R(const coeffs r)827 static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r) 833 828 { assume(r != NULL); return getCoeffType(r)==n_R; } 834 829 835 static inlineBOOLEAN nCoeff_is_GF(const coeffs r)830 static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r) 836 831 { assume(r != NULL); return getCoeffType(r)==n_GF; } 837 832 838 static inlineBOOLEAN nCoeff_is_GF(const coeffs r, int q)833 static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r, int q) 839 834 { assume(r != NULL); return (getCoeffType(r)==n_GF) && (r->ch == q); } 840 835 841 836 /* TRUE iff r represents an algebraic or transcendental extension field */ 842 static inlineBOOLEAN nCoeff_is_Extension(const coeffs r)837 static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r) 843 838 { 844 839 assume(r != NULL); … … 853 848 height above some field of characteristic p (may be Z/pZ or some 854 849 Galois field of characteristic p) */ 855 static inlineBOOLEAN nCoeff_is_Zp_a(const coeffs r)850 static FORCE_INLINE BOOLEAN nCoeff_is_Zp_a(const coeffs r) 856 851 { 857 852 assume(r != NULL); … … 866 861 height above some field of characteristic p (may be Z/pZ or some 867 862 Galois field of characteristic p) */ 868 static inlineBOOLEAN nCoeff_is_Zp_a(const coeffs r, int p)863 static FORCE_INLINE BOOLEAN nCoeff_is_Zp_a(const coeffs r, int p) 869 864 { 870 865 assume(r != NULL); … … 879 874 actually: TRUE iff the given r is an extension tower of arbitrary 880 875 height above some field of characteristic 0 (may be Q, R, or C) */ 881 static inlineBOOLEAN nCoeff_is_Q_a(const coeffs r)876 static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r) 882 877 { 883 878 assume(r != NULL); … … 888 883 889 884 890 static inlineBOOLEAN nCoeff_is_long_R(const coeffs r)885 static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r) 891 886 { assume(r != NULL); return getCoeffType(r)==n_long_R; } 892 887 893 static inlineBOOLEAN nCoeff_is_long_C(const coeffs r)888 static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r) 894 889 { assume(r != NULL); return getCoeffType(r)==n_long_C; } 895 890 896 static inlineBOOLEAN nCoeff_is_CF(const coeffs r)891 static FORCE_INLINE BOOLEAN nCoeff_is_CF(const coeffs r) 897 892 { assume(r != NULL); return getCoeffType(r)==n_CF; } 898 893 899 894 /// TRUE, if the computation of the inverse is fast, 900 895 /// i.e. prefer leading coeff. 1 over content 901 static inlineBOOLEAN nCoeff_has_simple_inverse(const coeffs r)896 static FORCE_INLINE BOOLEAN nCoeff_has_simple_inverse(const coeffs r) 902 897 { assume(r != NULL); return r->has_simple_Inverse; } 903 898 904 899 /// TRUE if n_Delete/n_New are empty operations 905 static inlineBOOLEAN nCoeff_has_simple_Alloc(const coeffs r)900 static FORCE_INLINE BOOLEAN nCoeff_has_simple_Alloc(const coeffs r) 906 901 { assume(r != NULL); return r->has_simple_Alloc; } 907 902 908 903 /// TRUE iff r represents an algebraic extension field 909 static inlineBOOLEAN nCoeff_is_algExt(const coeffs r)904 static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r) 910 905 { assume(r != NULL); return (getCoeffType(r)==n_algExt); } 911 906 912 907 /// is it an alg. ext. of Q? 913 static inlineBOOLEAN nCoeff_is_Q_algext(const coeffs r)908 static FORCE_INLINE BOOLEAN nCoeff_is_Q_algext(const coeffs r) 914 909 { assume(r != NULL); return ((n_GetChar(r) == 0) && nCoeff_is_algExt(r)); } 915 910 916 911 /// TRUE iff r represents a transcendental extension field 917 static inlineBOOLEAN nCoeff_is_transExt(const coeffs r)912 static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r) 918 913 { assume(r != NULL); return (getCoeffType(r)==n_transExt); } 919 914 … … 928 923 /// NOTE/TODO: see also the description by Hans 929 924 /// 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 } 925 static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs r) 926 { STATISTIC(n_ClearContent); assume(r != NULL); r->cfClearContent(numberCollectionEnumerator, c, r); } 935 927 936 928 /// (inplace) Clears denominators on a collection of numbers … … 938 930 /// with which all the number coeffs. were multiplied) 939 931 /// 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 } 932 static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, number& d, const coeffs r) 933 { STATISTIC(n_ClearDenominators); assume(r != NULL); r->cfClearDenominators(numberCollectionEnumerator, d, r); } 945 934 946 935 // convenience helpers (no number returned - but the input enumeration … … 950 939 // *p_Content) and p_Cleardenom_n (which doesn't)!!! 951 940 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 } 941 static 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 944 static 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); } 966 946 967 947 … … 970 950 void n_Print(number& a, const coeffs r); 971 951 952 953 954 /// TODO: make it a virtual method of coeffs, together with: 955 /// Decompose & Compose, rParameter & rPar 956 static FORCE_INLINE char * nCoeffString(const coeffs cf) 957 { STATISTIC(nCoeffString); assume( cf != NULL ); return cf->cfCoeffString(cf); } 958 959 960 static FORCE_INLINE char * nCoeffName (const coeffs cf) 961 { STATISTIC(nCoeffName); assume( cf != NULL ); return cf->cfCoeffName(cf); } 962 963 static 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: 967 static 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: 971 static 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! 977 number n_convFactoryNSingN( const CanonicalForm n, const coeffs r); 978 979 CanonicalForm n_convSingNFactoryN( number n, BOOLEAN setChar, const coeffs r ); 980 972 981 #endif 973 982 -
libpolys/coeffs/gnumpc.cc
rcecb7e r638ecc 482 482 483 483 n->cfDelete = ngcDelete; 484 n->cfNormalize=ndNormalize;484 //n->cfNormalize=ndNormalize; 485 485 n->cfInit = ngcInit; 486 486 n->cfInt = ngcInt; … … 511 511 // cfSize = ndSize; 512 512 #ifdef LDEBUG 513 n->cfDBTest = ndDBTest; // not yet implemented: ngcDBTest513 //n->cfDBTest = ndDBTest; // not yet implemented: ngcDBTest 514 514 #endif 515 515 -
libpolys/coeffs/gnumpfl.cc
rcecb7e r638ecc 418 418 n->rep=n_rep_gmp_float; 419 419 420 n->cfKillChar = ndKillChar; /* dummy */420 //n->cfKillChar = ndKillChar; /* dummy */ 421 421 422 422 n->cfSetChar = ngfSetChar; … … 425 425 426 426 n->cfDelete = ngfDelete; 427 n->cfNormalize=ndNormalize;427 //n->cfNormalize=ndNormalize; 428 428 n->cfInit = ngfInit; 429 429 n->cfInt = ngfInt; … … 448 448 n->cfCoeffWrite = ngfCoeffWrite; 449 449 #ifdef LDEBUG 450 n->cfDBTest = ndDBTest; // not yet implemented: ngfDBTest450 //n->cfDBTest = ndDBTest; // not yet implemented: ngfDBTest 451 451 #endif 452 452 -
libpolys/coeffs/longrat.cc
rcecb7e r638ecc 3068 3068 3069 3069 r->nCoeffIsEqual=nlCoeffIsEqual; 3070 r->cfKillChar = ndKillChar; /* dummy */3070 //r->cfKillChar = ndKillChar; /* dummy */ 3071 3071 r->cfCoeffString=nlCoeffString; 3072 3072 r->cfCoeffName=nlCoeffName; -
libpolys/coeffs/modulop.cc
rcecb7e r638ecc 503 503 r->cfGreaterZero = npGreaterZero; 504 504 //r->cfPower = npPower; 505 r->cfGetDenom = ndGetDenom;506 r->cfGetNumerator = ndGetNumerator;505 //r->cfGetDenom = ndGetDenom; 506 //r->cfGetNumerator = ndGetNumerator; 507 507 //r->cfGcd = ndGcd; 508 508 //r->cfLcm = ndGcd; … … 510 510 r->cfSetMap = npSetMap; 511 511 //r->cfName = ndName; 512 r->cfInpMult=ndInpMult;512 //r->cfInpMult=ndInpMult; 513 513 #ifdef NV_OPS 514 514 if (c>NV_MAX_PRIME) -
libpolys/coeffs/numbers.cc
rcecb7e r638ecc 10 10 #include <stdlib.h> 11 11 12 13 14 15 12 #include <misc/auxiliary.h> 16 13 #include <omalloc/omalloc.h> 17 14 #include <factory/factory.h> 18 15 19 #include "coeffs.h" 16 #include <reporter/reporter.h> 17 18 #include <coeffs/coeffs.h> 20 19 #include <coeffs/numbers.h> 21 20 22 #include <reporter/reporter.h>23 #include <omalloc/omalloc.h>24 21 #include <coeffs/numbers.h> 25 22 #include <coeffs/longrat.h> … … 42 39 43 40 41 #ifdef HAVE_NUMSTATS 42 struct SNumberStatistic number_stats; 43 #endif /* HAVE_NUMSTATS */ 44 44 45 45 //static int characteristic = 0; … … 49 49 50 50 void 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 53 static void ndDelete(number* d, const coeffs) { *d=NULL; } 54 static number ndAnn(number, const coeffs) { return NULL;} 55 static char* ndCoeffString(const coeffs r) 54 56 { 55 57 char *s=(char *)omAlloc(11);snprintf(s,11,"Coeffs(%d)",r->type); 56 58 return s; 57 59 } 58 void ndInpMult(number &a, number b, const coeffs r)59 { 60 number n= n_Mult(a,b,r);61 n_Delete(&a,r);60 static void ndInpMult(number &a, number b, const coeffs r) 61 { 62 number n=r->cfMult(a,b,r); 63 r->cfDelete(&a,r); 62 64 a=n; 63 65 } 64 void ndInpAdd(number &a, number b, const coeffs r)65 { 66 number n= n_Add(a,b,r);67 n_Delete(&a,r);66 static void ndInpAdd(number &a, number b, const coeffs r) 67 { 68 number n=r->cfAdd(a,b,r); 69 r->cfDelete(&a,r); 68 70 a=n; 69 71 } 70 72 71 void ndPower(number a, int i, number * res, const coeffs r)73 static void ndPower(number a, int i, number * res, const coeffs r) 72 74 { 73 75 if (i==0) { 74 *res = n_Init(1, r);76 *res = r->cfInit(1, r); 75 77 } else if (i==1) { 76 *res = n_Copy(a, r);78 *res = r->cfCopy(a, r); 77 79 } else if (i==2) { 78 *res = n_Mult(a, a, r);80 *res = r->cfMult(a, a, r); 79 81 } else if (i<0) { 80 number b = n_Invers(a, r);82 number b = r->cfInvers(a, r); 81 83 ndPower(b, -i, res, r); 82 n_Delete(&b, r);84 r->cfDelete(&b, r); 83 85 } else { 84 86 ndPower(a, i/2, res, r); 85 n_InpMult(*res, *res, r);87 r->cfInpMult(*res, *res, r); 86 88 if (i&1) { 87 n_InpMult(*res, a, r);89 r->cfInpMult(*res, a, r); 88 90 } 89 91 } 90 92 } 93 91 94 #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; } 96 static BOOLEAN ndDBTest(number, const char *, const int, const coeffs){ return TRUE; } 97 #endif 98 99 static number ndFarey(number,number,const coeffs r) 100 100 { 101 101 Werror("farey not implemented for %s (c=%d)",r->cfCoeffString(r),getCoeffType(r)); 102 102 return NULL; 103 103 } 104 number ndChineseRemainder(number *,number *,int,BOOLEAN,const coeffs r)104 static number ndChineseRemainder(number *,number *,int,BOOLEAN,const coeffs r) 105 105 { 106 106 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); 108 108 } 109 109 110 110 static int ndParDeg(number n, const coeffs r) 111 111 { 112 return (- n_IsZero(n,r));112 return (-r->cfIsZero(n,r)); 113 113 } 114 114 … … 134 134 } 135 135 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) 136 static void ndNormalize(number&, const coeffs) { } 137 static number ndReturn0(number, const coeffs r) { return r->cfInit(0,r); } 138 static number ndGcd(number, number, const coeffs r) { return r->cfInit(1,r); } 139 static number ndIntMod(number, number, const coeffs r) { return r->cfInit(0,r); } 140 static number ndGetDenom(number &, const coeffs r) { return r->cfInit(1,r); } 141 static number ndGetNumerator(number &a,const coeffs r) { return r->cfCopy(a,r); } 142 static int ndSize(number a, const coeffs r) { return (int)r->cfIsZero(a,r)==FALSE; } 143 static char * ndCoeffName(const coeffs r) { return r->cfCoeffString(r); } 144 145 static void ndClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs r) 154 146 { 155 147 assume(r != NULL); … … 225 217 } 226 218 227 void ndClearDenominators(ICoeffsEnumerator& /*numberCollectionEnumerator*/, number& d, const coeffs r)219 static void ndClearDenominators(ICoeffsEnumerator& /*numberCollectionEnumerator*/, number& d, const coeffs r) 228 220 { 229 221 assume( r != NULL ); … … 234 226 } 235 227 236 number ndCopy(number a, const coeffs) { return a; }228 static number ndCopy(number a, const coeffs) { return a; } 237 229 number ndCopyMap(number a, const coeffs aRing, const coeffs r) 238 230 { … … 241 233 return a; 242 234 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 238 static void ndKillChar(coeffs) {} 239 static void ndSetChar(const coeffs) {} 240 241 number nd_Copy(number a, const coeffs r) { return r->cfCopy(a, r); } 249 242 250 243 #ifdef HAVE_RINGS 251 BOOLEAN ndDivBy(number, number, const coeffs) { return TRUE; } // assume a,b !=0252 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)244 static BOOLEAN ndDivBy(number, number, const coeffs) { return TRUE; } // assume a,b !=0 245 static int ndDivComp(number, number, const coeffs) { return 2; } 246 static BOOLEAN ndIsUnit(number a, const coeffs r) { return !r->cfIsZero(a,r); } 247 static number ndExtGcd (number, number, number *, number *, const coeffs r) { return r->cfInit(1,r); } 248 #endif 249 250 static CanonicalForm ndConvSingNFactoryN( number, BOOLEAN /*setChar*/, const coeffs) 258 251 { 259 252 CanonicalForm term(0); … … 262 255 } 263 256 264 number ndConvFactoryNSingN( const CanonicalForm, const coeffs)257 static number ndConvFactoryNSingN( const CanonicalForm, const coeffs) 265 258 { 266 259 Werror("no conversion from factory"); … … 271 264 /**< [out] the GMP equivalent */ 272 265 /// 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 *)266 static void ndMPZ(mpz_t result, number &n, const coeffs r) 267 { 268 mpz_init_set_si( result, r->cfInt(n, r) ); 269 } 270 271 static number ndInitMPZ(mpz_t m, const coeffs r) 272 { 273 return r->cfInit( mpz_get_si(m), r); 274 } 275 276 277 static BOOLEAN ndCoeffIsEqual(const coeffs r, n_coeffType n, void *) 285 278 { 286 279 /* test, if r is an instance of nInitCoeffs(n,parameter) */ … … 359 352 n->cfCoeffName = ndCoeffName; 360 353 361 //n->cfKillChar = ndKillChar; /* dummy */354 n->cfKillChar = ndKillChar; /* dummy */ 362 355 n->cfSetChar = ndSetChar; /* dummy */ 363 356 // temp. removed to catch all the coeffs which miss to implement this! … … 380 373 #endif 381 374 375 #ifdef LDEBUG 376 n->cfDBTest=ndDBTest; 377 #endif 378 382 379 n->convSingNFactoryN=ndConvSingNFactoryN; 383 380 n->convFactoryNSingN=ndConvFactoryNSingN; … … 461 458 assume(n->cfClearDenominators != NULL); 462 459 463 #ifdef LDEBUG464 if(n->cfDBTest==NULL)465 { n->cfDBTest=ndDBTest;Warn("cfDBTest is NULL for coeff %d",t); }466 #endif467 460 assume(n->type==t); 468 461 … … 475 468 476 469 if( n->nNULL == NULL ) 477 n->nNULL = n _Init(0, n); // may still remain NULL470 n->nNULL = n->cfInit(0, n); // may still remain NULL 478 471 } 479 472 else … … 486 479 void nKillChar(coeffs r) 487 480 { 481 STATISTIC(nKillChar); 488 482 if (r!=NULL) 489 483 { … … 499 493 n->next=n->next->next; 500 494 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); 503 497 omFreeSize((void *)r, sizeof(n_Procs_s)); 504 498 r=NULL; … … 553 547 { char* s = StringEndS(); Print("%s", s); omFree(s); } 554 548 } 549 550 551 number 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 556 CanonicalForm 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 50 50 51 51 /* 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); 56 56 number 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); 62 62 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); 65 65 66 void ndKillChar(coeffs);66 // void ndKillChar(coeffs); 67 67 68 number ndInit_bigint(number i, const coeffs dummy, const coeffs dst);68 // number ndInit_bigint(number i, const coeffs dummy, const coeffs dst); 69 69 70 BOOLEAN ndCoeffIsEqual(const coeffs r, n_coeffType n, void * parameter);70 // BOOLEAN ndCoeffIsEqual(const coeffs r, n_coeffType n, void * parameter); 71 71 72 72 /// Test whether a is a zero divisor in r … … 76 76 BOOLEAN n_IsZeroDivisor( number a, const coeffs r); 77 77 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" 78 const char* const nDivBy0 = "div by 0"; 84 79 85 80 // dummy routines 86 void ndNormalize(number& d, const coeffs); // nNormalize...81 // void ndNormalize(number& d, const coeffs); // nNormalize... 87 82 88 83 /// initialize an object of type coeff, return FALSE in case of success … … 91 86 92 87 /// 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); 94 89 95 90 /// 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); 97 92 98 93 #endif -
libpolys/coeffs/rintegers.cc
rcecb7e r638ecc 438 438 r->rep=n_rep_gmp; 439 439 440 r->nCoeffIsEqual = ndCoeffIsEqual;440 //r->nCoeffIsEqual = ndCoeffIsEqual; 441 441 r->cfCoeffString = nrzCoeffString; 442 r->cfKillChar = ndKillChar;442 //r->cfKillChar = ndKillChar; 443 443 r->cfMult = nrzMult; 444 444 r->cfSub = nrzSub; … … 1665 1665 r->rep=n_rep_gap_gmp; 1666 1666 1667 r->nCoeffIsEqual = ndCoeffIsEqual;1667 //r->nCoeffIsEqual = ndCoeffIsEqual; 1668 1668 r->cfCoeffString = nrzCoeffString; 1669 r->cfKillChar = ndKillChar;1669 //r->cfKillChar = ndKillChar; 1670 1670 r->cfMult = nrzMult; 1671 1671 r->cfSub = nrzSub; -
libpolys/coeffs/rmodulo2m.cc
rcecb7e r638ecc 107 107 r->rep=n_rep_int; 108 108 109 r->cfKillChar = ndKillChar; /* dummy*/109 //r->cfKillChar = ndKillChar; /* dummy*/ 110 110 r->nCoeffIsEqual = nr2mCoeffIsEqual; 111 111 r->cfCoeffString = nr2mCoeffString; … … 121 121 122 122 r->cfInit = nr2mInit; 123 r->cfCopy = ndCopy;123 //r->cfCopy = ndCopy; 124 124 r->cfInt = nr2mInt; 125 125 r->cfAdd = nr2mAdd; … … 144 144 r->cfPower = nr2mPower; 145 145 r->cfSetMap = nr2mSetMap; 146 r->cfNormalize = ndNormalize; 146 // r->cfNormalize = ndNormalize; // default 147 147 r->cfLcm = nr2mLcm; 148 148 r->cfGcd = nr2mGcd; -
libpolys/coeffs/rmodulon.cc
rcecb7e r638ecc 160 160 r->cfPower = nrnPower; 161 161 r->cfSetMap = nrnSetMap; 162 r->cfNormalize = ndNormalize;162 //r->cfNormalize = ndNormalize; 163 163 r->cfLcm = nrnLcm; 164 164 r->cfGcd = nrnGcd; -
libpolys/coeffs/shortfl.cc
rcecb7e r638ecc 709 709 n->rep=n_rep_float; 710 710 711 n->cfKillChar = ndKillChar; /* dummy */711 //n->cfKillChar = ndKillChar; /* dummy */ 712 712 n->ch = 0; 713 713 n->cfCoeffString = nrCoeffString; … … 722 722 n->cfInpNeg = nrNeg; 723 723 n->cfInvers= nrInvers; 724 n->cfCopy = ndCopy;724 //n->cfCopy = ndCopy; 725 725 n->cfGreater = nrGreater; 726 726 n->cfEqual = nrEqual; … … 738 738 /*nSize = ndSize;*/ 739 739 #ifdef LDEBUG 740 n->cfDBTest=ndDBTest; // not yet implemented: nrDBTest;740 //n->cfDBTest=ndDBTest; // not yet implemented: nrDBTest; 741 741 #endif 742 742 743 n->nCoeffIsEqual = ndCoeffIsEqual;743 //n->nCoeffIsEqual = ndCoeffIsEqual; 744 744 745 745 n->float_len = SHORT_REAL_LENGTH; -
libpolys/coeffs/test.cc
rcecb7e r638ecc 186 186 assume( r->cfAdd != NULL ); 187 187 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 238 190 bool ret = TestArith( r ); 239 191 -
libpolys/misc/auxiliary.h.in
rcecb7e r638ecc 62 62 #endif 63 63 64 65 #ifndef HAVE_NUMSTATS 66 // #define HAVE_NUMSTATS 67 #undef HAVE_NUMSTATS 68 #endif 64 69 // ---------------- end of parts/extensions 65 70 -
libpolys/polys/clapsing.cc
rcecb7e r638ecc 1630 1630 for(j=m->cols();j>0;j--) 1631 1631 { 1632 M(i,j)= cf->convSingNFactoryN(BIMATELEM(*m,i,j),setchar,cf);1632 M(i,j)=n_convSingNFactoryN(BIMATELEM(*m,i,j),setchar,cf); 1633 1633 setchar=FALSE; 1634 1634 } 1635 1635 } 1636 number res= cf->convFactoryNSingN( determinant(M,m->rows()),cf ) ;1636 number res=n_convFactoryNSingN( determinant(M,m->rows()),cf ) ; 1637 1637 return res; 1638 1638 } -
libpolys/polys/coeffrings.h
rcecb7e r638ecc 6 6 #include <polys/monomials/ring.h> 7 7 8 static inlinenumber n_Copy(number n, const ring r){ return n_Copy(n, r->cf); }9 static inlinevoid n_Delete(number* p, const ring r){ n_Delete(p, r->cf); }10 static inlineBOOLEAN 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 inlineint n_GetChar(const ring r){ return n_GetChar(r->cf); }8 static FORCE_INLINE number n_Copy(number n, const ring r){ return n_Copy(n, r->cf); } 9 static FORCE_INLINE void n_Delete(number* p, const ring r){ n_Delete(p, r->cf); } 10 static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const ring r){ return n_Equal(a, b, r->cf); } 11 static FORCE_INLINE nMapFunc n_SetMap(const ring src, const ring dst){ return n_SetMap(src->cf,dst->cf); } 12 static FORCE_INLINE int n_GetChar(const ring r){ return n_GetChar(r->cf); } 13 13 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); } 16 16 // #define n_Test(a,r) 17 17 18 18 19 19 20 static inlineBOOLEAN n_IsZero(number n, const ring r){ return n_IsZero(n,r->cf); }21 static inlineBOOLEAN n_IsOne(number n, const ring r){ return n_IsOne(n,r->cf); }22 static inlineBOOLEAN n_IsMOne(number n, const ring r){ return n_IsMOne(n,r->cf); }23 static inlineBOOLEAN n_GreaterZero(number n, const ring r){ return n_GreaterZero(n,r->cf); }24 static inlinenumber n_Init(int i, const ring r){ return n_Init(i,r->cf); }25 static inlinenumber n_InpNeg(number n, const ring r){ return n_InpNeg(n,r->cf); }26 static inlinenumber n_Invers(number a, const ring r){ return n_Invers(a,r->cf); }27 static inlineint n_Size(number n, const ring r){ return n_Size(n,r->cf); }28 static inlinevoid n_Normalize(number& n, const ring r){ return n_Normalize(n,r->cf); }29 static inlinevoid n_Write(number& n, const ring r){ return n_Write(n, r->cf, rShortOut(r)); }30 static inlinenumber n_GetDenom(number& n, const ring r){ return n_GetDenom(n, r->cf);}31 static inlinenumber n_GetNumerator(number& n, const ring r){ return n_GetNumerator(n, r->cf);}32 static inlinevoid n_Power(number a, int b, number *res, const ring r){ n_Power(a,b,res,r->cf); }33 static inlinenumber n_Mult(number a, number b, const ring r){ return n_Mult(a, b, r->cf);}34 static inlinevoid n_InpMult(number &a, number b, const ring r){ n_InpMult(a,b,r->cf); }35 static inlinenumber n_Sub(number a, number b, const ring r){ return n_Sub(a, b, r->cf);}36 static inlinenumber n_Add(number a, number b, const ring r){ return n_Add(a, b, r->cf);}37 static inlinenumber n_Div(number a, number b, const ring r){ return n_Div(a,b, r->cf);}38 static inlinenumber n_ExactDiv(number a, number b, const ring r){ return n_ExactDiv(a,b, r->cf);}39 static inlinenumber n_Gcd(number a, number b, const ring r){ return n_Gcd(a,b, r->cf);}20 static FORCE_INLINE BOOLEAN n_IsZero(number n, const ring r){ return n_IsZero(n,r->cf); } 21 static FORCE_INLINE BOOLEAN n_IsOne(number n, const ring r){ return n_IsOne(n,r->cf); } 22 static FORCE_INLINE BOOLEAN n_IsMOne(number n, const ring r){ return n_IsMOne(n,r->cf); } 23 static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const ring r){ return n_GreaterZero(n,r->cf); } 24 static FORCE_INLINE number n_Init(int i, const ring r){ return n_Init(i,r->cf); } 25 static FORCE_INLINE number n_InpNeg(number n, const ring r){ return n_InpNeg(n,r->cf); } 26 static FORCE_INLINE number n_Invers(number a, const ring r){ return n_Invers(a,r->cf); } 27 static FORCE_INLINE int n_Size(number n, const ring r){ return n_Size(n,r->cf); } 28 static FORCE_INLINE void n_Normalize(number& n, const ring r){ return n_Normalize(n,r->cf); } 29 static FORCE_INLINE void n_Write(number& n, const ring r){ return n_Write(n, r->cf, rShortOut(r)); } 30 static FORCE_INLINE number n_GetDenom(number& n, const ring r){ return n_GetDenom(n, r->cf);} 31 static FORCE_INLINE number n_GetNumerator(number& n, const ring r){ return n_GetNumerator(n, r->cf);} 32 static FORCE_INLINE void n_Power(number a, int b, number *res, const ring r){ n_Power(a,b,res,r->cf); } 33 static FORCE_INLINE number n_Mult(number a, number b, const ring r){ return n_Mult(a, b, r->cf);} 34 static FORCE_INLINE void n_InpMult(number &a, number b, const ring r){ n_InpMult(a,b,r->cf); } 35 static FORCE_INLINE number n_Sub(number a, number b, const ring r){ return n_Sub(a, b, r->cf);} 36 static FORCE_INLINE number n_Add(number a, number b, const ring r){ return n_Add(a, b, r->cf);} 37 static FORCE_INLINE number n_Div(number a, number b, const ring r){ return n_Div(a,b, r->cf);} 38 static FORCE_INLINE number n_ExactDiv(number a, number b, const ring r){ return n_ExactDiv(a,b, r->cf);} 39 static FORCE_INLINE number n_Gcd(number a, number b, const ring r){ return n_Gcd(a,b, r->cf);} 40 40 41 41 #ifdef HAVE_RINGS 42 static inlineBOOLEAN n_IsUnit(number n, const ring r){ return n_IsUnit(n, r->cf);}43 static inlinenumber n_GetUnit(number n, const ring r){ return n_GetUnit(n, r->cf);}44 static inlineBOOLEAN n_DivBy(number a, number b, const ring r){ return n_DivBy(a,b, r->cf);}42 static FORCE_INLINE BOOLEAN n_IsUnit(number n, const ring r){ return n_IsUnit(n, r->cf);} 43 static FORCE_INLINE number n_GetUnit(number n, const ring r){ return n_GetUnit(n, r->cf);} 44 static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const ring r){ return n_DivBy(a,b, r->cf);} 45 45 #endif 46 46 47 static inlineint n_ParDeg(number n, const ring r){ assume(r != NULL); assume(r->cf != NULL); return n_ParDeg(n,r->cf); }47 static FORCE_INLINE int n_ParDeg(number n, const ring r){ assume(r != NULL); assume(r->cf != NULL); return n_ParDeg(n,r->cf); } 48 48 49 49 #endif /* COEFFRINGS_H */ -
libpolys/polys/monomials/p_polys.cc
rcecb7e r638ecc 1361 1361 int i,j; 1362 1362 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); 1364 1364 if (s==st) 1365 1365 /* i.e. it does not start with a coeff: test if it is a ringvar*/ … … 2765 2765 while (p!=NULL) 2766 2766 { 2767 /* should be: 2767 /* should be: // NOTE: don't use ->coef!!!! 2768 2768 * number hh; 2769 2769 * nGetDenom(p->coef,&hh); … … 2906 2906 while (p!=NULL) 2907 2907 { 2908 /* should be: 2908 /* should be: // NOTE: don't use ->coef!!!! 2909 2909 * number hh; 2910 2910 * nGetDenom(p->coef,&hh); … … 2941 2941 while (p!=NULL) 2942 2942 { 2943 /* should be: 2943 /* should be: // NOTE: don't use ->coef!!!! 2944 2944 * number hh; 2945 2945 * nGetDenom(p->coef,&hh); -
libpolys/polys/monomials/ring.cc
rcecb7e r638ecc 617 617 /// TODO: make it a virtual method of coeffs, together with: 618 618 /// Decompose & Compose, rParameter & rPar 619 char * rCharStr(ring r) 620 { return r->cf->cfCoeffString(r->cf); } 619 char * rCharStr(const ring r){ assume( r != NULL ); return nCoeffString(r->cf); } 621 620 622 621 char * rParStr(ring r) -
libpolys/polys/pDebug.cc
rcecb7e r638ecc 249 249 // number/coef check 250 250 _pPolyAssumeReturnMsg(p->coef != NULL || (n_GetChar(r->cf) >= 2), "NULL coef",p,r); 251 251 252 #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); 253 254 #endif 254 255 _pPolyAssumeReturnMsg(!n_IsZero(p->coef, r->cf), "Zero coef",p,r); -
libpolys/polys/templates/p_Numbers.h
rcecb7e r638ecc 11 11 #define P_NUMBERS_H 12 12 13 #include <misc/auxiliary.h> 13 14 #include <coeffs/coeffs.h> 14 15 #include <coeffs/numbers.h> 15 16 #include <polys/monomials/ring.h> 16 17 17 static inlinenumber n_Copy_FieldGeneral(number n, const ring r)18 { return r->cf->cfCopy(n,r->cf); }18 static FORCE_INLINE number n_Copy_FieldGeneral(number n, const ring r) 19 { return n_Copy(n,r->cf); } 19 20 20 static inlinevoid n_Delete_FieldGeneral(number* p, const ring r)21 { r->cf->cfDelete(p,r->cf); }21 static FORCE_INLINE void n_Delete_FieldGeneral(number* p, const ring r) 22 { n_Delete(p,r->cf); } 22 23 23 static inlinenumber n_Mult_FieldGeneral(number n1, number n2, const ring r)24 { return r->cf->cfMult(n1, n2, r->cf); }24 static FORCE_INLINE number n_Mult_FieldGeneral(number n1, number n2, const ring r) 25 { return n_Mult(n1, n2, r->cf); } 25 26 26 static inlinenumber n_Add_FieldGeneral(number n1, number n2, const ring r)27 { return r->cf->cfAdd(n1, n2, r->cf); }27 static FORCE_INLINE number n_Add_FieldGeneral(number n1, number n2, const ring r) 28 { return n_Add(n1, n2, r->cf); } 28 29 29 static inlineBOOLEAN n_IsZero_FieldGeneral(number n, const ring r)30 { return r->cf->cfIsZero(n, r->cf); }30 static FORCE_INLINE BOOLEAN n_IsZero_FieldGeneral(number n, const ring r) 31 { return n_IsZero(n, r->cf); } 31 32 32 static inlineBOOLEAN n_Equal_FieldGeneral(number n1, number n2, const ring r)33 { return r->cf->cfEqual(n1, n2, r->cf); }33 static FORCE_INLINE BOOLEAN n_Equal_FieldGeneral(number n1, number n2, const ring r) 34 { return n_Equal(n1, n2, r->cf); } 34 35 35 static inlinenumber n_Neg_FieldGeneral(number n, const ring r)36 { return r->cf->cfInpNeg(n, r->cf); }36 static FORCE_INLINE number n_Neg_FieldGeneral(number n, const ring r) 37 { return n_InpNeg(n, r->cf); } 37 38 38 static inlinenumber n_Sub_FieldGeneral(number n1, number n2, const ring r)39 { return r->cf->cfSub(n1, n2, r->cf); }39 static FORCE_INLINE number n_Sub_FieldGeneral(number n1, number n2, const ring r) 40 { return n_Sub(n1, n2, r->cf); } 40 41 41 static inlinevoid n_InpMult_FieldGeneral(number &n1, number n2, const ring r)42 { n dInpMult(n1, n2, r->cf); }42 static FORCE_INLINE void n_InpMult_FieldGeneral(number &n1, number n2, const ring r) 43 { n_InpMult(n1, n2, r->cf); } 43 44 44 static inlinevoid n_InpAdd_FieldGeneral(number &n1, number n2, const ring r)45 static FORCE_INLINE void n_InpAdd_FieldGeneral(number &n1, number n2, const ring r) 45 46 { n_InpAdd(n1, n2, r->cf); } 46 47 47 48 #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 60 static 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); } 60 62 #endif 61 63 62 64 #include <coeffs/modulop.h> 65 63 66 #define n_Copy_FieldZp(n, r) n 64 67 #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)72 68 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); }69 static FORCE_INLINE number n_Mult_FieldZp(number n1, number n2, const ring r) 70 { STATISTIC(n_Mult); return npMultM(n1, n2, r->cf); } 75 71 76 #define DO_LINLINE 77 #include <coeffs/longrat.cc> // TODO: fix this Uglyness?!!! 72 static 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; 78 79 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 } 88 81 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); } 82 static 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 91 static FORCE_INLINE BOOLEAN n_IsZero_FieldZp(number n, const ring r) 92 { STATISTIC(n_IsZero); return npIsZeroM(n, r->cf); } 93 94 static FORCE_INLINE BOOLEAN n_Equal_FieldZp(number n1, number n2, const ring r) 95 { STATISTIC(n_Equal); return npEqualM(n1, n2, r->cf); } 96 97 static FORCE_INLINE number n_Neg_FieldZp(number n, const ring r) 98 { STATISTIC(n_InpNeg); return npNegM(n, r->cf); } 99 100 static FORCE_INLINE void n_InpMult_FieldZp(number &n1, number n2, const ring r) 101 { STATISTIC(n_InpMult); n1=npMultM(n1, n2, r->cf); } 102 103 static 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); 91 110 #endif 111 } 112 113 #define DO_LFORCE_INLINE 114 #include <coeffs/longrat.cc> // for inlining... TODO: fix this Uglyness?!!! 115 116 static FORCE_INLINE number n_Copy_FieldQ(number n, const ring r) 117 { STATISTIC(n_Copy); return nlCopy(n, r->cf); } 118 119 static FORCE_INLINE void n_Delete_FieldQ(number* n, const ring r) 120 { STATISTIC(n_Delete); nlDelete(n,r->cf); } 121 122 static FORCE_INLINE number n_Mult_FieldQ(number n1, number n2, const ring r) 123 { STATISTIC(n_Mult); return nlMult(n1,n2, r->cf); } 124 125 static 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 136 static 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 147 static FORCE_INLINE BOOLEAN n_IsZero_FieldQ(number n, const ring r) 148 { STATISTIC(n_IsZero); return nlIsZero(n, r->cf); } 149 150 static FORCE_INLINE BOOLEAN n_Equal_FieldQ(number n1, number n2, const ring r) 151 { STATISTIC(n_Equal); return nlEqual(n1, n2, r->cf); } 152 153 static FORCE_INLINE number n_Neg_FieldQ(number n, const ring r) 154 { STATISTIC(n_InpNeg); return nlNeg(n, r->cf); } 155 156 static FORCE_INLINE void n_InpMult_FieldQ(number &n1, number n2, const ring r) 157 { STATISTIC(n_InpMult); nlInpMult(n1, n2, r->cf); } 158 159 static 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 45 45 s = n_Init(N , r); 46 46 i = n_Init(N+1, r); 47 n dInpMult(s, i, r);47 n_InpMult(s, i, r); 48 48 n_Delete(&i, r); 49 49 … … 87 87 { 88 88 i = n_Init(k, r); 89 n dInpAdd(s, i, r); // s += i89 n_InpAdd(s, i, r); // s += i 90 90 91 91 i = n_InpNeg(i, r); 92 n dInpAdd(ss, i, r); // ss -= i92 n_InpAdd(ss, i, r); // ss -= i 93 93 94 94 n_Delete(&i, r); … … 121 121 122 122 number t = n_Init(1, r); 123 n dInpAdd(t, t, r);123 n_InpAdd(t, t, r); 124 124 TS_ASSERT( n_Equal(two, t, r) ); 125 125 n_Delete(&t, r); … … 128 128 { 129 129 number t = n_Init(1, r); 130 n lInpAdd(t, t, r);130 n_InpAdd(t, t, r); 131 131 TS_ASSERT( n_Equal(two, t, r) ); 132 132 n_Delete(&t, r); -
libpolys/tests/polys_test.h
rcecb7e r638ecc 1678 1678 1679 1679 number t = n_Init(1, r); 1680 n dInpAdd(t, t, r);1680 n_InpAdd(t, t, r); 1681 1681 TS_ASSERT( n_Equal(two, t, r) ); 1682 1682 n_Delete(&t, r); … … 1685 1685 { 1686 1686 number t = n_Init(1, r); 1687 n lInpAdd(t, t, r);1687 n_InpAdd(t, t, r); 1688 1688 TS_ASSERT( n_Equal(two, t, r) ); 1689 1689 n_Delete(&t, r); … … 1772 1772 s = n_Init(N , r); 1773 1773 i = n_Init(N+1, r); 1774 n dInpMult(s, i, r);1774 n_InpMult(s, i, r); 1775 1775 n_Delete(&i, r); 1776 1776 … … 1814 1814 { 1815 1815 i = n_Init(k, r); 1816 n dInpAdd(s, i, r); // s += i1816 n_InpAdd(s, i, r); // s += i 1817 1817 1818 1818 i = n_InpNeg(i, r); 1819 n dInpAdd(ss, i, r); // ss -= i1819 n_InpAdd(ss, i, r); // ss -= i 1820 1820 1821 1821 n_Delete(&i, r);
Note: See TracChangeset
for help on using the changeset viewer.