Changeset f2ba60d in git
- Timestamp:
- Nov 27, 2014, 2:33:50 PM (9 years ago)
- Branches:
- (u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
- Children:
- acccd24f08e9ec59e6ae03983de207fa7c337644
- Parents:
- 635bddeea45a8e0e67969f7f60711ac84aba26d04d2a3539c40e545a3b264f0885793cdf5294ba00
- Files:
-
- 7 added
- 50 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/general.lib
r635bdd rf2ba60d 975 975 example 976 976 { "EXAMPLE:"; echo=2; 977 ring r=0,(x,y,z),dp; 978 poly f=x^30+y^30; 979 watchdog(1,"factorize(eval("+string(f)+"))"); 980 watchdog(100,"factorize(eval("+string(f)+"))"); 977 watchdog(1,"system(\"sh\",\"sleep 5\")"); 978 watchdog(10,"system(\"sh\",\"sleep 5\")"); 981 979 } 982 980 /////////////////////////////////////////////////////////////////////////////// -
Singular/LIB/modwalk.lib
-
Property
mode
changed from
100644
to100755
r4d2a353 rf2ba60d 16 16 17 17 PROCEDURES: 18 modpWalk(ideal,int,int,int[,int,int,int,int]) standard basis conversion of I in prime characteristic 18 19 modWalk(ideal,int,int[,int,int,int,int]); standard basis conversion of I using modular methods (chinese remainder) 19 20 "; … … 29 30 //////////////////////////////////////////////////////////////////////////////// 30 31 31 staticproc modpWalk(def II, int p, int variant, list #)32 proc modpWalk(def II, int p, int variant, list #) 32 33 "USAGE: modpWalk(I,p,#); I ideal, p integer, variant integer 33 34 ASSUME: If size(#) > 0, then … … 80 81 } 81 82 } 82 83 //------------------------- make i homogeneous -----------------------------84 if(!mixedTest() && !h)85 {86 if(!((find(ordstr_R0, "M") > 0) || (find(ordstr_R0, "a") > 0) || neg))87 {88 if(!((order == "simple") || (sizerl > 4)))89 {90 list rl@r = ringlist(@r);91 nvar@r = nvars(@r);92 intvec w;93 for(k = 1; k <= nvar@r; k++)94 {95 w[k] = deg(var(k));96 }97 w[nvar@r + 1] = 1;98 rl@r[2][nvar@r + 1] = "homvar";99 rl@r[3][2][2] = w;100 def HomR = ring(rl@r);101 setring HomR;102 ideal i = imap(@r, i);103 i = homog(i, homvar);104 }105 }106 }107 108 83 //------------------------- compute a standard basis mod p ----------------------------- 109 110 84 if(variant == 1) 111 85 { … … 113 87 { 114 88 i = rwalk(i,radius,pert_deg,#); 115 // rwalk(i,radius,pert_deg,#); std(i);116 89 } 117 90 else … … 175 148 } 176 149 } 177 178 if(!mixedTest() && !h) 179 { 180 if(!((find(ordstr_R0, "M") > 0) || (find(ordstr_R0, "a") > 0) || neg)) 181 { 182 if(!((order == "simple") || (sizerl > 4))) 183 { 184 i = subst(i, homvar, 1); 185 i = simplify(i, 34); 186 setring @r; 187 i = imap(HomR, i); 188 i = interred(i); 189 kill HomR; 190 } 191 } 192 } 150 193 151 setring R0; 194 152 return(list(fetch(@r,i),p)); … … 487 445 if(n2 > 4) 488 446 { 489 //L[5] = prime(random(an,en));447 L[5] = prime(random(an,en)); 490 448 } 491 449 if(printlevel >= 10) … … 528 486 //------------------- Now all leading ideals are the same -------------------- 529 487 //------------------- Lift results to basering via farey --------------------- 530 531 488 tt = timer; rt = rtimer; 532 489 N = T2[1]; … … 545 502 546 503 //---------------- Test if we already have a standard basis of I -------------- 547 548 504 tt = timer; rt = rtimer; 549 pTest = pTestSB(I,J,L,variant); 550 //pTest = primeTestSB(I,J,L,variant); 505 pTest = primeTest(J, prime(random(1000000000,2134567879))); 551 506 if(printlevel >= 10) 552 507 { … … 596 551 } 597 552 //-------------- We do not already have a standard basis of I, therefore do the main computation for more primes -------------- 598 599 553 T1 = H; 600 554 T2 = N; … … 613 567 for(i=j; i<=size(L); i++) 614 568 { 615 //Arguments[i-j+1] = list(II,L[i],variant,list(curr_weight,target_weight));616 569 Arguments[size(Arguments)+1] = list(II,L[i],variant,list(curr_weight,target_weight)); 617 570 } … … 621 574 for(i=j; i<=size(L); i++) 622 575 { 623 //Arguments[i-j+1] = list(II,L[i],variant);624 576 Arguments[size(Arguments)+1] = list(II,L[i],variant); 625 577 } … … 632 584 for(i=1; i<=size(PP); i++) 633 585 { 634 //P[size(P) + 1] = PP[i];635 586 T1[size(T1) + 1] = PP[i][1]; 636 587 T2[size(T2) + 1] = bigint(PP[i][2]); … … 649 600 echo = 2; 650 601 ring R=0,(x,y,z),lp; 651 ideal I=-x+y2z-z,xz+1,x2+y2-1; 652 // I is a standard basis in dp 653 ideal J = modWalk(I,1); 602 ideal I= y3+xyz+y2z+xz3, 3+xy+x2y+y2z; 603 ideal J = modWalk(I,2); 654 604 J; 655 605 } … … 772 722 return(J); 773 723 } 774 ////////////////////////////////////////////////////////////////////////////////// 775 static proc primeTestSB(def II, ideal J, list L, int variant, list #) 776 "USAGE: primeTestSB(I,J,L,variant,#); I,J ideals, L intvec of primes, variant int 777 RETURN: 1 (resp. 0) if for a randomly chosen prime p that is not in L 778 J mod p is (resp. is not) a standard basis of I mod p 779 EXAMPLE: example primeTestSB; shows an example 780 " 781 { 782 if(typeof(II) == "ideal") 783 { 784 ideal I = II; 785 int radius = 2; 786 } 787 if(typeof(II) == "list") 788 { 789 ideal I = II[1]; 790 int radius = II[2]; 791 } 792 793 int i,j,k,p; 794 def R = basering; 795 list r = ringlist(R); 796 797 while(!j) 798 { 799 j = 1; 800 p = prime(random(1000000000,2134567879)); 801 for(i = 1; i <= size(L); i++) 802 { 803 if(p == L[i]) 804 { 805 j = 0; 806 break; 807 } 808 } 809 if(j) 810 { 811 for(i = 1; i <= ncols(I); i++) 812 { 813 for(k = 2; k <= size(I[i]); k++) 814 { 815 if((denominator(leadcoef(I[i][k])) mod p) == 0) 816 { 817 j = 0; 818 break; 819 } 820 } 821 if(!j) 822 { 823 break; 824 } 825 } 826 } 827 if(j) 828 { 829 if(!primeTest(I,p)) 830 { 831 j = 0; 832 } 833 } 834 } 835 r[1] = p; 836 def @R = ring(r); 837 setring @R; 838 ideal I = imap(R,I); 839 ideal J = imap(R,J); 840 attrib(J,"isSB",1); 841 842 int t = timer; 843 j = 1; 844 if(isIncluded(I,J) == 0) 845 { 846 j = 0; 847 } 848 if(printlevel >= 11) 849 { 850 "isIncluded(I,J) takes "+string(timer - t)+" seconds"; 851 "j = "+string(j); 852 } 853 t = timer; 854 if(j) 855 { 856 if(size(#) > 0) 857 { 858 ideal K = modpWalk(I,p,variant,#)[1]; 859 } 860 else 861 { 862 ideal K = modpWalk(I,p,variant)[1]; 863 } 864 t = timer; 865 if(isIncluded(J,K) == 0) 866 { 867 j = 0; 868 } 869 if(printlevel >= 11) 870 { 871 "isIncluded(K,J) takes "+string(timer - t)+" seconds"; 872 "j = "+string(j); 873 } 874 } 875 setring R; 876 877 return(j); 878 } 879 example 880 { "EXAMPLE:"; echo = 2; 881 intvec L = 2,3,5; 882 ring r = 0,(x,y,z),lp; 883 ideal I = x+1,x+y+1; 884 ideal J = x+1,y; 885 primeTestSB(I,I,L,1); 886 primeTestSB(I,J,L,1); 887 } 888 889 //////////////////////////////////////////////////////////////////////////////// 890 static proc pTestSB(ideal I, ideal J, list L, int variant, list #) 891 "USAGE: pTestSB(I,J,L,variant,#); I,J ideals, L intvec of primes, variant int 892 RETURN: 1 (resp. 0) if for a randomly chosen prime p that is not in L 893 J mod p is (resp. is not) a standard basis of I mod p 894 EXAMPLE: example pTestSB; shows an example 895 " 896 { 897 int i,j,k,p; 898 def R = basering; 899 list r = ringlist(R); 900 901 while(!j) 902 { 903 j = 1; 904 p = prime(random(1000000000,2134567879)); 905 for(i = 1; i <= size(L); i++) 906 { 907 if(p == L[i]) { j = 0; break; } 908 } 909 if(j) 910 { 911 for(i = 1; i <= ncols(I); i++) 912 { 913 for(k = 2; k <= size(I[i]); k++) 914 { 915 if((denominator(leadcoef(I[i][k])) mod p) == 0) { j = 0; break; } 916 } 917 if(!j){ break; } 918 } 919 } 920 if(j) 921 { 922 if(!primeTest(I,p)) { j = 0; } 923 } 924 } 925 r[1] = p; 926 def @R = ring(r); 927 setring @R; 928 ideal I = imap(R,I); 929 ideal J = imap(R,J); 930 attrib(J,"isSB",1); 931 932 int t = timer; 933 j = 1; 934 if(isIncluded(I,J) == 0) { j = 0; } 935 936 if(printlevel >= 11) 937 { 938 "isIncluded(I,J) takes "+string(timer - t)+" seconds"; 939 "j = "+string(j); 940 } 941 942 t = timer; 943 if(j) 944 { 945 if(size(#) > 0) 946 { 947 ideal K = modpStd(I,p,variant,#[1])[1]; 948 } 949 else 950 { 951 ideal K = groebner(I); 952 } 953 t = timer; 954 if(isIncluded(J,K) == 0) { j = 0; } 955 956 if(printlevel >= 11) 957 { 958 "isIncluded(J,K) takes "+string(timer - t)+" seconds"; 959 "j = "+string(j); 960 } 961 } 962 setring R; 963 return(j); 964 } 965 example 966 { "EXAMPLE:"; echo = 2; 967 intvec L = 2,3,5; 968 ring r = 0,(x,y,z),dp; 969 ideal I = x+1,x+y+1; 970 ideal J = x+1,y; 971 pTestSB(I,I,L,2); 972 pTestSB(I,J,L,2); 973 } 724 974 725 //////////////////////////////////////////////////////////////////////////////// 975 726 static proc mixedTest() -
Property
mode
changed from
-
Singular/LIB/rwalk.lib
-
Property
mode
changed from
100644
to100755
-
Property
mode
changed from
-
Singular/LIB/schreyer.lib
r635bdd rf2ba60d 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/LIB/swalk.lib
-
Property
mode
changed from
100644
to100755
-
Property
mode
changed from
-
Singular/calcSVD.cc
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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/extra.cc
r4d2a353 rf2ba60d 1954 1954 if (strcmp(sys_cmd, "Mfrwalk") == 0) 1955 1955 { 1956 const short t[]={ 6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,RING_CMD};1956 const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD}; 1957 1957 if (!iiCheckTypes(h,t,1)) return TRUE; 1958 1958 if (((intvec*) h->next->Data())->length() != currRing->N && -
Singular/gentable.cc
r635bdd rf2ba60d 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
r635bdd rf2ba60d 108 108 #include <polys/nc/nc.h> 109 109 #include <polys/nc/sca.h> 110 #define ALLOW_PLURAL 1111 #define NO_PLURAL 0112 #define COMM_PLURAL 2113 110 #define PLURAL_MASK 3 114 111 #else /* HAVE_PLURAL */ 115 #define ALLOW_PLURAL 0116 #define NO_PLURAL 0117 #define COMM_PLURAL 0118 112 #define PLURAL_MASK 0 119 113 #endif /* HAVE_PLURAL */ … … 126 120 #define ZERODIVISOR_MASK 0 127 121 #endif 122 #define ALLOW_PLURAL 1 123 #define NO_PLURAL 0 124 #define COMM_PLURAL 2 128 125 #define ALLOW_RING 4 129 126 #define NO_RING 0 … … 754 751 v->name = omStrDup(v->name); 755 752 } 753 else if (v->rtyp!=0) 754 { 755 WerrorS("reserved name with ::"); 756 return TRUE; 757 } 756 758 v->req_packhdl=IDPACKAGE(packhdl); 757 759 syMake(v, v->name, packhdl); … … 1803 1805 if (nMap==NULL) 1804 1806 { 1805 Werror("not implemented: map bigint -> %s", cf->cfCoeffString(cf));1807 Werror("not implemented: map bigint -> %s", nCoeffString(cf)); 1806 1808 return TRUE; 1807 1809 } … … 2342 2344 err_fetch: 2343 2345 Werror("no identity map from %s (%s -> %s)",u->Fullname(), 2344 r->cf->cfCoeffString(r->cf),2345 currRing->cf->cfCoeffString(currRing->cf));2346 nCoeffString(r->cf), 2347 nCoeffString(currRing->cf)); 2346 2348 return TRUE; 2347 2349 } … … 3753 3755 else 3754 3756 { 3755 Werror("cannot convert bigint to cring %s", currRing->cf->cfCoeffString(currRing->cf));3757 Werror("cannot convert bigint to cring %s", nCoeffString(currRing->cf)); 3756 3758 bo=TRUE; 3757 3759 } … … 6271 6273 if ((cf!=NULL) && (cf->cfRandom!=NULL)) 6272 6274 { 6273 number n= cf->cfRandom(siRand,(number)v->Data(),(number)w->Data(),cf);6275 number n= n_Random(siRand,(number)v->Data(),(number)w->Data(),cf); 6274 6276 number2 nn=(number2)omAlloc(sizeof(*nn)); 6275 6277 nn->cf=cf; … … 7792 7794 if (check_valid(dA2[i].valid_for,op)) break; 7793 7795 } 7796 else 7797 { 7798 if (RingDependend(dA2[i].res)) 7799 { 7800 WerrorS("no ring active"); 7801 break; 7802 } 7803 } 7794 7804 if (traceit&TRACE_CALL) 7795 7805 Print("call %s(%s,%s)\n",iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt)); … … 7825 7835 { 7826 7836 if (check_valid(dA2[i].valid_for,op)) break; 7837 } 7838 else 7839 { 7840 if (RingDependend(dA2[i].res)) 7841 { 7842 WerrorS("no ring active"); 7843 break; 7844 } 7827 7845 } 7828 7846 if (traceit&TRACE_CALL) … … 8003 8021 if (check_valid(dA1[i].valid_for,op)) break; 8004 8022 } 8023 else 8024 { 8025 if (RingDependend(dA1[i].res)) 8026 { 8027 WerrorS("no ring active"); 8028 break; 8029 } 8030 } 8005 8031 if (traceit&TRACE_CALL) 8006 8032 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at)); … … 8035 8061 { 8036 8062 if (check_valid(dA1[i].valid_for,op)) break; 8063 } 8064 else 8065 { 8066 if (RingDependend(dA1[i].res)) 8067 { 8068 WerrorS("no ring active"); 8069 break; 8070 } 8037 8071 } 8038 8072 if (traceit&TRACE_CALL) -
Singular/ipconv.cc
r635bdd rf2ba60d 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/ipid.cc
r635bdd rf2ba60d 57 57 58 58 proclevel *procstack=NULL; 59 #define TEST60 59 //idhdl idroot = NULL; 61 60 -
Singular/ipprint.cc
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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) -
Singular/walk.cc
-
Property
mode
changed from
100644
to100755
r4d2a353 rf2ba60d 562 562 } 563 563 564 /***************************************************************************** 565 * compute the gcd of the entries of the vectors curr_weight and diff_weight * 566 *****************************************************************************/ 567 static int simplify_gcd(intvec* curr_weight, intvec* diff_weight) 568 { 569 int j; 570 int nRing = currRing->N; 571 int gcd_tmp = (*curr_weight)[0]; 572 for (j=1; j<nRing; j++) 573 { 574 gcd_tmp = gcd(gcd_tmp, (*curr_weight)[j]); 575 if(gcd_tmp == 1) 576 { 577 break; 578 } 579 } 580 if(gcd_tmp != 1) 581 { 582 for (j=0; j<nRing; j++) 583 { 584 gcd_tmp = gcd(gcd_tmp, (*diff_weight)[j]); 585 if(gcd_tmp == 1) 586 { 587 break; 588 } 589 } 590 } 591 return gcd_tmp; 592 } 593 564 594 /********************************************* 565 595 * cancel gcd of integers zaehler and nenner * … … 1861 1891 } 1862 1892 1893 1894 /************************************************************** 1895 * Look for the position of the smallest absolut value in vec * 1896 **************************************************************/ 1897 static int MivAbsMaxArg(intvec* vec) 1898 { 1899 int k = MivAbsMax(vec); 1900 int i=0; 1901 while(1) 1902 { 1903 if((*vec)[i] == k || (*vec)[i] == -k) 1904 { 1905 break; 1906 } 1907 i++; 1908 } 1909 return i; 1910 } 1911 1912 1863 1913 /********************************************************************** 1864 1914 * Compute a next weight vector between curr_weight and target_weight * … … 1875 1925 1876 1926 int nRing = currRing->N; 1877 int checkRed, j, kkk,nG = IDELEMS(G);1927 int checkRed, j, nG = IDELEMS(G); 1878 1928 intvec* ivtemp; 1879 1929 … … 1913 1963 mpz_init(dcw); 1914 1964 1915 //int tn0, tn1, tz1, ncmp, gcd_tmp, ntmp;1916 1965 int gcd_tmp; 1917 1966 intvec* diff_weight = MivSub(target_weight, curr_weight); … … 1919 1968 intvec* diff_weight1 = MivSub(target_weight, curr_weight); 1920 1969 poly g; 1921 //poly g, gw; 1970 1922 1971 for (j=0; j<nG; j++) 1923 1972 { … … 1981 2030 } 1982 2031 } 1983 //Print("\n// Alloc Size = %d \n", nRing*sizeof(mpz_t));2032 //Print("\n// Alloc Size = %d \n", nRing*sizeof(mpz_t)); 1984 2033 mpz_t *vec=(mpz_t*)omAlloc(nRing*sizeof(mpz_t)); 1985 2034 1986 2035 1987 // there is no 0<t<1 and define the next weight vector that is equal to the current weight vector 2036 // there is no 0<t<1 and define the next weight vector that is equal 2037 // to the current weight vector 1988 2038 if(mpz_cmp(t_nenner, t_null) == 0) 1989 2039 { … … 2056 2106 #endif 2057 2107 2058 // BOOLEAN isdwpos; 2059 2060 // construct a new weight vector 2108 // construct a new weight vector and check whether vec[j] is overflow, 2109 // i.e. vec[j] > 2^31. 2110 // If vec[j] doesn't overflow, define a weight vector. Otherwise, 2111 // report that overflow appears. In the second case, test whether the 2112 // the correctness of the new vector plays an important role 2113 2061 2114 for (j=0; j<nRing; j++) 2062 2115 { … … 2102 2155 } 2103 2156 } 2104 2157 // reduce the vector with the gcd 2158 if(mpz_cmp_si(ggt,1) != 0) 2159 { 2160 for (j=0; j<nRing; j++) 2161 { 2162 mpz_divexact(vec[j], vec[j], ggt); 2163 } 2164 } 2105 2165 #ifdef NEXT_VECTORS_CC 2106 2166 PrintS("\n// gcd of elements of the vector: "); … … 2108 2168 #endif 2109 2169 2110 /**********************************************************************2111 * construct a new weight vector and check whether vec[j] is overflow, *2112 * i.e. vec[j] > 2^31. *2113 * If vec[j] doesn't overflow, define a weight vector. Otherwise, *2114 * report that overflow appears. In the second case, test whether the *2115 * the correctness of the new vector plays an important role *2116 **********************************************************************/2117 kkk=0;2118 2170 for(j=0; j<nRing; j++) 2119 2171 { … … 2131 2183 2132 2184 REDUCTION: 2185 checkRed = 1; 2133 2186 for (j=0; j<nRing; j++) 2134 2187 { 2135 (*diff_weight)[j] = mpz_get_si(vec[j]); 2136 } 2137 while(MivAbsMax(diff_weight) >= 5) 2138 { 2139 for (j=0; j<nRing; j++) 2140 { 2141 if(mpz_cmp_si(ggt,1)==0) 2142 { 2143 (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5); 2144 // Print("\n// vector[%d] = %d \n",j+1, (*diff_weight1)[j]); 2145 } 2146 else 2147 { 2148 mpz_divexact(vec[j], vec[j], ggt); 2149 (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5); 2150 // Print("\n// vector[%d] = %d \n",j+1, (*diff_weight1)[j]); 2151 } 2152 /* 2153 if((*diff_weight1)[j] == 0) 2154 { 2155 kkk = kkk + 1; 2156 } 2157 */ 2158 } 2159 2160 2161 /* 2162 if(kkk > nRing - 1) 2163 { 2164 // diff_weight was reduced to zero 2165 // Print("\n // MwalkNextWeightCC: geaenderter Vector gleich Null! \n"); 2166 goto TEST_OVERFLOW; 2167 } 2168 */ 2169 2170 if(test_w_in_ConeCC(G,diff_weight1) != 0) 2171 { 2172 Print("\n// MwalkNextWeightCC: geaenderter vector liegt in Groebnerkegel! \n"); 2173 for (j=0; j<nRing; j++) 2174 { 2175 (*diff_weight)[j] = (*diff_weight1)[j]; 2176 } 2177 if(MivAbsMax(diff_weight) < 5) 2178 { 2179 checkRed = 1; 2180 goto SIMPLIFY_GCD; 2181 } 2182 } 2183 else 2184 { 2185 // Print("\n// MwalkNextWeightCC: geaenderter vector liegt nicht in Groebnerkegel! \n"); 2186 break; 2187 } 2188 (*diff_weight1)[j] = mpz_get_si(vec[j]); 2189 } 2190 while(test_w_in_ConeCC(G,diff_weight1)) 2191 { 2192 for(j=0; j<nRing; j++) 2193 { 2194 (*diff_weight)[j] = (*diff_weight1)[j]; 2195 mpz_set_si(vec[j], (*diff_weight)[j]); 2196 } 2197 for(j=0; j<nRing; j++) 2198 { 2199 (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5); 2200 } 2201 } 2202 if(MivAbsMax(diff_weight)>10000) 2203 { 2204 for(j=0; j<nRing; j++) 2205 { 2206 (*diff_weight1)[j] = (*diff_weight)[j]; 2207 } 2208 j = 0; 2209 while(test_w_in_ConeCC(G,diff_weight1)) 2210 { 2211 (*diff_weight)[j] = (*diff_weight1)[j]; 2212 mpz_set_si(vec[j], (*diff_weight)[j]); 2213 j = MivAbsMaxArg(diff_weight1); 2214 (*diff_weight1)[j] = floor(0.1*(*diff_weight1)[j] + 0.5); 2215 } 2216 goto SIMPLIFY_GCD; 2188 2217 } 2189 2218 … … 2224 2253 mpz_clear(t_null); 2225 2254 2226 2227 2228 2255 if(Overflow_Error == FALSE) 2229 2256 { 2230 2257 Overflow_Error = nError; 2231 2258 } 2232 rComplete(currRing);2233 for( kkk=0; kkk<IDELEMS(G);kkk++)2234 { 2235 poly p=G->m[ kkk];2259 rComplete(currRing); 2260 for(j=0; j<IDELEMS(G); j++) 2261 { 2262 poly p=G->m[j]; 2236 2263 while(p!=NULL) 2237 2264 { … … 2273 2300 } 2274 2301 2275 /************************************************************** 2302 /******************************************************************** 2276 2303 * define and execute a new ring which order is (a(vb),a(va),lp,C) * 2277 * ************************************************************ /2304 * ******************************************************************/ 2278 2305 static void VMrHomogeneous(intvec* va, intvec* vb) 2279 2306 { … … 4445 4472 { 4446 4473 next_weight2 = MkInterRedNextWeight(next_weight22,target_weight,G); 4474 if(MivAbsMax(next_weight2)>1147483647) 4475 { 4476 for(i=0; i<nV; i++) 4477 { 4478 (*next_weight22)[i] = (*next_weight2)[i]; 4479 } 4480 i = 0; 4481 while(test_w_in_ConeCC(G,next_weight22)) 4482 { 4483 (*next_weight2)[i] = (*next_weight22)[i]; 4484 i = MivAbsMaxArg(next_weight22); 4485 (*next_weight22)[i] = floor(0.1*(*next_weight22)[i] + 0.5); 4486 } 4487 } 4447 4488 delete next_weight22; 4448 4489 break; … … 4575 4616 else 4576 4617 { 4577 rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung4618 rChangeCurrRing(VMrDefault(orig_target_weight)); 4578 4619 } 4579 4620 TargetRing = currRing; … … 4646 4687 else 4647 4688 { 4648 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung4689 rChangeCurrRing(VMrDefault(curr_weight)); 4649 4690 } 4650 4691 newRing = currRing; … … 4755 4796 else 4756 4797 { 4757 rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung4798 rChangeCurrRing(VMrDefault(orig_target_weight)); 4758 4799 } 4759 4800 F1 = idrMoveR(G, newRing,currRing); … … 4786 4827 else 4787 4828 { 4788 rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung4829 rChangeCurrRing(VMrDefault(orig_target_weight)); 4789 4830 } 4790 4831 KSTD_Finish: … … 4884 4925 tim = clock(); 4885 4926 /* 4886 Print("\n// **** Gr ᅵbnerwalk took %d steps and ", nwalk);4927 Print("\n// **** Groebnerwalk took %d steps and ", nwalk); 4887 4928 PrintS("\n// **** call the rec. Pert. Walk to compute a red GB of:"); 4888 4929 idElements(Gomega, "G_omega"); … … 4914 4955 oldRing = currRing; 4915 4956 4916 / * create a new ring newRing */4957 // create a new ring newRing 4917 4958 if (rParameter(currRing) != NULL) 4918 4959 { … … 4921 4962 else 4922 4963 { 4923 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung4964 rChangeCurrRing(VMrDefault(curr_weight)); 4924 4965 } 4925 4966 newRing = currRing; … … 4947 4988 else 4948 4989 { 4949 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung4990 rChangeCurrRing(VMrDefault(curr_weight)); 4950 4991 } 4951 4992 newRing = currRing; … … 5018 5059 else 5019 5060 { 5020 rChangeCurrRing(VMrDefault(target_weight)); // Aenderung5061 rChangeCurrRing(VMrDefault(target_weight)); 5021 5062 } 5022 5063 F1 = idrMoveR(G, newRing,currRing); … … 5792 5833 5793 5834 to = clock(); 5794 / * perturbs the original vector */5835 // perturbs the original vector 5795 5836 if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) := "dp" 5796 5837 { … … 5809 5850 DefRingPar(curr_weight); 5810 5851 else 5811 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 15852 rChangeCurrRing(VMrDefault(curr_weight)); 5812 5853 5813 5854 G = idrMoveR(Go, XXRing,currRing); … … 5824 5865 ring HelpRing = currRing; 5825 5866 5826 / * perturbs the target weight vector */5867 // perturbs the target weight vector 5827 5868 if(tp_deg > 1 && tp_deg <= nV) 5828 5869 { … … 5830 5871 DefRingPar(target_weight); 5831 5872 else 5832 rChangeCurrRing(VMrDefault(target_weight)); // Aenderung 25873 rChangeCurrRing(VMrDefault(target_weight)); 5833 5874 5834 5875 TargetRing = currRing; … … 5891 5932 DefRingPar(curr_weight); 5892 5933 else 5893 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 35934 rChangeCurrRing(VMrDefault(curr_weight)); 5894 5935 5895 5936 newRing = currRing; … … 6014 6055 DefRingPar(orig_target); 6015 6056 else 6016 rChangeCurrRing(VMrDefault(orig_target)); //Aenderung6057 rChangeCurrRing(VMrDefault(orig_target)); 6017 6058 6018 6059 TargetRing=currRing; … … 6192 6233 DefRingPar(omtmp); 6193 6234 else 6194 rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung36235 rChangeCurrRing(VMrDefault1(omtmp)); 6195 6236 6196 6237 testring = currRing; … … 6242 6283 else 6243 6284 { 6244 rChangeCurrRing(VMrDefault1(omtmp)); // Aenderung46285 rChangeCurrRing(VMrDefault1(omtmp)); 6245 6286 } 6246 6287 #ifdef TEST_OVERFLOW … … 6280 6321 DefRingPar(omtmp); 6281 6322 else 6282 rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung56323 rChangeCurrRing(VMrDefault1(omtmp)); 6283 6324 6284 6325 testring = currRing; … … 6347 6388 DefRingPar(Xivinput); 6348 6389 else 6349 rChangeCurrRing(VMrDefault1(Xivinput)); //Aenderung66390 rChangeCurrRing(VMrDefault1(Xivinput)); 6350 6391 6351 6392 testring = currRing; … … 6394 6435 DefRingPar(omega); 6395 6436 else 6396 rChangeCurrRing(VMrDefault1(omega)); //Aenderung76437 rChangeCurrRing(VMrDefault1(omega)); 6397 6438 6398 6439 Gomega1 = idrMoveR(Gomega, oRing,currRing); … … 6517 6558 /* determine the next border */ 6518 6559 next_vect = MWalkRandomNextWeight(G, omega,omega2, weight_rad, 1+nlev); 6519 //next_vect = MkInterRedNextWeight(omega,omega2,G); 6560 if(isNolVector(next_vect)) 6561 { 6562 next_vect = MkInterRedNextWeight(omega,omega2,G); 6563 } 6520 6564 xtnw=xtnw+clock()-to; 6521 6565 #ifdef PRINT_VECTORS … … 6539 6583 DefRingPar(omtmp); 6540 6584 else 6541 rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung36585 rChangeCurrRing(VMrDefault1(omtmp)); 6542 6586 6543 6587 testring = currRing; … … 6589 6633 else 6590 6634 { 6591 rChangeCurrRing(VMrDefault1(omtmp)); // Aenderung46635 rChangeCurrRing(VMrDefault1(omtmp)); 6592 6636 } 6593 6637 #ifdef TEST_OVERFLOW … … 6627 6671 DefRingPar(omtmp); 6628 6672 else 6629 rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung56673 rChangeCurrRing(VMrDefault1(omtmp)); 6630 6674 6631 6675 testring = currRing; … … 6694 6738 DefRingPar(Xivinput); 6695 6739 else 6696 rChangeCurrRing(VMrDefault1(Xivinput)); //Aenderung66740 rChangeCurrRing(VMrDefault1(Xivinput)); 6697 6741 6698 6742 testring = currRing; … … 6741 6785 DefRingPar(omega); 6742 6786 else 6743 rChangeCurrRing(VMrDefault1(omega)); //Aenderung76787 rChangeCurrRing(VMrDefault1(omega)); 6744 6788 6745 6789 Gomega1 = idrMoveR(Gomega, oRing,currRing); … … 6874 6918 DefRingPar(ivtarget); 6875 6919 else 6876 rChangeCurrRing(VMrDefault1(ivtarget)); //Aenderung16920 rChangeCurrRing(VMrDefault1(ivtarget)); 6877 6921 6878 6922 I1 = idrMoveR(I, oldRing,currRing); … … 6903 6947 DefRingPar(ivstart); 6904 6948 else 6905 rChangeCurrRing(VMrDefault1(ivstart)); //Aenderung26949 rChangeCurrRing(VMrDefault1(ivstart)); 6906 6950 6907 6951 I = idrMoveR(I1,tRing,currRing); … … 7000 7044 DefRingPar(ivtarget); 7001 7045 else 7002 rChangeCurrRing(VMrDefault1(ivtarget)); //Aenderung17046 rChangeCurrRing(VMrDefault1(ivtarget)); 7003 7047 7004 7048 I1 = idrMoveR(I, oldRing,currRing); … … 7029 7073 DefRingPar(ivstart); 7030 7074 else 7031 rChangeCurrRing(VMrDefault1(ivstart)); //Aenderung27075 rChangeCurrRing(VMrDefault1(ivstart)); 7032 7076 7033 7077 I = idrMoveR(I1,tRing,currRing); … … 7101 7145 intvec* hilb_func; 7102 7146 #endif 7103 / * to avoid (1,0,...,0) as the target vector */7147 // to avoid (1,0,...,0) as the target vector 7104 7148 intvec* last_omega = new intvec(nV); 7105 7149 for(i=nV-1; i>0; i--) … … 7116 7160 7117 7161 to=clock(); 7118 / * compute a red. GB w.r.t. the help ring */7162 // compute a red. GB w.r.t. the help ring 7119 7163 if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) = "dp" 7120 7164 G = MstdCC(G); … … 7125 7169 DefRingPar(curr_weight); 7126 7170 else 7127 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 47171 rChangeCurrRing(VMrDefault(curr_weight)); 7128 7172 G = idrMoveR(G, XXRing,currRing); 7129 7173 G = MstdCC(G); … … 7151 7195 DefRingPar(curr_weight); 7152 7196 else 7153 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 57197 rChangeCurrRing(VMrDefault(curr_weight)); 7154 7198 to=clock(); 7155 7199 Gw = idrMoveR(G, exring,currRing); … … 7186 7230 DefRingPar(curr_weight); 7187 7231 else 7188 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 67232 rChangeCurrRing(VMrDefault(curr_weight)); 7189 7233 7190 7234 newRing = currRing; … … 7271 7315 DefRingPar(target_tmp); 7272 7316 else 7273 rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 87317 rChangeCurrRing(VMrDefault(target_tmp)); 7274 7318 7275 7319 lpRing = currRing; … … 7331 7375 DefRingPar(target_tmp); 7332 7376 else 7333 rChangeCurrRing(VMrDefault(target_tmp)); //Aenderung 97377 rChangeCurrRing(VMrDefault(target_tmp)); 7334 7378 7335 7379 lpRing = currRing; … … 7534 7578 else 7535 7579 { 7536 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 107580 rChangeCurrRing(VMrDefault(curr_weight)); 7537 7581 } 7538 7582 G = idrMoveR(G, XXRing,currRing); … … 7567 7611 else 7568 7612 { 7569 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 117613 rChangeCurrRing(VMrDefault(curr_weight)); 7570 7614 } 7571 7615 to=clock(); … … 7610 7654 else 7611 7655 { 7612 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 127656 rChangeCurrRing(VMrDefault(curr_weight)); 7613 7657 } 7614 7658 newRing = currRing; … … 7779 7823 else 7780 7824 { 7781 rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 137825 rChangeCurrRing(VMrDefault(target_tmp)); 7782 7826 } 7783 7827 } … … 7852 7896 else 7853 7897 { 7854 rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 147898 rChangeCurrRing(VMrDefault(target_tmp)); 7855 7899 } 7856 7900 } … … 8095 8139 else 8096 8140 { 8097 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 158141 rChangeCurrRing(VMrDefault(curr_weight)); 8098 8142 } 8099 8143 newRing = currRing; … … 8517 8561 else 8518 8562 { 8519 rChangeCurrRing(VMrDefault(cw_tmp)); // Aenderung 168563 rChangeCurrRing(VMrDefault(cw_tmp)); 8520 8564 } 8521 8565 G = idrMoveR(Go, XXRing,currRing); … … 8591 8635 else 8592 8636 { 8593 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 178637 rChangeCurrRing(VMrDefault(curr_weight)); 8594 8638 } 8595 8639 newRing = currRing; … … 8653 8697 else 8654 8698 { 8655 rChangeCurrRing(VMrDefault(target_weight)); // Aenderung 188699 rChangeCurrRing(VMrDefault(target_weight)); 8656 8700 } 8657 8701 F1 = idrMoveR(G, newRing,currRing); -
Property
mode
changed from
-
Singular/walk.h
-
Property
mode
changed from
100644
to100755
-
Property
mode
changed from
-
Tst/Short/bug_interpol.res.gz.uu
r635bdd rf2ba60d 1 begin 640 bug_interpol.res.gz 2 M'XL("$\INT8``V)U9U]I;G1E<G!O;"YR97,`C5C+;ALW%-W[*]B@"RDRE.&; 3 MC"(5*+H)4!0HTE6--/%CG(X@2X8DNP&*_GLYA]20(P[']D*V+P\OSSV'3WWZ 4 MXY>/OQ%"Z(K\^O%G\N9X.,XWS<V;Q<6GT,)6Q`6_--OF.)DN+MK?9+4B-T_? 5 M7.Q8[Q]WF_FV_F=^.%X?NTY\1;J_Q9R\>T=.V.MCL]N28WTXON\0<A[1:DXV 6 MS>%(-I&!7K6]G^M;\AR#9M5/.=E</CMZKN4G<KNK[^^;VZ;>'LE]4V_NR.'O 7 MW9/[=5.3/Q_);D]^_\$CZ_W>_;>[O7W:[^L[EY'X_)MF6Q/SGGP=&.-KQ\&" 8 M`]DN:55US&CEHP\N&H/4!]<QXG3=-]MO9+]DE]\G=#[?3B_O'F.[D["YJZ\W 9 M)(F)%;G?[2=MIF9)%\V'AT4SFTV[=B?DO]T_3LGVI^VP=N#UA^5VL4[1Q@.Z 10 M'JSR`4(>K]:?E]\GZ^EL?[V]VSU,JDLZ[6@PYG'_=0'A`YNKYO,RTF6!P7,; 11 MIC'LQHU=[;"/7ZYHR\#*Z<Q]:GP:?-KVTPD^=1@&C$!<G2-;S(PZ%`>*HH4' 12 MK`L+A*NLL^UUEBW*V.$ASK`*6-,;*,WK(!H0A(T/LV)J!S>`RPQN$A$L,"(9 13 MM5\^K0#@"4`GW2F$-@Q_0U!#L_'X.;V8'>J:JE\T6B"PM@4Y<C<IM-8F&9V' 14 M5%!6CS)J4P$+B;7J9TD&;S'05<LR-62"LEH,JW&:@E!7\XR:RJDQ2*U91@U> 15 M,XBO:=9Z)GL+A>BZ2@;U*2"YLL.UGSI#9F6*`J7V,BBO=`(>FOD,HJO7S6O? 16 M`Q:H?&J7>\`.)<YYA[(XC%"I$66^'$ZHW`DU!(8QBKY$,NT"@U259<Z]Y/!, 17 MVM?QAG<R]>X%U3@,E+I0:1\+%V7N8C</@8)S,EL\D22,DOFZ*6_1`N9)_KHN 18 M;0<8*%EAV0V.`1MEOKF=/&\Q\$U68VNCKYF`?<(.F"5@EACR4<`5\>(6VT)A 19 MBDA-Z1.`'4)F\\<7!"]$[D78XR2$%]GAX-K;5J@L"OK&,Q+*BO%C(]"54%A4 20 M&;9LG(3$W!;`I\10F^=+(]O])<3GV7G:98+BO'2"0%<)U?G("=(AX0`OG"*E 21 M7@J^\'Q!I`>F@CT\W<5*9ZN"13P_7(;\5/"(I\=+/B\57&%G-R-TAQ.L=,#T 22 MM%;P@NFLS@&'%7QAN2^#=S$8Q-)E,2XX;&*BAV\O;#""\0*UL(PTG&`L*P,3 23 M3D-\1I.L4)BEJZ!\!=50FMHL>?'FHN$`'5D+0$%[F@P?AX345`W8UK9"6SIZ 24 M=L=4$);F\Q_2&,A+\WD^L-,9B$S32OH;A8'.M#3)T]EK8`"M,FW\M=N_#<86 25 MRQDU_TPH>P.0O\66%T1DYZ]3!7W/BO;'<3:3>M7Z4V"@6*2P?K-)FGO%63^Y 26 MRUN11WGQ"S,ZK]$&!ZKI7RR)>N7M]&U(W67K]87<+FE$G5J@L1OT;0Q!3,=F 27 M/"5D=+J,HR"DJS^F=[_@O<[)T(J&:E"BGUNT8I&\/=T;T,`C=YM/OMY>2"L1 28 MJ[*VYPJ:92RG/XB*%73]T*!C&?T>)O#U11@?M`E7$]<S]:_-P,OTYR.(^_=F 29 M8):^E3L`2QB:A&%X:B9CFC"F"&0\PQ"4"9'"];=[`JN$4X[M*^\?F('?R&TG 30 M?23[!V>@_N(`-C#WY2C_,J\2BJHW*III0BKT8,F8*ILA_@WINOM10AJ1I.&) 31 M]O[1&)+Q-,UI/ODT`9W.)9:F.>D`=&M?^!Z(5_$;0T[G^,JQ_4;QZ>"VE,6/ 32 +%_\#Q"61#Z@4```` 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
r635bdd rf2ba60d 3 3 bug_minpoly 4 4 bug_newstruct 5 bug_ring 5 6 bug_ringlist 6 7 bug_tr237 … … 26 27 bug_tr667 27 28 bug_tr668 29 bug_tr671 28 30 bug_genus_etc 29 31 facstd -
factory/facFqFactorize.cc
r635bdd rf2ba60d 2621 2621 iter2.getItem() *= power (xx, degree (LC (iter.getItem(),1), xx)); 2622 2622 } 2623 CanonicalForm tmp ;2623 CanonicalForm tmp, quot1, quot2, quot3; 2624 2624 iter2= vars1; 2625 2625 for (iter= leadingCoeffs[lengthAeval-1]; iter.hasItem(); iter++, iter2++) … … 2661 2661 { 2662 2662 tmp= ii.getItem().factor(); 2663 iter2.getItem() /= tmp; 2664 CFListIterator iter3= evaluation; 2665 for (int jj= A.level(); jj > 2; jj--, iter3++) 2666 tmp= tmp (iter3.getItem(), jj); 2667 if (!tmp.inCoeffDomain()) 2663 if (fdivides (tmp, iter2.getItem(), quot1)) 2668 2664 { 2669 int index3= 1; 2670 for (iter3= biFactors; iter3.hasItem(); iter3++, index3++) 2665 CFListIterator iter3= evaluation; 2666 for (int jj= A.level(); jj > 2; jj--, iter3++) 2667 tmp= tmp (iter3.getItem(), jj); 2668 if (!tmp.inCoeffDomain()) 2671 2669 { 2672 if (index3 == index2) 2670 int index3= 1; 2671 for (iter3= biFactors; iter3.hasItem(); iter3++, index3++) 2673 2672 { 2674 iter3.getItem() /= tmp; 2675 iter3.getItem() /= Lc (iter3.getItem()); 2676 break; 2673 if (index3 == index2) 2674 { 2675 if (fdivides (tmp, iter3.getItem(), quot2)) 2676 { 2677 if (fdivides (ii.getItem().factor(), A, quot3)) 2678 { 2679 A = quot3; 2680 iter2.getItem() = quot2; 2681 iter3.getItem() = quot3; 2682 iter3.getItem() /= Lc (iter3.getItem()); 2683 break; 2684 } 2685 } 2686 } 2677 2687 } 2678 2688 } 2679 2689 } 2680 A /= ii.getItem().factor();2681 2690 } 2682 2691 } … … 2699 2708 { 2700 2709 tmp= power (ii.getItem().factor(), ii.getItem().exp()); 2701 iter2.getItem() /= tmp; 2702 A /= tmp; 2703 CFListIterator iter3= evaluation; 2704 for (int jj= A.level(); jj > 2; jj--, iter3++) 2705 tmp= tmp (iter3.getItem(), jj); 2706 if (!tmp.inCoeffDomain()) 2710 if (fdivides (tmp, A, quot1)) 2707 2711 { 2708 int index3= 1; 2709 for (iter3= biFactors; iter3.hasItem(); iter3++, index3++) 2712 if (fdivides (tmp, iter2.getItem())) 2710 2713 { 2711 if (index3 == index2) 2714 CFListIterator iter3= evaluation; 2715 for (int jj= A.level(); jj > 2; jj--, iter3++) 2716 tmp= tmp (iter3.getItem(), jj); 2717 if (!tmp.inCoeffDomain()) 2712 2718 { 2713 iter3.getItem() /= tmp; 2714 iter3.getItem() /= Lc (iter3.getItem()); 2715 break; 2719 int index3= 1; 2720 for (iter3= biFactors; iter3.hasItem(); iter3++, index3++) 2721 { 2722 if (index3 == index2) 2723 { 2724 if (fdivides (tmp, iter3.getItem(), quot3)) 2725 { 2726 A = quot1; 2727 iter2.getItem() = quot2; 2728 iter3.getItem() = quot3; 2729 iter3.getItem() /= Lc (iter3.getItem()); 2730 break; 2731 } 2732 } 2733 } 2716 2734 } 2717 2735 } -
kernel/GBEngine/tgb.cc
r635bdd rf2ba60d 40 40 #if 1 41 41 static omBin lm_bin = NULL; 42 static int add_to_reductors(slimgb_alg* c, poly h, int len, int ecart, BOOLEAN simplified=FALSE); 43 static void multi_reduction(red_object* los, int & losl, slimgb_alg* c); 44 static void multi_reduce_step(find_erg & erg, red_object* r, slimgb_alg* c); 45 static BOOLEAN extended_product_criterion(poly p1, poly gcd1, poly p2, poly gcd2, slimgb_alg* c); 46 static poly gcd_of_terms(poly p, ring r); 47 static int tgb_pair_better_gen(const void* ap,const void* bp); 48 static BOOLEAN pair_better(sorted_pair_node* a,sorted_pair_node* b, slimgb_alg* c=NULL); 49 static BOOLEAN state_is(calc_state state, const int & i, const int & j, slimgb_alg* c); 50 static void super_clean_top_of_pair_list(slimgb_alg* c); 51 static int simple_posInS (kStrategy strat, poly p,int len, wlen_type wlen); 52 static int* make_connections(int from, int to, poly bound, slimgb_alg* c); 53 static BOOLEAN has_t_rep(const int & arg_i, const int & arg_j, slimgb_alg* state); 54 static void shorten_tails(slimgb_alg* c, poly monom); 55 static poly redNF2 (poly h,slimgb_alg* c , int &len, number& m,int n=0); 56 static poly redNFTail (poly h,const int sl,kStrategy strat, int len); 57 static int bucket_guess(kBucket* bucket); 42 58 43 59 static void simplify_poly (poly p, ring r) -
kernel/GBEngine/tgb_internal.h
r635bdd rf2ba60d 309 309 //SOONTREP 310 310 }; 311 //static BOOLEAN pair_cmp(sorted_pair_node* a,sorted_pair_node* b);312 311 template <class len_type, class set_type> int pos_helper(kStrategy strat, poly p, len_type len, set_type setL, polyset set); 313 static int add_to_reductors(slimgb_alg* c, poly h, int len, int ecart, BOOLEAN simplified=FALSE);314 static int bucket_guess(kBucket* bucket);315 static poly redNFTail (poly h,const int sl,kStrategy strat, int len);316 static poly redNF2 (poly h,slimgb_alg* c , int &len, number& m,int n=0);317 312 void free_sorted_pair_node(sorted_pair_node* s, ring r); 318 static void shorten_tails(slimgb_alg* c, poly monom);319 static void replace_pair(int & i, int & j, slimgb_alg* c);320 //static sorted_pair_node** add_to_basis(poly h, int i, int j,slimgb_alg* c, int* ip=NULL);321 //static void do_this_spoly_stuff(int i,int j,slimgb_alg* c);322 //ideal t_rep_gb(ring r,ideal arg_I);323 313 ideal do_t_rep_gb(ring r,ideal arg_I, int syz_comp, BOOLEAN F4_mode,int deg_pos); 324 static BOOLEAN has_t_rep(const int & arg_i, const int & arg_j, slimgb_alg* state);325 //static int* make_connections(int from, poly bound, slimgb_alg* c);326 static int* make_connections(int from, int to, poly bound, slimgb_alg* c);327 314 void now_t_rep(const int & arg_i, const int & arg_j, slimgb_alg* c); 328 //static void soon_t_rep(const int & arg_i, const int & arg_j, slimgb_alg* c); 329 //static int pLcmDeg(poly a, poly b); 330 static int simple_posInS (kStrategy strat, poly p,int len, wlen_type wlen); 331 //static BOOLEAN find_next_pair(slimgb_alg* c, BOOLEAN go_higher=TRUE); 332 333 //static sorted_pair_node* pop_pair(slimgb_alg* c); 334 //static BOOLEAN no_pairs(slimgb_alg* c); 315 335 316 void clean_top_of_pair_list(slimgb_alg* c); 336 static void super_clean_top_of_pair_list(slimgb_alg* c);337 static BOOLEAN state_is(calc_state state, const int & i, const int & j, slimgb_alg* c);338 static BOOLEAN pair_better(sorted_pair_node* a,sorted_pair_node* b, slimgb_alg* c=NULL);339 static int tgb_pair_better_gen(const void* ap,const void* bp);340 static poly redTailShort(poly h, kStrategy strat);341 static poly gcd_of_terms(poly p, ring r);342 static BOOLEAN extended_product_criterion(poly p1, poly gcd1, poly p2, poly gcd2, slimgb_alg* c);343 //static poly kBucketGcd(kBucket* b, ring r);344 static void multi_reduction(red_object* los, int & losl, slimgb_alg* c);345 317 int slim_nsize(number n, ring r); 346 318 sorted_pair_node* quick_pop_pair(slimgb_alg* c); … … 351 323 int tgb_pair_better_gen2(const void* ap,const void* bp); 352 324 int kFindDivisibleByInS_easy(kStrategy strat,poly p, long sev); 353 //static int quality(poly p, int len, slimgb_alg* c);354 325 /** 355 326 makes on each red_object in a region a single_step … … 402 373 403 374 }; 404 405 static void multi_reduce_step(find_erg & erg, red_object* r, slimgb_alg* c);406 //static void finalize_reduction_step(reduction_step* r);407 375 408 376 template <class len_type, class set_type> int pos_helper(kStrategy strat, poly p, len_type len, set_type setL, polyset set) … … 1457 1425 } 1458 1426 #endif 1459 static wlen_type pair_weighted_length(int i, int j, slimgb_alg* c);1460 1427 wlen_type pELength(poly p, ring r); 1461 1428 int terms_sort_crit(const void* a, const void* b); -
libpolys/coeffs/Makefile.am
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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/nc/gb_hack.h
r635bdd rf2ba60d 37 37 38 38 # define STR_EXPAND(tok) #tok 39 # define D(A) A{ WerrorS("This is a hack. Function is not defined: " STR_EXPAND(A) ); return NULL; }39 # define D(A) A{ WerrorS("This is a hack. Function is not defined: " STR_EXPAND(A) ); return NULL; (void)(_currRing); } 40 40 41 41 D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)) -
libpolys/polys/pDebug.cc
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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
r635bdd rf2ba60d 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.