source: git/kernel/kpolys.cc @ fbc7cb

spielwiese
Last change on this file since fbc7cb was ba5e9e, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
Changed configure-scripts to generate individual public config files for each package: resources, libpolys, singular (main) fix: sources should include correct corresponding config headers.
  • Property mode set to 100644
File size: 3.2 KB
Line 
1#ifdef HAVE_CONFIG_H
2#include "singularconfig.h"
3#endif /* HAVE_CONFIG_H */
4#include "mod2.h"
5
6#include <omalloc/omalloc.h>
7#include <misc/auxiliary.h>
8
9#include "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#ifdef HAVE_RATGRING
74BOOLEAN pCompareChainPart (poly p,poly p1,poly p2,poly lcm, const ring R)
75{
76  int k, j;
77
78  if (lcm==NULL) return FALSE;
79
80  for (j=R->real_var_end; j>=R->real_var_start; j--)
81    if ( p_GetExp(p,j, R) >  p_GetExp(lcm,j, R)) return FALSE;
82  if ( pGetComp(p) !=  pGetComp(lcm)) return FALSE;
83  for (j=R->real_var_end; j>=R->real_var_start; j--)
84  {
85    if (p_GetExp(p1,j, R)!=p_GetExp(lcm,j, R))
86    {
87      if (p_GetExp(p,j, R)!=p_GetExp(lcm,j, R))
88      {
89        for (k=(R->N); k>j; k--)
90        for (k=R->real_var_end; k>j; k--)
91        {
92          if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
93          && (p_GetExp(p2,k, R)!=p_GetExp(lcm,k, R)))
94            return TRUE;
95        }
96        for (k=j-1; k>=R->real_var_start; k--)
97        {
98          if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
99          && (p_GetExp(p2,k, R)!=p_GetExp(lcm,k, R)))
100            return TRUE;
101        }
102        return FALSE;
103      }
104    }
105    else if (p_GetExp(p2,j, R)!=p_GetExp(lcm,j, R))
106    {
107      if (p_GetExp(p,j, R)!=p_GetExp(lcm,j, R))
108      {
109        for (k=R->real_var_end; k>j; k--)
110        {
111          if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
112          && (p_GetExp(p1,k, R)!=p_GetExp(lcm,k, R)))
113            return TRUE;
114        }
115        for (k=j-1; k>=R->real_var_start; k--)
116        {
117          if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
118          && (p_GetExp(p1,k, R)!=p_GetExp(lcm,k, R)))
119            return TRUE;
120        }
121        return FALSE;
122      }
123    }
124  }
125  return FALSE;
126}
127#endif
128
Note: See TracBrowser for help on using the repository browser.