Functions
ringgb.h File Reference
#include <kernel/polys.h>

Go to the source code of this file.

Functions

poly ringNF (poly f, ideal G, ring r)
 
poly plain_spoly (poly f, poly g)
 
int testGB (ideal I, ideal GI)
 
poly reduce_poly_fct (poly p, ring r)
 
poly ringRedNF (poly f, ideal G, ring r)
 

Function Documentation

poly plain_spoly ( poly  f,
poly  g 
)

Definition at line 172 of file ringgb.cc.

173 {
174  number cf = nCopy(pGetCoeff(f)), cg = nCopy(pGetCoeff(g));
175  (void)ksCheckCoeff(&cf, &cg, currRing->cf); // gcd and zero divisors
176  poly fm, gm;
177  k_GetLeadTerms(f, g, currRing, fm, gm, currRing);
178  pSetCoeff0(fm, cg);
179  pSetCoeff0(gm, cf); // and now, m1 * LT(p1) == m2 * LT(p2)
180  poly sp = pSub(ppMult_mm(f, fm), ppMult_mm(g, gm));
181  pDelete(&fm);
182  pDelete(&gm);
183  return(sp);
184 }
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:964
f
Definition: cfModGcd.cc:4022
#define ppMult_mm(p, m)
Definition: polys.h:172
int ksCheckCoeff(number *a, number *b)
g
Definition: cfModGcd.cc:4031
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSub(a, b)
Definition: polys.h:258
CanonicalForm cf
Definition: cfModGcd.cc:4024
CanonicalForm cg
Definition: cfModGcd.cc:4024
#define pDelete(p_ptr)
Definition: polys.h:157
#define nCopy(n)
Definition: numbers.h:15
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
poly reduce_poly_fct ( poly  p,
ring  r 
)

Definition at line 33 of file ringgb.cc.

34 {
35  return kFindZeroPoly(p, r, r);
36 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
poly kFindZeroPoly(poly input_p, ring leadRing, ring tailRing)
Definition: kstd2.cc:295
poly ringNF ( poly  f,
ideal  G,
ring  r 
)

Definition at line 203 of file ringgb.cc.

204 {
205  // If f = 0, then normal form is also 0
206  if (f == NULL) { return NULL; }
207  poly tmp = NULL;
208  poly h = pCopy(f);
209  int i = findRingSolver(h, G, r);
210  int c = 1;
211  while (h != NULL && i >= 0) {
212 // Print("%d-step NF - h:", c);
213 // wrp(h);
214 // PrintS(" ");
215 // PrintS("G->m[i]:");
216 // wrp(G->m[i]);
217 // PrintLn();
218  tmp = h;
219  h = plain_spoly(h, G->m[i]);
220  pDelete(&tmp);
221 // PrintS("=> h=");
222 // wrp(h);
223 // PrintLn();
224  i = findRingSolver(h, G, r);
225  c++;
226  }
227  return h;
228 }
f
Definition: cfModGcd.cc:4022
int findRingSolver(poly rside, ideal G, ring r)
Definition: ringgb.cc:156
static TreeM * G
Definition: janet.cc:38
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
poly plain_spoly(poly f, poly g)
Definition: ringgb.cc:172
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
poly ringRedNF ( poly  f,
ideal  G,
ring  r 
)

Definition at line 121 of file ringgb.cc.

122 {
123  // If f = 0, then normal form is also 0
124  if (f == NULL) { return NULL; }
125  poly h = NULL;
126  poly g = pCopy(f);
127  int c = 0;
128  while (g != NULL)
129  {
130  Print("%d-step RedNF - g=", c);
131  wrp(g);
132  PrintS(" | h=");
133  wrp(h);
134  PrintLn();
135  g = ringNF(g, G, r);
136  if (g != NULL) {
137  h = pAdd(h, pHead(g));
138  pLmDelete(&g);
139  }
140  c++;
141  }
142  return h;
143 }
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
#define pAdd(p, q)
Definition: polys.h:174
f
Definition: cfModGcd.cc:4022
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
g
Definition: cfModGcd.cc:4031
static TreeM * G
Definition: janet.cc:38
const ring r
Definition: syzextra.cc:208
void PrintS(const char *s)
Definition: reporter.cc:294
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define NULL
Definition: omList.c:10
void wrp(poly p)
Definition: polys.h:281
polyrec * poly
Definition: hilb.h:10
poly ringNF(poly f, ideal G, ring r)
Definition: ringgb.cc:203
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
int testGB ( ideal  I,
ideal  GI 
)

Definition at line 230 of file ringgb.cc.

230  {
231  poly f, g, h, nf;
232  int i = 0;
233  int j = 0;
234  PrintS("I included?");
235  for (i = 0; i < IDELEMS(I); i++) {
236  if (ringNF(I->m[i], GI, currRing) != NULL) {
237  PrintS("Not reduced to zero from I: ");
238  wrp(I->m[i]);
239  PrintS(" --> ");
240  wrp(ringNF(I->m[i], GI, currRing));
241  PrintLn();
242  return(0);
243  }
244  PrintS("-");
245  }
246  PrintS(" Yes!\nspoly --> 0?");
247  for (i = 0; i < IDELEMS(GI); i++)
248  {
249  for (j = i + 1; j < IDELEMS(GI); j++)
250  {
251  f = pCopy(GI->m[i]);
252  g = pCopy(GI->m[j]);
253  h = plain_spoly(f, g);
254  nf = ringNF(h, GI, currRing);
255  if (nf != NULL)
256  {
257  PrintS("spoly(");
258  wrp(GI->m[i]);
259  PrintS(", ");
260  wrp(GI->m[j]);
261  PrintS(") = ");
262  wrp(h);
263  PrintS(" --> ");
264  wrp(nf);
265  PrintLn();
266  return(0);
267  }
268  pDelete(&f);
269  pDelete(&g);
270  pDelete(&h);
271  pDelete(&nf);
272  PrintS("-");
273  }
274  }
275  if (!(rField_is_Domain(currRing)))
276  {
277  PrintS(" Yes!\nzero-spoly --> 0?");
278  for (i = 0; i < IDELEMS(GI); i++)
279  {
280  f = plain_zero_spoly(GI->m[i]);
281  nf = ringNF(f, GI, currRing);
282  if (nf != NULL) {
283  PrintS("spoly(");
284  wrp(GI->m[i]);
285  PrintS(", ");
286  wrp(0);
287  PrintS(") = ");
288  wrp(h);
289  PrintS(" --> ");
290  wrp(nf);
291  PrintLn();
292  return(0);
293  }
294  pDelete(&f);
295  pDelete(&nf);
296  PrintS("-");
297  }
298  }
299  PrintS(" Yes!");
300  PrintLn();
301  return(1);
302 }
void PrintLn()
Definition: reporter.cc:327
f
Definition: cfModGcd.cc:4022
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:440
g
Definition: cfModGcd.cc:4031
Definition: gnumpfl.cc:60
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:24
poly plain_spoly(poly f, poly g)
Definition: ringgb.cc:172
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
poly plain_zero_spoly(poly h)
Definition: ringgb.cc:189
void wrp(poly p)
Definition: polys.h:281
polyrec * poly
Definition: hilb.h:10
poly ringNF(poly f, ideal G, ring r)
Definition: ringgb.cc:203
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156