Changeset 5948a8 in git for libpolys/polys/monomials


Ignore:
Timestamp:
Mar 30, 2011, 4:50:13 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
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
Message:
FIX: moving stuff around in order to fix inlines/declarations problems
Location:
libpolys/polys/monomials
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/monomials/monomials.h

    r0ceb74 r5948a8  
    2727  unsigned long exp[1];     // make sure that exp is aligned
    2828};
    29 
    30 
    31 /***************************************************************
    32  *
    33  * Macros for access/iteration
    34  *
    35  ***************************************************************/
    36 // #define pNext(p)           ((p)->next)
    37 // #define pIter(p)           ((p) = (p)->next)
    38 
    39 // coeff
    40 //#define pGetCoeff(p)       ((p)->coef)
    41 //#define pSetCoeff0(p,n)    (p)->coef=n
    42 
    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))
    4529
    4630/***************************************************************
  • libpolys/polys/monomials/p_polys.h

    r0ceb74 r5948a8  
    3737#define p_SetCoeff0(p,n,r)  pSetCoeff0(p,n)
    3838
     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
    3942/***************************************************************
    4043 *
     
    115118
    116119poly      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
     129BOOLEAN pIsMonomOf(poly p, poly m);
     130// Returns TRUE if p and q have common monoms
     131BOOLEAN 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
     137BOOLEAN p_LmCheckIsFromRing(poly p, ring r);
     138// check if Lm(p) != NULL, r != NULL and initialized && Lm(p) is from r
     139BOOLEAN p_LmCheckPolyRing(poly p, ring r);
     140// check if all monoms of p are from ring r
     141BOOLEAN p_CheckIsFromRing(poly p, ring r);
     142// check r != NULL and initialized && all monoms of p are from r
     143BOOLEAN p_CheckPolyRing(poly p, ring r);
     144// check if r != NULL and initialized
     145BOOLEAN p_CheckRing(ring r);
     146// only do check if cond
     147
     148
     149#define pIfThen(cond, check) do {if (cond) {check;}} while (0)
     150
     151BOOLEAN _p_Test(poly p, ring r, int level);
     152BOOLEAN _p_LmTest(poly p, ring r, int level);
     153BOOLEAN _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
    117176/***************************************************************
    118177 *
     
    324383
    325384long 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
    379386
    380387/***************************************************************
     
    438445  return __p_GetComp(p,r) -= v;
    439446}
    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 }
    454447
    455448#ifndef HAVE_EXPSIZES
     
    582575}
    583576
    584 
    585 
    586 
    587 
    588577// the following should be implemented more efficiently
    589578static inline  long p_IncrExp(poly p, int v, ring r)
     
    634623{
    635624  return p_GetExp(p1,i,r) - p_GetExp(p2,i,r);
     625}
     626
     627static 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;
    636640}
    637641
Note: See TracChangeset for help on using the changeset viewer.