Changeset fbdfd4 in git
- Timestamp:
- Sep 9, 2013, 4:37:38 PM (10 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
- Children:
- b0fc73b7ae26811903b88a25b1f2d65d78541b15
- Parents:
- 574ceea35db8d5683c990e9f7e364c3e2ae515ca
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2013-09-09 16:37:38+02:00
- git-committer:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2013-09-09 17:07:38+02:00
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/misc_ip.cc
r574cee rfbdfd4 772 772 /* version strings */ 773 773 #ifdef HAVE_FLINT 774 #ifdef __cplusplus775 774 extern "C" 776 775 { 777 #endif778 776 #ifndef __GMP_BITS_PER_MP_LIMB 779 777 #define __GMP_BITS_PER_MP_LIMB GMP_LIMB_BITS 780 778 #endif 781 779 #include <flint/flint.h> 782 #ifdef __cplusplus 783 } 784 #endif 780 } 785 781 #endif 786 782 … … 900 896 #endif 901 897 StringAppend("random=%d\n",siRandomStart); 902 898 903 899 #define SI_SHOW_BUILTIN_MODULE(name) StringAppend(" %s", #name); 904 900 StringAppendS("built-in modules: {"); … … 906 902 StringAppendS("}\n"); 907 903 #undef SI_SHOW_BUILTIN_MODULE 908 909 StringAppend(" \tAC_CONFIGURE_ARGS=%s,\n"910 "\tCC=%s,FLAGS:%s,\n"911 "\tCXX=%s,FLAGS:%s,\n"912 "\tDEFS:%s,CPPFLAGS:%s,\n"913 "\tLDFLAGS:%s,LIBS:%s "904 905 StringAppend("AC_CONFIGURE_ARGS=%s,\n" 906 "CC=%s,FLAGS:%s,\n" 907 "CXX=%s,FLAGS:%s,\n" 908 "DEFS:%s,CPPFLAGS:%s,\n" 909 "LDFLAGS:%s,LIBS:%s " 914 910 #ifdef __GNUC__ 915 911 "(ver: " __VERSION__ ")" -
libpolys/polys/clapconv.cc
r574cee rfbdfd4 380 380 p_SetExp( term, i ,exp[i], r); 381 381 //if (rRing_has_Comp(currRing)) p_SetComp(term, 0, currRing); // done by pInit 382 pGetCoeff(term) = ALLOC0_RNUMBER(); // Q!? 383 NUM(pGetCoeff(term))=convFactoryPSingP( f, r->cf->extRing ); 382 pGetCoeff(term)=ntInit(convFactoryPSingP( f, r->cf->extRing ), r->cf); 384 383 p_Setm( term,r ); 385 384 result = p_Add_q( result, term,r ); -
libpolys/polys/ext_fields/transext.cc
r574cee rfbdfd4 141 141 void handleNestedFractionsOverQ(fraction f, const coeffs cf); 142 142 143 /* test routine, usualy disabled * 144 * if want to activate it, activate also the calls to check_N * 145 * 146 void check_normalized(number t,const coeffs cf, const char *f, int l) 147 { 148 if (IS0(t)) return; 149 if(rField_is_Q(ntRing)) 150 { 151 poly pp=NUM(t); 152 while(pp!=NULL) 153 { 154 if (((SR_HDL(pGetCoeff(pp)) & SR_INT)==0)&&(SR_HDL(pGetCoeff(pp))!=NULL)) 155 { 156 if (pGetCoeff(pp)->s==0) 157 { 158 Print("NUM not normalized in %s:%d\n",f,l); 159 p_Normalize(pp,ntRing); 160 } 161 else if (pGetCoeff(pp)->s==1) 162 Print("NUM is rational in %s:%d\n",f,l); 163 } 164 pIter(pp); 165 } 166 pp=DEN(t); 167 while(pp!=NULL) 168 { 169 if (((SR_HDL(pGetCoeff(pp)) & SR_INT)==0)&&(SR_HDL(pGetCoeff(pp))!=NULL)) 170 { 171 if (pGetCoeff(pp)->s==0) 172 { 173 Print("NUM not normalized in %s:%d\n",f,l); 174 p_Normalize(pp,ntRing); 175 } 176 else if (pGetCoeff(pp)->s==1) 177 Print("DEN is rational in %s:%d\n",f,l); 178 } 179 pIter(pp); 180 } 181 } 182 } 183 #define check_N(A,B) check_normalized(A,B,__FILE__,__LINE__) 184 */ 185 143 186 #ifdef LDEBUG 144 187 BOOLEAN ntDBTest(number a, const char *f, const int l, const coeffs cf) … … 150 193 const fraction t = (fraction)a; 151 194 195 //check_N(a,cf); 152 196 const poly num = NUM(t); 153 197 assume(num != NULL); /**< t != 0 ==> numerator(t) != 0 */ … … 240 284 BOOLEAN ntIsZero(number a, const coeffs cf) 241 285 { 286 //check_N(a,cf); 242 287 ntTest(a); // !!! 243 288 return (IS0(a)); … … 246 291 void ntDelete(number * a, const coeffs cf) 247 292 { 293 //check_N(*a,cf); 248 294 ntTest(*a); // !!! 249 295 fraction f = (fraction)(*a); … … 257 303 BOOLEAN ntEqual(number a, number b, const coeffs cf) 258 304 { 305 //check_N(a,cf); 306 //check_N(b,cf); 259 307 ntTest(a); 260 308 ntTest(b); … … 301 349 number ntCopy(number a, const coeffs cf) 302 350 { 351 //check_N(a,cf); 303 352 ntTest(a); // !!! 304 353 if (IS0(a)) return NULL; … … 317 366 number ntGetNumerator(number &a, const coeffs cf) 318 367 { 368 //check_N(a,cf); 319 369 ntTest(a); 320 370 if (IS0(a)) return NULL; … … 370 420 371 421 ntTest((number)result); 422 //check_N((number)result,cf); 372 423 return (number)result; 373 424 } … … 376 427 number ntGetDenom(number &a, const coeffs cf) 377 428 { 429 //check_N(a,cf); 378 430 ntTest(a); 379 431 … … 382 434 COM (result)= 0; 383 435 384 if (IS0(a)) 436 if (IS0(a)) 385 437 { 386 438 NUM (result) = p_One(ntRing); 387 439 return (number)result; 388 440 } 389 441 390 442 definiteGcdCancellation(a, cf, FALSE); 391 443 392 444 fraction f = (fraction)a; 393 445 394 446 assume( !IS0(f) ); 395 447 396 448 const BOOLEAN denis1 = DENIS1 (f); 397 449 398 450 if( denis1 && (getCoeffType (ntCoeffs) != n_Q) ) // */1 or 0 399 451 { … … 471 523 472 524 ntTest((number)result); 525 //check_N((number)result,cf); 473 526 return (number)result; 474 527 } … … 476 529 BOOLEAN ntIsOne(number a, const coeffs cf) 477 530 { 531 //check_N(a,cf); 478 532 ntTest(a); // !!! 479 533 definiteGcdCancellation(a, cf, FALSE); … … 484 538 BOOLEAN ntIsMOne(number a, const coeffs cf) 485 539 { 540 //check_N(a,cf); 486 541 ntTest(a); 487 542 definiteGcdCancellation(a, cf, FALSE); … … 496 551 number ntNeg(number a, const coeffs cf) 497 552 { 553 //check_N(a,cf); 498 554 ntTest(a); 499 555 if (!IS0(a)) … … 553 609 554 610 ntTest((number)result); 611 //check_N((number)result,cf); 555 612 556 613 return (number)result; … … 570 627 //COM(result) = 0; // done by omAlloc0Bin 571 628 ntTest((number)result); 629 //check_N((number)result,cf); 572 630 return (number)result; 573 631 } … … 587 645 { 588 646 number g; 589 // TODO/NOTE: the following should not be necessary (due to590 // Hannes!) as NUM (f) should be over Z!!!591 // but it is not: normalize it647 // the following is necessary because 648 // NUM (f) should be over Z, 649 // while p may be over Q 592 650 CPolyCoeffsEnumerator itr(p); 593 651 … … 606 664 { 607 665 DEN (f) = p_NSet(g, ntRing); 666 p_Normalize(DEN(f), ntRing); 608 667 assume( DEN (f) != NULL ); 609 668 } … … 615 674 } 616 675 676 p_Normalize(p, ntRing); 617 677 NUM(f) = p; 618 678 COM(f) = 0; 619 679 680 //check_N((number)f,cf); 620 681 ntTest((number)f); 621 682 return (number)f; … … 624 685 int ntInt(number &a, const coeffs cf) 625 686 { 687 //check_N(a,cf); 626 688 ntTest(a); 627 689 if (IS0(a)) return 0; … … 651 713 BOOLEAN ntGreater(number a, number b, const coeffs cf) 652 714 { 715 //check_N(a,cf); 716 //check_N(b,cf); 653 717 ntTest(a); 654 718 ntTest(b); … … 702 766 BOOLEAN ntGreaterZero(number a, const coeffs cf) 703 767 { 768 //check_N(a,cf); 704 769 ntTest(a); 705 770 if (IS0(a)) return FALSE; … … 749 814 number ntDiff(number a, number d, const coeffs cf) 750 815 { 816 //check_N(a,cf); 817 //check_N(d,cf); 751 818 ntTest(a); 752 819 ntTest(d); … … 773 840 774 841 fraction fa = (fraction)a; 775 if (DENIS1(fa)) {776 842 if (DENIS1(fa)) 843 { 777 844 fraction result = (fraction)omAlloc0Bin(fractionObjectBin); 778 845 NUM(result) = p_Diff(NUM(fa),k,ntRing); 779 846 DEN(result) = NULL; 780 847 COM(result) = COM(fa); 848 //check_N((number)result,cf); 781 849 return (number)result; 782 850 } … … 791 859 heuristicGcdCancellation((number)result, cf); 792 860 861 //check_N((number)result,cf); 793 862 return (number)result; 794 863 } … … 797 866 number ntAdd(number a, number b, const coeffs cf) 798 867 { 868 //check_N(a,cf); 869 //check_N(b,cf); 799 870 ntTest(a); 800 871 ntTest(b); … … 829 900 // ntTest((number)result); 830 901 902 //check_N((number)result,cf); 831 903 return (number)result; 832 904 } … … 834 906 number ntSub(number a, number b, const coeffs cf) 835 907 { 908 //check_N(a,cf); 909 //check_N(b,cf); 836 910 ntTest(a); 837 911 ntTest(b); … … 864 938 heuristicGcdCancellation((number)result, cf); 865 939 // ntTest((number)result); 940 //check_N((number)result,cf); 866 941 return (number)result; 867 942 } … … 869 944 number ntMult(number a, number b, const coeffs cf) 870 945 { 946 //check_N(a,cf); 947 //check_N(b,cf); 871 948 ntTest(a); // !!!? 872 949 ntTest(b); // !!!? … … 889 966 890 967 968 //check_N((number)result,cf); 891 969 if (db == NULL) 892 970 { … … 905 983 COM(result) = COM(fa) + MULT_COMPLEXITY; 906 984 heuristicGcdCancellation((number)result, cf); 907 } 908 } else 985 //check_N((number)result,cf); 986 } 987 } 988 else 909 989 { // b = ?? / ?? 910 990 if (da == NULL) … … 914 994 COM(result) = COM(fb) + MULT_COMPLEXITY; 915 995 heuristicGcdCancellation((number)result, cf); 996 //check_N((number)result,cf); 916 997 } 917 998 else /* both den's are != 1 */ … … 921 1002 COM(result) = COM(fa) + COM(fb) + MULT_COMPLEXITY; 922 1003 heuristicGcdCancellation((number)result, cf); 1004 //check_N((number)result,cf); 923 1005 } 924 1006 } … … 926 1008 // ntTest((number)result); 927 1009 1010 //check_N((number)result,cf); 928 1011 return (number)result; 929 1012 } … … 931 1014 number ntDiv(number a, number b, const coeffs cf) 932 1015 { 1016 //check_N(a,cf); 1017 //check_N(b,cf); 933 1018 ntTest(a); 934 1019 ntTest(b); … … 962 1047 heuristicGcdCancellation((number)result, cf); 963 1048 // ntTest((number)result); 1049 //check_N((number)result,cf); 964 1050 return (number)result; 965 1051 } … … 1036 1122 *b = pow; 1037 1123 ntTest(*b); 1124 //check_N(*b,cf); 1038 1125 } 1039 1126 … … 1069 1156 1070 1157 { /* step (1); see documentation of this procedure above */ 1071 p_Normalize(NUM(f), ntRing);1072 p_Normalize(DEN(f), ntRing);1073 1158 number lcmOfDenominators = n_Init(1, ntCoeffs); 1074 1159 number c; number tmp; … … 1163 1248 1164 1249 fraction f = (fraction)a; 1165 if (COM(f)!=0) p_Normalize(NUM(f),ntRing);1250 p_Normalize(NUM(f),ntRing); 1166 1251 if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; return; } 1167 1252 1168 p_Normalize(DEN(f), ntRing);1169 1170 1253 assume( DEN(f) != NULL ); 1254 p_Normalize(DEN(f),ntRing); 1171 1255 1172 1256 /* check whether NUM(f) = DEN(f), and - if so - replace 'a' by 1 */ … … 1219 1303 1220 1304 if (IS0(a)) return; 1221 if (NUM(f)!=NULL) p_Normalize(NUM(f), ntRing);1222 if (DEN(f)!=NULL) p_Normalize(DEN(f), ntRing);1223 1305 if (!simpleTestsHaveAlreadyBeenPerformed) 1224 1306 { 1225 //p_Normalize(NUM(f), ntRing);1226 //if (DEN(f)!=NULL) p_Normalize(DEN(f), ntRing);1227 1307 if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; return; } 1228 1308 … … 1662 1742 number ntInvers(number a, const coeffs cf) 1663 1743 { 1744 //check_N(a,cf); 1664 1745 ntTest(a); 1665 1746 if (IS0(a)) … … 1712 1793 } 1713 1794 ntTest((number)result); // !!!! 1795 //check_N((number)result,cf); 1714 1796 return (number)result; 1715 1797 } … … 1734 1816 else DEN(ff)=p_NSet(nn,dst->extRing); 1735 1817 n_Test((number)ff,dst); 1818 //check_N((number)ff,dst); 1736 1819 return (number)ff; 1737 1820 } … … 1782 1865 DEN(result) = h; 1783 1866 COM(result) = COM(f); 1867 //check_N((number)result,dst); 1784 1868 assume(n_Test((number)result, dst)); 1785 1869 return (number)result; … … 1790 1874 assume( n_Test(a, cf) ); 1791 1875 if (n_IsZero(a, cf)) return NULL; 1792 1793 fraction f = (fraction)omAlloc0Bin(fractionObjectBin); 1794 // DEN(f) = NULL; COM(f) = 0; 1795 NUM(f) = prCopyR((poly)a, cf->extRing, dst->extRing); 1796 assume(n_Test((number)f, dst)); 1797 return (number)f; 1876 return ntInit(prCopyR((poly)a, cf->extRing, dst->extRing),dst); 1798 1877 } 1799 1878 … … 1817 1896 NUM(f) = g; // DEN(f) = NULL; COM(f) = 0; 1818 1897 assume(n_Test((number)f, dst)); 1898 //check_N((number)f,dst); 1819 1899 return (number)f; 1820 1900 } … … 1831 1911 NUM(f) = p; DEN(f) = NULL; COM(f) = 0; 1832 1912 assume(n_Test((number)f, dst)); 1913 //check_N((number)f,dst); 1833 1914 return (number)f; 1834 1915 } … … 1853 1934 NUM(f) = p; DEN(f) = NULL; COM(f) = 0; 1854 1935 assume(n_Test((number)f, dst)); 1936 //check_N((number)f,dst); 1855 1937 return (number)f; 1856 1938 } … … 1951 2033 if (n.isZero()) return NULL; 1952 2034 poly p=convFactoryPSingP(n,ntRing); 2035 p_Normalize(p,ntRing); 1953 2036 fraction result = (fraction)omAlloc0Bin(fractionObjectBin); 1954 2037 NUM(result) = p; -
libpolys/polys/monomials/p_polys.cc
r574cee rfbdfd4 3647 3647 number n=pGetCoeff(DEN(z)); 3648 3648 zz=p_Div_nn(zz,n,srcExtRing); 3649 p_Normalize(zz,srcExtRing); 3649 3650 } 3650 3651 //else -
libpolys/reporter/dError.cc
r574cee rfbdfd4 68 68 #endif 69 69 70 #if 0 70 71 #ifdef HAVE_EXECINFO_H 71 72 ret = backtrace( buffer, SIZE ); // execinfo.h … … 121 122 malloc_free (ptr); 122 123 #endif 124 #endif 123 125 124 126 #undef SIZE
Note: See TracChangeset
for help on using the changeset viewer.