Changeset 4a2260e in git
- Timestamp:
- May 19, 2011, 4:45:26 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '7725b5cfc1eaf99630826ecc59f559d3b6831c24')
- Children:
- 37c7fc12531c0affe2e7abfce3be0590304fc0da
- Parents:
- c28ecf1b368527a9ec9e39a3db43a7b75040f036
- git-author:
- Frank Seelisch <seelisch@mathematik.uni-kl.de>2011-05-19 16:45:26+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:36:13+01:00
- Location:
- libpolys
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/coeffs/longrat.cc
rc28ecf r4a2260e 211 211 return TRUE; 212 212 } 213 omCheckIf(omCheckAddrSize(a,sizeof(*a)), return FALSE); 213 /* TODO: If next line is active, then computations in algebraic field 214 extensions over Q will throw a lot of assume violations although 215 everything is computed correctly and no seg fault appears. 216 Maybe the test is not appropriate in this case. */ 217 //omCheckIf(omCheckAddrSize(a,sizeof(*a)), return FALSE); 214 218 if (a->debug!=123456) 215 219 { -
libpolys/polys/ext_fields/algext.cc
rc28ecf r4a2260e 81 81 #endif 82 82 83 void heuristicReduce(poly p, poly reducer, const coeffs cf);84 void definiteReduce(poly p, poly reducer, const coeffs cf);83 void heuristicReduce(poly &p, poly reducer, const coeffs cf); 84 void definiteReduce(poly &p, poly reducer, const coeffs cf); 85 85 86 86 BOOLEAN naIsZero(number a, const coeffs cf) … … 336 336 the decision is made based on the following heuristic 337 337 (which should also only be changed here in this method): 338 if (deg(p) > 10*deg(reducer) then perform reduction */ 339 void heuristicReduce(poly p, poly reducer, const coeffs cf) 338 if (deg(p) > 10*deg(reducer) then perform reduction; 339 modifies p */ 340 void heuristicReduce(poly &p, poly reducer, const coeffs cf) 340 341 { 341 342 #ifdef LDEBUG … … 425 426 426 427 /* performs polynomial division and overrides p by the remainder 427 of division of p by the reducer */ 428 void definiteReduce(poly p, poly reducer, const coeffs cf) 428 of division of p by the reducer; 429 modifies p */ 430 void definiteReduce(poly &p, poly reducer, const coeffs cf) 429 431 { 430 432 #ifdef LDEBUG … … 448 450 poly aFactor = NULL; poly mFactor = NULL; 449 451 poly theGcd = p_ExtGcd((poly)a, aFactor, naMinpoly, mFactor, naRing); 452 naTest((number)theGcd); naTest((number)aFactor); naTest((number)mFactor); 450 453 /* the gcd must be 1 since naMinpoly is irreducible and a != NULL: */ 451 454 assume(naIsOne((number)theGcd, cf)); -
libpolys/polys/monomials/p_polys.cc
rc28ecf r4a2260e 1462 1462 p_SetExp(t, 1, e, r); 1463 1463 p_Setm(t, r); 1464 //printf("t\n"); 1465 //p_Write(t, r); 1464 1466 if (needResult) result = p_Add_q(result, p_Copy(t, r), r); 1465 1467 p = p_Add_q(p, p_Neg(p_Mult_q(t, p_Copy(divisor, r), r), r), r); 1466 } 1467 n_Delete(&divisorLC, r->cf); 1468 //printf("p_PolyDiv result:\n"); 1469 //p_Write(result, r); 1468 //printf("p\n"); 1469 //p_Write(p, r); 1470 } 1470 1471 return result; 1471 1472 } … … 1543 1544 pFactor = p_ISet(1, r); 1544 1545 number n = p_GetCoeff(pFactor, r); 1546 //printf("p_ExtGcdHelper0:\n"); 1547 //p_Write(p, r); 1545 1548 p_SetCoeff(pFactor, n_Invers(p_GetCoeff(p, r), r->cf), r); 1546 1549 n_Delete(&n, r->cf); -
libpolys/tests/polys_test.h
rc28ecf r4a2260e 209 209 { 210 210 private: 211 void checkInverse(number n, const coeffs cf) 212 { 213 clog << "n = "; n_Write(n, cf); 214 number n1 = n_Invers(n, cf); 215 clog << "==> n^(-1) = "; n_Write(n1, cf); 216 number n2 = n_Mult(n, n1, cf); 217 clog << "(check: n * n^(-1) = "; n_Write(n2, cf); 218 n_Delete(&n1, cf); n_Delete(&n2, cf); 219 } 211 220 void TestArithCf(const coeffs r) 212 221 { … … 592 601 593 602 Test(s); 603 604 clog << endl 605 << "Now let's compute some inverses in Q[a]/<a2+1>..." 606 << endl; 607 608 number a = n_Par(1, cf); 609 number n1 = n_Init(1, cf); 610 number n5 = n_Init(5, cf); 611 number n17 = n_Init(17, cf); 612 number u; number v; 613 614 u = n_Add(a, n1, cf); checkInverse(u, cf); n_Delete(&u, cf); // a + 1 615 u = n_Sub(a, n1, cf); checkInverse(u, cf); n_Delete(&u, cf); // a - 1 616 u = n_Add(a, n5, cf); checkInverse(u, cf); n_Delete(&u, cf); // a + 5 617 u = n_Sub(a, n5, cf); checkInverse(u, cf); n_Delete(&u, cf); // a - 5 618 v = n_Mult(a, n17, cf); 619 u = n_Add(v, n5, cf); n_Delete(&v, cf); // 17a + 5 620 checkInverse(u, cf); n_Delete(&u, cf); 621 622 n_Delete(&a, cf); n_Delete(&n1, cf); n_Delete(&n5, cf); 623 n_Delete(&n17, cf); 594 624 595 625 rDelete(s); // kills 'cf' and 'r' as well
Note: See TracChangeset
for help on using the changeset viewer.