Changeset 5948a8 in git
- Timestamp:
- Mar 30, 2011, 4:50:13 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- bb6c8a5b9ffdd315338acd9b7d6eb2fd40522955
- Parents:
- 0ceb74fb301333567c3206509584432bc130b144
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-03-30 16:50:13+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:04:15+01:00
- Location:
- libpolys/polys
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/monomials/monomials.h
r0ceb74 r5948a8 27 27 unsigned long exp[1]; // make sure that exp is aligned 28 28 }; 29 30 31 /***************************************************************32 *33 * Macros for access/iteration34 *35 ***************************************************************/36 // #define pNext(p) ((p)->next)37 // #define pIter(p) ((p) = (p)->next)38 39 // coeff40 //#define pGetCoeff(p) ((p)->coef)41 //#define pSetCoeff0(p,n) (p)->coef=n42 43 #define __p_GetComp(p, r) (p)->exp[r->pCompIndex]44 #define p_GetComp(p, r) ((long) (r->pCompIndex >= 0 ? __p_GetComp(p, r) : 0))45 29 46 30 /*************************************************************** -
libpolys/polys/monomials/p_polys.h
r0ceb74 r5948a8 37 37 #define p_SetCoeff0(p,n,r) pSetCoeff0(p,n) 38 38 39 #define __p_GetComp(p, r) (p)->exp[r->pCompIndex] 40 #define p_GetComp(p, r) ((long) (r->pCompIndex >= 0 ? __p_GetComp(p, r) : 0)) 41 39 42 /*************************************************************** 40 43 * … … 115 118 116 119 poly p_Power(poly p, int i, const ring r); 120 121 122 /*************************************************************** 123 * 124 * PDEBUG stuff 125 * 126 ***************************************************************/ 127 #ifdef PDEBUG 128 // Returns TRUE if m is monom of p, FALSE otherwise 129 BOOLEAN pIsMonomOf(poly p, poly m); 130 // Returns TRUE if p and q have common monoms 131 BOOLEAN pHaveCommonMonoms(poly p, poly q); 132 133 // p_Check* routines return TRUE if everything is ok, 134 // else, they report error message and return false 135 136 // check if Lm(p) is from ring r 137 BOOLEAN p_LmCheckIsFromRing(poly p, ring r); 138 // check if Lm(p) != NULL, r != NULL and initialized && Lm(p) is from r 139 BOOLEAN p_LmCheckPolyRing(poly p, ring r); 140 // check if all monoms of p are from ring r 141 BOOLEAN p_CheckIsFromRing(poly p, ring r); 142 // check r != NULL and initialized && all monoms of p are from r 143 BOOLEAN p_CheckPolyRing(poly p, ring r); 144 // check if r != NULL and initialized 145 BOOLEAN p_CheckRing(ring r); 146 // only do check if cond 147 148 149 #define pIfThen(cond, check) do {if (cond) {check;}} while (0) 150 151 BOOLEAN _p_Test(poly p, ring r, int level); 152 BOOLEAN _p_LmTest(poly p, ring r, int level); 153 BOOLEAN _pp_Test(poly p, ring lmRing, ring tailRing, int level); 154 155 #define p_Test(p,r) _p_Test(p, r, PDEBUG) 156 #define p_LmTest(p,r) _p_LmTest(p, r, PDEBUG) 157 #define pp_Test(p, lmRing, tailRing) _pp_Test(p, lmRing, tailRing, PDEBUG) 158 159 #else // ! PDEBUG 160 161 #define pIsMonomOf(p, q) (TRUE) 162 #define pHaveCommonMonoms(p, q) (TRUE) 163 #define p_LmCheckIsFromRing(p,r) ((void)0) 164 #define p_LmCheckPolyRing(p,r) ((void)0) 165 #define p_CheckIsFromRing(p,r) ((void)0) 166 #define p_CheckPolyRing(p,r) ((void)0) 167 #define p_CheckRing(r) ((void)0) 168 #define P_CheckIf(cond, check) ((void)0) 169 170 #define p_Test(p,r) (1) 171 #define p_LmTest(p,r) (1) 172 #define pp_Test(p, lmRing, tailRing) (1) 173 174 #endif 175 117 176 /*************************************************************** 118 177 * … … 324 383 325 384 long p_Deg(poly a, const ring r); 326 /*************************************************************** 327 * 328 * PDEBUG stuff 329 * 330 ***************************************************************/ 331 #ifdef PDEBUG 332 // Returns TRUE if m is monom of p, FALSE otherwise 333 BOOLEAN pIsMonomOf(poly p, poly m); 334 // Returns TRUE if p and q have common monoms 335 BOOLEAN pHaveCommonMonoms(poly p, poly q); 336 337 // p_Check* routines return TRUE if everything is ok, 338 // else, they report error message and return false 339 340 // check if Lm(p) is from ring r 341 BOOLEAN p_LmCheckIsFromRing(poly p, ring r); 342 // check if Lm(p) != NULL, r != NULL and initialized && Lm(p) is from r 343 BOOLEAN p_LmCheckPolyRing(poly p, ring r); 344 // check if all monoms of p are from ring r 345 BOOLEAN p_CheckIsFromRing(poly p, ring r); 346 // check r != NULL and initialized && all monoms of p are from r 347 BOOLEAN p_CheckPolyRing(poly p, ring r); 348 // check if r != NULL and initialized 349 BOOLEAN p_CheckRing(ring r); 350 // only do check if cond 351 352 353 #define pIfThen(cond, check) do {if (cond) {check;}} while (0) 354 355 BOOLEAN _p_Test(poly p, ring r, int level); 356 BOOLEAN _p_LmTest(poly p, ring r, int level); 357 BOOLEAN _pp_Test(poly p, ring lmRing, ring tailRing, int level); 358 359 #define p_Test(p,r) _p_Test(p, r, PDEBUG) 360 #define p_LmTest(p,r) _p_LmTest(p, r, PDEBUG) 361 #define pp_Test(p, lmRing, tailRing) _pp_Test(p, lmRing, tailRing, PDEBUG) 362 363 #else // ! PDEBUG 364 365 #define pIsMonomOf(p, q) (TRUE) 366 #define pHaveCommonMonoms(p, q) (TRUE) 367 #define p_LmCheckIsFromRing(p,r) ((void)0) 368 #define p_LmCheckPolyRing(p,r) ((void)0) 369 #define p_CheckIsFromRing(p,r) ((void)0) 370 #define p_CheckPolyRing(p,r) ((void)0) 371 #define p_CheckRing(r) ((void)0) 372 #define P_CheckIf(cond, check) ((void)0) 373 374 #define p_Test(p,r) (1) 375 #define p_LmTest(p,r) (1) 376 #define pp_Test(p, lmRing, tailRing) (1) 377 378 #endif 385 379 386 380 387 /*************************************************************** … … 438 445 return __p_GetComp(p,r) -= v; 439 446 } 440 static inline int p_Comp_k_n(poly a, poly b, int k, ring r)441 {442 if ((a==NULL) || (b==NULL) ) return FALSE;443 p_LmCheckPolyRing2(a, r);444 p_LmCheckPolyRing2(b, r);445 pAssume2(k > 0 && k <= r->N);446 int i=k;447 for(;i<=r->N;i++)448 {449 if (p_GetExp(a,i,r) != p_GetExp(b,i,r)) return FALSE;450 // if (a->exp[(r->VarOffset[i] & 0xffffff)] != b->exp[(r->VarOffset[i] & 0xffffff)]) return FALSE;451 }452 return TRUE;453 }454 447 455 448 #ifndef HAVE_EXPSIZES … … 582 575 } 583 576 584 585 586 587 588 577 // the following should be implemented more efficiently 589 578 static inline long p_IncrExp(poly p, int v, ring r) … … 634 623 { 635 624 return p_GetExp(p1,i,r) - p_GetExp(p2,i,r); 625 } 626 627 static inline int p_Comp_k_n(poly a, poly b, int k, ring r) 628 { 629 if ((a==NULL) || (b==NULL) ) return FALSE; 630 p_LmCheckPolyRing2(a, r); 631 p_LmCheckPolyRing2(b, r); 632 pAssume2(k > 0 && k <= r->N); 633 int i=k; 634 for(;i<=r->N;i++) 635 { 636 if (p_GetExp(a,i,r) != p_GetExp(b,i,r)) return FALSE; 637 // if (a->exp[(r->VarOffset[i] & 0xffffff)] != b->exp[(r->VarOffset[i] & 0xffffff)]) return FALSE; 638 } 639 return TRUE; 636 640 } 637 641 -
libpolys/polys/polys.h
r0ceb74 r5948a8 18 18 * 19 19 ***************************************************************/ 20 /* 20 21 // deletes old coeff before setting the new one 21 22 #define pSetCoeff(p,n) p_SetCoeff(p,n,currRing) … … 38 39 #define pGetExpSum(p1, p2, i) p_GetExpSum(p1, p2, i, currRing) 39 40 #define pGetExpDiff(p1, p2, i) p_GetExpDiff(p1, p2, i, currRing) 41 */ 40 42 41 43 /***************************************************************
Note: See TracChangeset
for help on using the changeset viewer.