source: git/kernel/GBEngine/kpolys.cc @ 4c7632

fieker-DuValspielwiese
Last change on this file since 4c7632 was 9f7665, checked in by Oleksandr Motsak <motsak@…>, 10 years ago
Removed HAVE_CONFIG guards fix: fixed the inclusion of configure-generated *config.h's
  • Property mode set to 100644
File size: 3.2 KB
Line 
1
2
3
4#include <kernel/mod2.h>
5
6#include <omalloc/omalloc.h>
7#include <misc/auxiliary.h>
8
9#include <kernel/polys.h>
10
11
12/* Returns TRUE if
13     * LM(p) | LM(lcm)
14     * LC(p) | LC(lcm) only if ring
15     * Exists i, j:
16         * LE(p, i)  != LE(lcm, i)
17         * LE(p1, i) != LE(lcm, i)   ==> LCM(p1, p) != lcm
18         * LE(p, j)  != LE(lcm, j)
19         * LE(p2, j) != LE(lcm, j)   ==> LCM(p2, p) != lcm
20*/
21BOOLEAN pCompareChain (poly p,poly p1,poly p2,poly lcm, const ring R)
22{
23  int k, j;
24
25  if (lcm==NULL) return FALSE;
26
27  for (j=(R->N); j; j--)
28    if ( p_GetExp(p,j, R) >  p_GetExp(lcm,j, R)) return FALSE;
29  if ( pGetComp(p) !=  pGetComp(lcm)) return FALSE;
30  for (j=(R->N); j; j--)
31  {
32    if (p_GetExp(p1,j, R)!=p_GetExp(lcm,j, R))
33    {
34      if (p_GetExp(p,j, R)!=p_GetExp(lcm,j, R))
35      {
36        for (k=(R->N); k>j; k--)
37        {
38          if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
39          && (p_GetExp(p2,k, R)!=p_GetExp(lcm,k, R)))
40            return TRUE;
41        }
42        for (k=j-1; k; k--)
43        {
44          if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
45          && (p_GetExp(p2,k, R)!=p_GetExp(lcm,k, R)))
46            return TRUE;
47        }
48        return FALSE;
49      }
50    }
51    else if (p_GetExp(p2,j, R)!=p_GetExp(lcm,j, R))
52    {
53      if (p_GetExp(p,j, R)!=p_GetExp(lcm,j, R))
54      {
55        for (k=(R->N); k>j; k--)
56        {
57          if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
58          && (p_GetExp(p1,k, R)!=p_GetExp(lcm,k, R)))
59            return TRUE;
60        }
61        for (k=j-1; k!=0 ; k--)
62        {
63          if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
64          && (p_GetExp(p1,k, R)!=p_GetExp(lcm,k, R)))
65            return TRUE;
66        }
67        return FALSE;
68      }
69    }
70  }
71  return FALSE;
72}
73
74#ifdef HAVE_RATGRING
75BOOLEAN pCompareChainPart (poly p,poly p1,poly p2,poly lcm, const ring R)
76{
77  int k, j;
78
79  if (lcm==NULL) return FALSE;
80
81  for (j=R->real_var_end; j>=R->real_var_start; j--)
82    if ( p_GetExp(p,j, R) >  p_GetExp(lcm,j, R)) return FALSE;
83  if ( pGetComp(p) !=  pGetComp(lcm)) return FALSE;
84  for (j=R->real_var_end; j>=R->real_var_start; j--)
85  {
86    if (p_GetExp(p1,j, R)!=p_GetExp(lcm,j, R))
87    {
88      if (p_GetExp(p,j, R)!=p_GetExp(lcm,j, R))
89      {
90        for (k=(R->N); k>j; k--)
91        for (k=R->real_var_end; k>j; k--)
92        {
93          if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
94          && (p_GetExp(p2,k, R)!=p_GetExp(lcm,k, R)))
95            return TRUE;
96        }
97        for (k=j-1; k>=R->real_var_start; k--)
98        {
99          if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
100          && (p_GetExp(p2,k, R)!=p_GetExp(lcm,k, R)))
101            return TRUE;
102        }
103        return FALSE;
104      }
105    }
106    else if (p_GetExp(p2,j, R)!=p_GetExp(lcm,j, R))
107    {
108      if (p_GetExp(p,j, R)!=p_GetExp(lcm,j, R))
109      {
110        for (k=R->real_var_end; k>j; k--)
111        {
112          if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
113          && (p_GetExp(p1,k, R)!=p_GetExp(lcm,k, R)))
114            return TRUE;
115        }
116        for (k=j-1; k>=R->real_var_start; k--)
117        {
118          if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
119          && (p_GetExp(p1,k, R)!=p_GetExp(lcm,k, R)))
120            return TRUE;
121        }
122        return FALSE;
123      }
124    }
125  }
126  return FALSE;
127}
128#endif
129
Note: See TracBrowser for help on using the repository browser.