Changeset e5422d in git
- Timestamp:
- Apr 19, 2011, 6:16:27 PM (12 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 7f602bf34cba1848ae22dbe21a65ea4f2460604f
- Parents:
- 8c99125adf3766ea3c93c4198e3f4aeed1b29b5f
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-04-19 18:16:27+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:31:20+01:00
- Location:
- libpolys
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/coeffs/numbers.cc
r8c9912 re5422d 66 66 } 67 67 #endif 68 69 70 BOOLEAN ndIsZeroDivisor( number a, const coeffs r) 71 { 72 int c = n_GetChar(r); 73 BOOLEAN ret = n_IsZero(a, r); 74 if( (c != 0) && !ret ) 75 { 76 number ch = n_Init( c, r ); 77 number g = n_Gcd( ch, a, r ); 78 ret = !n_IsOne (g, r); 79 n_Delete(&ch, r); 80 n_Delete(&g, r); 81 } 82 return ret; 83 } 68 84 69 85 void ndNormalize(number& d, const coeffs r) { } -
libpolys/coeffs/numbers.h
r8c9912 re5422d 70 70 void ndInpAdd(number &a, number b, const coeffs r); 71 71 72 /// Test whether a is a zero divisor in r 73 /// i.e. not coprime with char. of r 74 BOOLEAN ndIsZeroDivisor( number a, const coeffs r); 75 72 76 #ifdef LDEBUG 73 77 void nDBDummy1(number* d,char *f, int l); -
libpolys/coeffs/rmodulo2m.cc
r8c9912 re5422d 244 244 BOOLEAN nr2mEqual(number a, number b, const coeffs r) 245 245 { 246 return a == b;246 return (a == b); 247 247 } 248 248 … … 623 623 r->mod2mMask = 3; /* i.e., '11' in binary representation */ 624 624 } 625 r->ch = r->mod2mMask + 1; 625 626 } 626 627 -
libpolys/tests/coeffs_test.h
r8c9912 re5422d 39 39 40 40 number sum1 = n_Init(ssss, r); 41 clog<< " sum1(int): "; PrintSized(sum1, r);41 clog<< "N*(N+1)/2 (int: " << ssss << "): "; PrintSized(sum1, r); 42 42 43 43 number s, ss, i, res; … … 48 48 n_Delete(&i, r); 49 49 50 clog<< "N*(N+1): ("<< N*(N+1) << ")"; PrintSized(s, r); 51 50 52 i = n_Init(2, r); 53 clog<< "2: "; PrintSized(i, r); 51 54 52 55 if( !n_IsZero( i, r) ) … … 55 58 res = n_Div(s, i, r); 56 59 57 clog<< "res: "; PrintSized(res, r); 58 59 TS_ASSERT( n_Equal(sum1, res, r) ); 60 TS_ASSERT( n_Equal(res, sum1, r) ); 60 clog<< "N*(N+1)/2: "; PrintSized(res, r); 61 number d = n_Sub(res, sum1, r); 62 63 TS_ASSERT( ndIsZeroDivisor(d, r) ); 64 65 if( n_GetChar(r) == 0 ) 66 { 67 TS_ASSERT( n_Equal(sum1, res, r) ); 68 TS_ASSERT( n_Equal(res, sum1, r) ); 69 } 61 70 } else 62 71 TS_ASSERT_EQUALS( n_GetChar(r), 2); … … 82 91 83 92 ss = n_Neg(ss, r); // ss = -ss 84 85 93 94 clog<< "real sum : "; PrintSized(s, r); 95 clog<< "real sum(--): "; PrintSized(ss, r); 96 86 97 TS_ASSERT( n_Equal(s, ss, r) ); 87 98 TS_ASSERT( n_Equal(ss, s, r) ); 88 99 89 clog<< "s: "; PrintSized(s, r);90 clog<< "ss: "; PrintSized(ss, r);91 92 100 n_Delete(&s, r); 93 101 n_Delete(&ss, r); 102 103 clog << ( " >>> TEST DONE!" ); 104 clog << endl; 105 94 106 } 95 107 … … 161 173 n_Delete(&aa1, r); 162 174 n_Delete(&aa2, r); 175 176 177 clog << ( " >>> TEST DONE!" ); 178 clog << endl; 179 163 180 } 164 181 … … 212 229 TS_ASSERT( nCoeff_is_Q( r )); 213 230 TS_ASSERT( nCoeff_is_Domain( r )); 214 TS_ASSERT( nCoeff_has_Units( r )); 215 TS_ASSERT( nCoeff_has_simple_inverse( r ));// ? 216 TS_ASSERT( nCoeff_has_simple_Alloc( r )); // ? 231 232 TS_ASSERT( !nCoeff_has_Units( r )); // ? 233 TS_ASSERT( !nCoeff_has_simple_inverse( r ));// ? 234 TS_ASSERT( !nCoeff_has_simple_Alloc( r )); // ? 217 235 218 236 TS_ASSERT( !nCoeff_is_Ring_2toM( r )); … … 291 309 292 310 TestArith( r ); 311 TestSum( r, 10 ); 293 312 TestSum( r, 100 ); 294 TestSum( r, 1000 ); 313 TestSum( r, 101 ); 314 TestSum( r, 1001 ); 315 TestSum( r, 9000 ); 295 316 296 317 nKillChar( r ); 297 298 clog << ( " >>> TEST DONE!" );299 clog << endl;300 318 301 319 return TRUE;
Note: See TracChangeset
for help on using the changeset viewer.