Changeset fc2acf in git
- Timestamp:
- Jul 8, 2015, 5:21:19 PM (8 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 3f2942fb2df02ef47a6e1125188f5c588a05e8d2
- Parents:
- f0e1f60636ea63dea4a25bf2abff929dd68198db
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2015-07-08 17:21:19+02:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2015-07-08 17:22:49+02:00
- Location:
- libpolys
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/coeffs/longrat.h
rf0e1f6 rfc2acf 72 72 73 73 /// only used by slimgb (tgb.cc) 74 static inlineint nlQlogSize (number n, const coeffs r)74 static FORCE_INLINE int nlQlogSize (number n, const coeffs r) 75 75 { 76 76 assume( nCoeff_is_Q (r) ); … … 97 97 98 98 99 static FORCE_INLINE BOOLEAN nlIsInteger(number q, const coeffs r) 100 { 101 assume( nCoeff_is_Q (r) ); 102 n_Test(q, r); 103 104 if (SR_HDL(q) & SR_INT) 105 return 1; // immidiate int 106 107 if( q->s == 3 ) 108 { 109 assume( q->n == NULL ); 110 return 1; // integer with n==NULL 111 } 112 113 number qq = n_Copy(q, r); 114 number nn = n_GetDenom(qq, r); 115 116 const BOOLEAN ret = n_IsOne(nn, r); 117 118 n_Delete( &nn, r); 119 n_Delete( &qq, r); 120 121 return ret; 122 } 123 99 124 number nlModP(number q, const coeffs Q, const coeffs Zp); 100 125 void nlNormalize(number &x, const coeffs r); -
libpolys/coeffs/modulop.cc
rf0e1f6 rfc2acf 46 46 void npCoeffWrite (const coeffs r, BOOLEAN details); 47 47 const char * npRead (const char *s, number *a,const coeffs r); 48 48 49 #ifdef LDEBUG 49 50 BOOLEAN npDBTest (number a, const char *f, const int l, const coeffs r); 50 #define npTest(A,r) npDBTest(A,__FILE__,__LINE__, r)51 #else52 #define npTest(A,r) (0)53 51 #endif 54 52 -
libpolys/polys/ext_fields/transext.cc
rf0e1f6 rfc2acf 72 72 73 73 #ifdef LDEBUG 74 #define ntTest(a) ntDBTest(a,__FILE__,__LINE__,cf)75 74 BOOLEAN ntDBTest(number a, const char *f, const int l, const coeffs r); 76 #else77 #define ntTest(a) do {} while (0)78 75 #endif 76 77 #define ntTest(a) n_Test(a, cf) 79 78 80 79 /// Our own type! … … 184 183 //check_N(a,cf); 185 184 const poly num = NUM(t); 186 assume(num != NULL); / **< t != 0 ==> numerator(t) != 0 */185 assume(num != NULL); ///< t != 0 ==> numerator(t) != 0 187 186 188 187 p_Test(num, ntRing); 189 188 189 if (getCoeffType(ntCoeffs)==n_Q) 190 for( poly p = num; p != NULL; pIter(p) ) 191 if (! nlIsInteger( p_GetCoeff(p, ntRing), ntCoeffs) ) 192 { 193 Print("ERROR: non-integer Q coeff in num. poly in %s:%d\n",f,l); 194 return FALSE; 195 } 196 190 197 const poly den = DEN(t); 191 198 … … 193 200 { 194 201 p_Test(den, ntRing); 202 203 if (getCoeffType(ntCoeffs)==n_Q) 204 for( poly p = den; p != NULL; pIter(p) ) 205 if (! nlIsInteger( p_GetCoeff(p, ntRing), ntCoeffs) ) 206 { 207 Print("ERROR: non-integer Q coeff in den. poly in %s:%d\n",f,l); 208 return FALSE; 209 } 210 211 if (getCoeffType(ntCoeffs)==n_Zp) 212 { 213 if( p_IsConstant(den, ntRing) ) 214 { 215 Print("ERROR: constant den. poly / Zp in %s:%d\n",f,l); 216 return FALSE; 217 } 218 219 if( !n_IsOne(pGetCoeff(den), ntCoeffs) ) 220 { 221 Print("ERROR: non-monic den. poly / Zp in %s:%d\n",f,l); 222 return FALSE; 223 } 224 } 225 226 poly gcd = singclap_gcd_r( num, den, ntRing ); 227 228 if( !(p_IsConstant(gcd, ntRing) && (n_IsOne(pGetCoeff(gcd), ntCoeffs))) ) 229 { 230 Print("ERROR: 1 != GCD between num. & den. poly in %s:%d\n",f,l); 231 return FALSE; 232 } 233 234 p_Delete( &gcd, ntRing ); 235 236 return TRUE; 237 238 239 195 240 if(p_IsConstant(den, ntRing) && (n_IsOne(pGetCoeff(den), ntCoeffs))) 196 241 { … … 206 251 } 207 252 else 208 { // num != NULL // den == NULL 253 { 254 return TRUE; 255 256 // num != NULL // den == NULL 209 257 // if( COM(t) != 0 ) 210 258 // { … … 279 327 //check_N(*a,cf); 280 328 ntTest(*a); // !!! 329 281 330 fraction f = (fraction)(*a); 282 331 if (IS0(f)) return; … … 580 629 if (p == NULL) return NULL; 581 630 631 p_Test( p, ntRing); 582 632 fraction f = (fraction)omAlloc0Bin(fractionObjectBin); 583 633 … … 792 842 COM(result) = COM(fa); 793 843 //check_N((number)result,cf); 844 ntTest((number)result); 794 845 return (number)result; 795 846 } … … 804 855 805 856 //check_N((number)result,cf); 857 ntTest((number)result); 806 858 return (number)result; 807 859 } … … 845 897 846 898 //check_N((number)result,cf); 899 ntTest((number)result); 847 900 return (number)result; 848 901 } … … 883 936 // ntTest((number)result); 884 937 //check_N((number)result,cf); 938 ntTest((number)result); 885 939 return (number)result; 886 940 } … … 953 1007 954 1008 //check_N((number)result,cf); 1009 ntTest((number)result); 955 1010 return (number)result; 956 1011 } … … 992 1047 // ntTest((number)result); 993 1048 //check_N((number)result,cf); 1049 ntTest((number)result); 994 1050 return (number)result; 995 1051 } … … 1242 1298 BOOLEAN simpleTestsHaveAlreadyBeenPerformed) 1243 1299 { 1244 ntTest(a); // !!!!1300 // ntTest(a); // !!!! 1245 1301 1246 1302 fraction f = (fraction)a; 1247 1303 1248 1304 if (IS0(a)) return; 1249 if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; return; }1305 if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; ntTest(a); return; } 1250 1306 if (!simpleTestsHaveAlreadyBeenPerformed) 1251 1307 { … … 1442 1498 if (p == NULL) *a = NULL; 1443 1499 else *a = ntInit(p, cf); 1500 ntTest(*a); 1444 1501 return result; 1445 1502 } … … 1570 1627 return (number)result; 1571 1628 1572 return NULL;1629 return NULL; 1573 1630 } 1574 1631 … … 1748 1805 number ntMap00(number a, const coeffs src, const coeffs dst) 1749 1806 { 1807 n_Test(a, src); 1808 1750 1809 if (n_IsZero(a, src)) return NULL; 1751 n_Test(a, src);1752 1810 assume(src->rep == dst->extRing->cf->rep); 1753 1811 if ((SR_HDL(a) & SR_INT) || (a->s==3)) 1754 1812 { 1755 1813 number res=ntInit(p_NSet(n_Copy(a, src), dst->extRing), dst); 1756 n_Test(res, dst);1814 n_Test(res, dst); 1757 1815 return res; 1758 1816 } … … 1763 1821 if (n_IsOne(nn,src)) DEN(ff)=NULL; 1764 1822 else DEN(ff)=p_NSet(nn,dst->extRing); 1823 1765 1824 n_Test((number)ff,dst); 1766 1825 //check_N((number)ff,dst); … … 1770 1829 number ntMapZ0(number a, const coeffs src, const coeffs dst) 1771 1830 { 1831 n_Test(a, src); 1772 1832 if (n_IsZero(a, src)) return NULL; 1773 n_Test(a, src);1774 1833 nMapFunc nMap=n_SetMap(src,dst->extRing->cf); 1775 1834 poly p=p_NSet(nMap(a, src,dst->extRing->cf), dst->extRing); … … 1784 1843 number ntMapP0(number a, const coeffs src, const coeffs dst) 1785 1844 { 1845 n_Test(a, src); 1786 1846 if (n_IsZero(a, src)) return NULL; 1787 n_Test(a, src);1788 1847 /* mapping via intermediate int: */ 1789 1848 int n = n_Int(a, src); … … 2380 2439 { 2381 2440 fraction result = (fraction)omAlloc0Bin(fractionObjectBin); 2382 int i;2383 2441 2384 2442 poly *P=(poly*)omAlloc(rl*sizeof(poly*)); 2385 2443 number *X=(number *)omAlloc(rl*sizeof(number)); 2444 2445 int i; 2386 2446 2387 2447 for(i=0;i<rl;i++) P[i]=p_Copy(NUM((fraction)(x[i])),cf->extRing); … … 2402 2462 p_Delete(&DEN(result),ntRing); 2403 2463 } 2464 ntTest((number)result); 2404 2465 return ((number)result); 2405 2466 } … … 2411 2472 NUM(result)=p_Farey(p_Copy(NUM((fraction)p),cf->extRing),n,cf->extRing); 2412 2473 DEN(result)=p_Farey(p_Copy(DEN((fraction)p),cf->extRing),n,cf->extRing); 2474 ntTest((number)result); 2413 2475 return ((number)result); 2414 2476 }
Note: See TracChangeset
for help on using the changeset viewer.