Changeset f70f641 in git
 Timestamp:
 Apr 27, 2011, 10:22:46 AM (12 years ago)
 Branches:
 (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
 Children:
 b7d7eb00647832d8b7ba2d7f853accc84ba835b5
 Parents:
 b27c0524d725542db31ecb0c95c603a31a1d1faa
 gitauthor:
 Hans Schoenemann <hannes@mathematik.unikl.de>20110427 10:22:46+02:00
 gitcommitter:
 Mohamed Barakat <mohamed.barakat@rwthaachen.de>20111109 12:31:29+01:00
 Location:
 libpolys
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

libpolys/coeffs/numbers.h
rb27c052 rf70f641 72 72 /// Test whether a is a zero divisor in r 73 73 /// i.e. not coprime with char. of r 74 /// very inefficient implementation: 75 /// should ONLY be used for debug stuff /tests 74 76 BOOLEAN n_IsZeroDivisor( number a, const coeffs r); 75 77 
libpolys/polys/monomials/ring.cc
rb27c052 rf70f641 171 171 } 172 172 ring rDefault(coeffs cf, int N, char **n) 173 { 173 { 174 174 assume( cf != NULL); 175 175 /*order: lp,0*/ … … 314 314 } 315 315 } 316 #endif 316 #endif 317 317 Print("// number of vars : %d",r>N); 318 318 … … 420 420 // iiWriteMatrix((matrix)Q,"scaQ",1); 421 421 // } 422 // else 422 // else 423 423 PrintS(" ..."); 424 424 } … … 739 739 { 740 740 TODO(Somabody, move this proc. over to coeffs!?); 741 741 742 742 #ifdef HAVE_RINGS 743 743 if (rField_is_Ring_2toM(r)) … … 748 748 return binaryPower((int)mpz_get_ui(r>cf>modBase), 749 749 (int)(unsigned long)r>cf>modExponent); 750 750 751 751 #endif 752 752 if (rField_is_numeric(r)) … … 776 776 { 777 777 r = rCopy(r); 778 if (rIsPluralRing(r)) 778 if (rIsPluralRing(r)) 779 779 return r; 780 780 … … 815 815 else /* different type */ 816 816 { 817 if (r1>cf>ch<1) /* Z/p(a) */ 818 { 819 if ((r2>cf>ch==0) /* Q */ 820  (r2>cf>ch==r1>cf>ch)) /* Z/p */ 821 { 822 tmpR.cf>ch=r1>cf>ch; 823 tmpR.cf>P=rPar(r1); 824 tmpR.cf>parameter=(char **)omAlloc(rPar(r1)*sizeof(char *)); 825 int i; 826 for (i=0;i<rPar(r1);i++) 827 { 828 tmpR.cf>parameter[i]=omStrDup(r1>cf>parameter[i]); 829 } 830 if (r1>cf>minpoly!=NULL) 831 { 832 tmpR.cf>minpoly=n_Copy(r1>cf>minpoly, r1>cf); 833 } 834 } 835 else /* R, Q(a),Z/q,Z/p(a),GF(p,n) */ 836 { 837 WerrorS("Z/p(a)+(R,Q(a),Z/q(a),GF(q,n))"); 817 if (getCoeffType(r1>cf)==n_Zp) 818 { 819 if (getCoeffType(r2>cf)==n_Q) 820 { 821 tmpR.cf=r1>cf; 822 r1>cf>ref++; 823 } 824 else 825 { 826 WerrorS("Z/p+..."); 838 827 return 1; 839 828 } 840 829 } 841 else if ( r1>cf>ch==1) /* R */830 else if (getCoeffType(r1>cf)==n_R) 842 831 { 843 832 WerrorS("R+.."); 844 833 return 1; 845 834 } 846 else if (r1>cf>ch==0) /* Q */ 847 { 848 if ((r2>cf>ch<1)(r2>cf>ch==1)) /* Z/p(a),Q(a) */ 849 { 850 tmpR.cf>ch=r2>cf>ch; 851 tmpR.cf>P=rPar(r2); 852 tmpR.cf>parameter=(char **)omAlloc(rPar(r2)*sizeof(char *)); 853 int i; 854 for (i=0;i<rPar(r2);i++) 855 { 856 tmpR.cf>parameter[i]=omStrDup(r2>cf>parameter[i]); 857 } 858 if (r2>cf>minpoly!=NULL) 859 { 860 tmpR.cf>minpoly=n_Copy(r2>cf>minpoly, r2>cf); 861 } 862 } 863 else if (r2>cf>ch>1) /* Z/p,GF(p,n) */ 864 { 865 tmpR.cf>ch=r2>cf>ch; 866 if (r2>cf>parameter!=NULL) 867 { 868 tmpR.cf>parameter=(char_ptr *)omAllocBin(char_ptr_bin); 869 tmpR.cf>P=1; 870 tmpR.cf>parameter[0]=omStrDup(r2>cf>parameter[0]); 871 } 835 else if (getCoeffType(r1>cf)==n_Q) 836 { 837 if (getCoeffType(r2>cf)==n_Zp) 838 { 839 tmpR.cf=r2>cf; 840 r2>cf>ref++; 872 841 } 873 842 else 874 843 { 875 WerrorS("Q+R"); 876 return 1; /* R */ 877 } 878 } 879 else if (r1>cf>ch==1) /* Q(a) */ 880 { 881 if (r2>cf>ch==0) /* Q */ 882 { 883 tmpR.cf>ch=r1>cf>ch; 884 tmpR.cf>P=rPar(r1); 885 tmpR.cf>parameter=(char **)omAlloc(rPar(r1)*sizeof(char *)); 886 int i; 887 for(i=0;i<rPar(r1);i++) 888 { 889 tmpR.cf>parameter[i]=omStrDup(r1>cf>parameter[i]); 890 } 891 if (r1>cf>minpoly!=NULL) 892 { 893 tmpR.cf>minpoly=n_Copy(r1>cf>minpoly, r1>cf); 894 } 895 } 896 else /* R, Z/p,GF(p,n) */ 897 { 898 WerrorS("Q(a)+(R,Z/p,GF(p,n))"); 844 WerrorS("Q+..."); 899 845 return 1; 900 846 } 901 847 } 902 else /* r1>cf>ch >=2 , Z/p */ 903 { 904 if (r2>cf>ch==0) /* Q */ 905 { 906 tmpR.cf>ch=r1>cf>ch; 907 } 908 else if (r2>cf>ch==r1>cf>ch) /* Z/p(a) */ 909 { 910 tmpR.cf>ch=r2>cf>ch; 911 tmpR.cf>P=rPar(r2); 912 tmpR.cf>parameter=(char **)omAlloc(rPar(r2)*sizeof(char *)); 913 int i; 914 for(i=0;i<rPar(r2);i++) 915 { 916 tmpR.cf>parameter[i]=omStrDup(r2>cf>parameter[i]); 917 } 918 if (r2>cf>minpoly!=NULL) 919 { 920 tmpR.cf>minpoly=n_Copy(r2>cf>minpoly, r2>cf); 921 } 922 } 923 else 924 { 925 WerrorS("Z/p+(GF(q,n),Z/q(a),R,Q(a))"); 926 return 1; /* GF(p,n),Z/q(a),R,Q(a) */ 927 } 848 else 849 { 850 WerrorS("coeff sum not yet implemented"); 851 return 1; 928 852 } 929 853 } … … 1349 1273 for (int for_i=0;for_i<IDELEMS(r1>qideal);for_i++) 1350 1274 Q1>m[for_i] = p_PermPoly( 1351 1352 1353 nMap1, 1354 1355 1275 r1>qideal>m[for_i], perm1, 1276 r1, sum, 1277 nMap1, 1278 par_perm1, rPar(r1)); 1279 1356 1280 omFree((ADDRESS)perm1); 1357 1281 } … … 1369 1293 nMapFunc nMap2 = n_SetMap(r2>cf,sum>cf); 1370 1294 Q2 = idInit(IDELEMS(r2>qideal),1); 1371 1295 1372 1296 for (int for_i=0;for_i<IDELEMS(r2>qideal);for_i++) 1373 Q2>m[for_i] = p_PermPoly( 1374 r2>qideal>m[for_i], perm2, 1375 r2, sum, 1376 nMap2, 1377 1378 1297 Q2>m[for_i] = p_PermPoly( 1298 r2>qideal>m[for_i], perm2, 1299 r2, sum, 1300 nMap2, 1301 par_perm2, rPar(r2)); 1302 1379 1303 omFree((ADDRESS)perm2); 1380 1304 } … … 1417 1341 ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering) 1418 1342 { 1419 TODO(Hans, "Please consider the change to '>cf'...");1420 1421 1343 if (r == NULL) return NULL; 1422 1344 int i,j; … … 1435 1357 //struct omBin PolyBin; /* Bin from where monoms are allocated */ 1436 1358 //memset: res>PolyBin=NULL; // rComplete 1437 res>cf>ch=r>cf>ch; /* characteristic */ 1438 #ifdef HAVE_RINGS 1439 res>cf>ringtype = r>cf>ringtype; // cring = 0 => coefficient field, cring = 1 => coeffs from Z/2^m 1440 if (r>cf>modBase!=NULL) 1441 { 1442 res>cf>modBase = (int_number) omAlloc(sizeof(mpz_t)); 1443 mpz_init_set(res>cf>modBase,r>cf>modBase); 1444 } 1445 res>cf>modExponent=r>cf>modExponent; 1446 if (r>cf>modNumber!=NULL) 1447 { 1448 res>cf>modNumber = (int_number) omAlloc(sizeof(mpz_t)); 1449 mpz_init_set(res>cf>modNumber,r>cf>modNumber); 1450 } 1451 #endif 1359 res>cf=r>cf; /* coeffs */ 1360 res>cf>ref++; 1361 1452 1362 //memset: res>ref=0; /* reference counter to the ring */ 1453 1363 … … 1456 1366 1457 1367 res>N=rVar(r); /* number of vars */ 1458 res>cf>P=rPar(r); /* number of pars */1459 1368 res>OrdSgn=r>OrdSgn; /* 1 for polynomial rings, 1 otherwise */ 1460 1369 … … 1504 1413 //memset: res>cf=NULL; 1505 1414 res>options=r>options; 1506 #ifdef HAVE_RINGS1507 res>cf>ringtype=r>cf>ringtype;1508 #endif1509 1415 // 1510 1416 if (r>algring!=NULL) … … 1512 1418 res>algring=r>algring; 1513 1419 //memset: res>minideal=NULL; 1514 if (r>cf>parameter!=NULL)1515 {1516 if (r>cf>minpoly!=NULL) res>cf>minpoly=n_Copy(r>cf>minpoly,r>cf);1517 int l=rPar(r);1518 res>cf>parameter=(char **)omAlloc(l*sizeof(char *));1519 int i;1520 for(i=0;i<rPar(r);i++)1521 {1522 res>cf>parameter[i]=omStrDup(r>cf>parameter[i]);1523 }1524 if (r>minideal!=NULL)1525 {1526 res>minideal=id_Copy(r>minideal,r>algring);1527 }1528 }1529 1420 if (copy_ordering == TRUE) 1530 1421 { … … 1794 1685 if (blocks == 1) return TRUE; 1795 1686 1796 int s = 0; 1687 int s = 0; 1797 1688 while( (s < blocks) && (r>order[s] == ringorder_IS) && (r>order[blocks1] == ringorder_IS) ) 1798 1689 { … … 1804 1695 1805 1696 assume( blocks == s + 2 ); 1806 1697 1807 1698 if ( 1808 1699 (r>order[s] != ringorder_c) … … 1869 1760 if (blocks == 1) return TRUE; 1870 1761 1871 int s = 0; 1762 int s = 0; 1872 1763 while( (s < blocks) && (r>order[s] == ringorder_IS) && (r>order[blocks1] == ringorder_IS) ) 1873 1764 { … … 1877 1768 1878 1769 if ((blocks  s) > 3) return FALSE; 1879 1770 1880 1771 // if ((blocks > 3)  (blocks < 2)) return FALSE; 1881 1772 if ((blocks  s) == 3) … … 2782 2673 ideal F = idrHeadR(r>typ[i].data.is.F, r, res); // Copy F from r into res! 2783 2674 assume( 2784 rSetISReference( res, 2675 rSetISReference( res, 2785 2676 F, // WILL BE COPIED! 2786 2677 r>typ[i].data.is.limit, … … 3152 3043 ( 3153 3044 ((order[1]==ringorder_c)(order[1]==ringorder_C) 3154 (order[1]==ringorder_S) 3045 (order[1]==ringorder_S) 3155 3046 (order[1]==ringorder_s)) 3156 3047 && (order[0]!=ringorder_M) … … 3243 3134 r>pFDeg = p_WTotaldegree; // may be improved: p_Totaldegree for lp/dp/ls/.. blocks 3244 3135 } 3245 3136 3246 3137 if (rOrd_is_Totaldegree_Ordering(r)  rOrd_is_WeightedDegree_Ordering(r)) 3247 3138 r>pFDeg = p_Deg; … … 4052 3943 #define pFDeg_CASE(A) if(r>pFDeg == A) PrintS( "" #A "" ) 4053 3944 Print("\npFDeg : "); 4054 3945 4055 3946 pFDeg_CASE(p_Totaldegree); else 4056 3947 pFDeg_CASE(p_WFirstTotalDegree); else … … 4058 3949 pFDeg_CASE(p_Deg); else 4059 3950 Print("(%p)", r>pFDeg); // default case 4060 3951 4061 3952 PrintS("\n"); 4062 3953 #undef pFDeg_CASE 4063 3954 } 4064 3955 4065 3956 } 4066 3957 … … 4191 4082 { 4192 4083 assume(r>typ[1].ord_typ == ro_syzcomp); 4193 4084 4194 4085 r>typ[1].data.syzcomp.length = length; 4195 4086 rNChangeSComps( currComponents, currShiftedComponents, r); … … 4201 4092 { 4202 4093 assume(r>typ[1].ord_typ == ro_syzcomp); 4203 4094 4204 4095 *length = r>typ[1].data.syzcomp.length; 4205 4096 rNGetSComps( currComponents, currShiftedComponents, r); … … 5441 5332 /* One must test C and D _only_ in r>GetNC()>basering!!! not in r!!! */ 5442 5333 5443 id_Test((ideal)C, dest); 5334 id_Test((ideal)C, dest); 5444 5335 id_Test((ideal)D, dest); 5445 5336
Note: See TracChangeset
for help on using the changeset viewer.