My Project  UNKNOWN_GIT_VERSION
Functions
initial.h File Reference
#include "gfanlib/gfanlib_vector.h"
#include "gfanlib/gfanlib_matrix.h"
#include "polys/monomials/p_polys.h"

Go to the source code of this file.

Functions

long wDeg (const poly p, const ring r, const gfan::ZVector &w)
 various functions to compute the initial form of polynomials and ideals More...
 
gfan::ZVector WDeg (const poly p, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W)
 Returns the weighted multidegree of the leading term of p with respect to (w,W). More...
 
poly initial (const poly p, const ring r, const gfan::ZVector &w)
 Returns the initial form of p with respect to w. More...
 
ideal initial (const ideal I, const ring r, const gfan::ZVector &w)
 Returns the initial form of I with respect to w. More...
 
poly initial (const poly p, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W)
 Returns the initial form of p with respect to w and W. More...
 
ideal initial (const ideal I, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W)
 Returns the initial form of I with respect to w and W. More...
 
void initial (poly *pStar, const ring r, const gfan::ZVector &w)
 Stores the initial form of *pStar with respect to w in pStar. More...
 
void initial (ideal *IStar, const ring r, const gfan::ZVector &w)
 Stores the initial form of *IStar with respect to w in IStar. More...
 
void initial (poly *pStar, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W)
 Stores the initial form of *pStar with respect to w and W in pStar. More...
 
void initial (ideal *IStar, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W)
 Stores the initial form of *IStar with respect to w and W in IStar. More...
 

Function Documentation

◆ initial() [1/8]

poly initial ( const poly  p,
const ring  r,
const gfan::ZVector &  w 
)

Returns the initial form of p with respect to w.

Definition at line 30 of file initial.cc.

31 {
32  if (p==NULL)
33  return NULL;
34 
35  poly q0 = p_Head(p,r);
36  poly q1 = q0;
37  long d = wDeg(p,r,w);
38  for (poly currentTerm = p->next; currentTerm; pIter(currentTerm))
39  {
40  long e = wDeg(currentTerm,r,w);
41  if (d<e)
42  {
43  p_Delete(&q0,r);
44  q0 = p_Head(currentTerm,r);
45  q1 = q0;
46  d = e;
47  }
48  else
49  if (e==d)
50  {
51  pNext(q1) = p_Head(currentTerm,r);
52  pIter(q1);
53  }
54  }
55  return q0;
56 }
#define pIter(p)
Definition: monomials.h:38
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:826
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
long wDeg(const poly p, const ring r, const gfan::ZVector &w)
various functions to compute the initial form of polynomials and ideals
Definition: initial.cc:6
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019

◆ initial() [2/8]

ideal initial ( const ideal  I,
const ring  r,
const gfan::ZVector &  w 
)

Returns the initial form of I with respect to w.

Definition at line 58 of file initial.cc.

59 {
60  int k = IDELEMS(I); ideal inI = idInit(k);
61  for (int i=0; i<k; i++)
62  inI->m[i] = initial(I->m[i],r,w);
63  return inI;
64 }
int k
Definition: cfEzgcd.cc:92
poly initial(const poly p, const ring r, const gfan::ZVector &w)
Returns the initial form of p with respect to w.
Definition: initial.cc:30
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
const CanonicalForm & w
Definition: facAbsFact.cc:55

◆ initial() [3/8]

poly initial ( const poly  p,
const ring  r,
const gfan::ZVector &  w,
const gfan::ZMatrix &  W 
)

Returns the initial form of p with respect to w and W.

Definition at line 66 of file initial.cc.

67 {
68  if (p==NULL)
69  return NULL;
70 
71  poly q0 = p_Head(p,r);
72  poly q1 = q0;
73  gfan::ZVector d = WDeg(p,r,w,W);
74  for (poly currentTerm = p->next; currentTerm; pIter(currentTerm))
75  {
76  gfan::ZVector e = WDeg(currentTerm,r,w,W);
77  if (d<e)
78  {
79  p_Delete(&q0,r);
80  q0 = p_Head(p,r);
81  q1 = q0;
82  d = e;
83  }
84  else
85  if (d==e)
86  {
87  pNext(q1) = p_Head(currentTerm,r);
88  pIter(q1);
89  }
90  }
91  return q0;
92 }
#define pIter(p)
Definition: monomials.h:38
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:826
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
gfan::ZVector WDeg(const poly p, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W)
Returns the weighted multidegree of the leading term of p with respect to (w,W).
Definition: initial.cc:21

◆ initial() [4/8]

ideal initial ( const ideal  I,
const ring  r,
const gfan::ZVector &  w,
const gfan::ZMatrix &  W 
)

Returns the initial form of I with respect to w and W.

Definition at line 94 of file initial.cc.

95 {
96  int k = IDELEMS(I); ideal inI = idInit(k);
97  for (int i=0; i<k; i++)
98  inI->m[i] = initial(I->m[i],r,w,W);
99  return inI;
100 }
int k
Definition: cfEzgcd.cc:92
poly initial(const poly p, const ring r, const gfan::ZVector &w)
Returns the initial form of p with respect to w.
Definition: initial.cc:30
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
const CanonicalForm & w
Definition: facAbsFact.cc:55

◆ initial() [5/8]

void initial ( poly *  pStar,
const ring  r,
const gfan::ZVector &  w 
)

Stores the initial form of *pStar with respect to w in pStar.

Definition at line 102 of file initial.cc.

103 {
104  poly p = *pStar;
105  if (p==NULL)
106  return;
107 
108  long d = wDeg(p,r,w);
109  poly q0 = p;
110  poly q1 = q0;
111  pNext(q1) = NULL;
112  pIter(p);
113 
114  while(p)
115  {
116  long e = wDeg(p,r,w);
117  if (d<e)
118  {
119  p_Delete(&q0,r);
120  q0 = p;
121  q1 = q0;
122  pNext(q1) = NULL;
123  d = e;
124  pIter(p);
125  }
126  else
127  if (e==d)
128  {
129  pNext(q1) = p;
130  pIter(q1);
131  pNext(q1) = NULL;
132  pIter(p);
133  }
134  else
135  p = p_LmDeleteAndNext(p,r);
136  }
137  pStar = &q0;
138  return;
139 }
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:726
#define pIter(p)
Definition: monomials.h:38
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
long wDeg(const poly p, const ring r, const gfan::ZVector &w)
various functions to compute the initial form of polynomials and ideals
Definition: initial.cc:6
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019

◆ initial() [6/8]

void initial ( ideal *  IStar,
const ring  r,
const gfan::ZVector &  w 
)

Stores the initial form of *IStar with respect to w in IStar.

Definition at line 141 of file initial.cc.

142 {
143  ideal I = *IStar;
144  int k = IDELEMS(I);
145  for (int i=0; i<k; i++)
146  initial(&I->m[i],r,w);
147  return;
148 }
int k
Definition: cfEzgcd.cc:92
poly initial(const poly p, const ring r, const gfan::ZVector &w)
Returns the initial form of p with respect to w.
Definition: initial.cc:30
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:24
const CanonicalForm & w
Definition: facAbsFact.cc:55

◆ initial() [7/8]

void initial ( poly *  pStar,
const ring  r,
const gfan::ZVector &  w,
const gfan::ZMatrix &  W 
)

Stores the initial form of *pStar with respect to w and W in pStar.

Definition at line 150 of file initial.cc.

151 {
152  poly p = *pStar;
153  if (p==NULL)
154  return;
155 
156  gfan::ZVector d = WDeg(p,r,w,W);
157  poly q0 = p;
158  poly q1 = q0;
159  pNext(q1) = NULL;
160  pIter(p);
161 
162  while(p)
163  {
164  gfan::ZVector e = WDeg(p,r,w,W);
165  if (d<e)
166  {
167  p_Delete(&q0,r);
168  q0 = p;
169  q1 = q0;
170  pNext(q1) = NULL;
171  d = e;
172  pIter(p);
173  }
174  else
175  if (d==e)
176  {
177  pNext(q1) = p;
178  pIter(q1);
179  pNext(q1) = NULL;
180  pIter(p);
181  }
182  else
183  p = p_LmDeleteAndNext(p,r);
184  }
185  pStar = &q0;
186  return;
187 }
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:726
#define pIter(p)
Definition: monomials.h:38
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
gfan::ZVector WDeg(const poly p, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W)
Returns the weighted multidegree of the leading term of p with respect to (w,W).
Definition: initial.cc:21

◆ initial() [8/8]

void initial ( ideal *  IStar,
const ring  r,
const gfan::ZVector &  w,
const gfan::ZMatrix &  W 
)

Stores the initial form of *IStar with respect to w and W in IStar.

Definition at line 189 of file initial.cc.

190 {
191  ideal I = *IStar;
192  int k = IDELEMS(I);
193  for (int i=0; i<k; i++)
194  initial(&I->m[i],r,w,W);
195  return;
196 }
int k
Definition: cfEzgcd.cc:92
poly initial(const poly p, const ring r, const gfan::ZVector &w)
Returns the initial form of p with respect to w.
Definition: initial.cc:30
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:24
const CanonicalForm & w
Definition: facAbsFact.cc:55

◆ wDeg()

long wDeg ( const poly  p,
const ring  r,
const gfan::ZVector &  w 
)

various functions to compute the initial form of polynomials and ideals

Returns the weighted degree of the leading term of p with respect to w

Definition at line 6 of file initial.cc.

7 {
8  long d=0;
9  for (unsigned i=0; i<w.size(); i++)
10  {
11  if (!w[i].fitsInInt())
12  {
13  WerrorS("wDeg: overflow in weight vector");
14  throw 0; // weightOverflow;
15  }
16  d += p_GetExp(p,i+1,r)*w[i].toInt();
17  }
18  return d;
19 }
void WerrorS(const char *s)
Definition: feFopen.cc:24
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
int i
Definition: cfEzgcd.cc:125
const CanonicalForm & w
Definition: facAbsFact.cc:55
int p
Definition: cfModGcd.cc:4019

◆ WDeg()

gfan::ZVector WDeg ( const poly  p,
const ring  r,
const gfan::ZVector &  w,
const gfan::ZMatrix &  W 
)

Returns the weighted multidegree of the leading term of p with respect to (w,W).

The weighted multidegree is a vector of length one higher than the column vectors of W. The first entry is the weighted degree with respect to w and the i+1st entry is the weighted degree with respect to the i-th row vector of W.

Definition at line 21 of file initial.cc.

22 {
23  gfan::ZVector d = gfan::ZVector(W.getHeight()+1);
24  d[0] = wDeg(p,r,w);
25  for (int i=0; i<W.getHeight(); i++)
26  d[i+1] = wDeg(p,r,W[i]);
27  return d;
28 }
int i
Definition: cfEzgcd.cc:125
long wDeg(const poly p, const ring r, const gfan::ZVector &w)
various functions to compute the initial form of polynomials and ideals
Definition: initial.cc:6
const CanonicalForm & w
Definition: facAbsFact.cc:55
int p
Definition: cfModGcd.cc:4019