source: git/dyn_modules/callgfanlib/singularWishlist.h @ 88c726

spielwiese
Last change on this file since 88c726 was 88c726, checked in by Yue Ren <ren@…>, 10 years ago
new: initialReduction(ideal I)
  • Property mode set to 100644
File size: 1.6 KB
Line 
1#ifndef SINGULARWISHLIST_H
2#define SINGULARWISHLIST_H
3
4#include <libpolys/polys/monomials/p_polys.h>
5
6static inline BOOLEAN _p_LeadmonomDivisibleByNoComp(poly a, poly b, const ring r)
7{
8  int i=r->VarL_Size - 1;
9  unsigned long divmask = r->divmask;
10  unsigned long la, lb;
11
12  if (r->VarL_LowIndex >= 0)
13  {
14    i += r->VarL_LowIndex;
15    do
16    {
17      la = a->exp[i];
18      lb = b->exp[i];
19      if ((la > lb) ||
20          (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask)))
21      {
22        pDivAssume(p_DebugLmDivisibleByNoComp(a, b, r) == FALSE);
23        return FALSE;
24      }
25      i--;
26    }
27    while (i>=r->VarL_LowIndex);
28  }
29  else
30  {
31    do
32    {
33      la = a->exp[r->VarL_Offset[i]];
34      lb = b->exp[r->VarL_Offset[i]];
35      if ((la > lb) ||
36          (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask)))
37      {
38        pDivAssume(p_DebugLmDivisibleByNoComp(a, b, r) == FALSE);
39        return FALSE;
40      }
41      i--;
42    }
43    while (i>=0);
44  }
45  pDivAssume(p_DebugLmDivisibleByNoComp(a, b, r) == TRUE);
46  return TRUE;
47}
48
49static inline BOOLEAN p_LeadmonomDivisibleBy(poly a, poly b, const ring r)
50{
51  p_LmCheckPolyRing1(b, r);
52
53  pIfThen1(a != NULL, p_LmCheckPolyRing1(b, r));
54  if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
55    return _p_LeadmonomDivisibleByNoComp(a, b, r);
56  return FALSE;
57}
58
59inline void idShallowDelete (ideal *h)
60{
61  int j,elems;
62  if (*h == NULL)
63    return;
64  elems=j=(*h)->nrows*(*h)->ncols;
65  if (j>0)
66    omFreeSize((ADDRESS)((*h)->m),sizeof(poly)*elems);
67  omFreeBin((ADDRESS)*h, sip_sideal_bin);
68  *h=NULL;
69}
70
71#endif
Note: See TracBrowser for help on using the repository browser.