My Project  debian-1:4.1.2-p1+ds-2
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

◆ plain_spoly()

poly plain_spoly ( poly  f,
poly  g 
)

Definition at line 167 of file ringgb.cc.

169 {
170  number cf = nCopy(pGetCoeff(f)), cg = nCopy(pGetCoeff(g));
171  (void)ksCheckCoeff(&cf, &cg, currRing->cf); // gcd and zero divisors
172  poly fm, gm;
173  k_GetLeadTerms(f, g, currRing, fm, gm, currRing);
174  pSetCoeff0(fm, cg);
175  pSetCoeff0(gm, cf); // and now, m1 * LT(p1) == m2 * LT(p2)
176  poly sp = pSub(ppMult_mm(f, fm), ppMult_mm(g, gm));
177  pDelete(&fm);
178  pDelete(&gm);
179  return(sp);

◆ reduce_poly_fct()

poly reduce_poly_fct ( poly  p,
ring  r 
)

Definition at line 29 of file ringgb.cc.

30 {
31  return kFindZeroPoly(p, r, r);
32 }

◆ ringNF()

poly ringNF ( poly  f,
ideal  G,
ring  r 
)

Definition at line 198 of file ringgb.cc.

200 {
201  // If f = 0, then normal form is also 0
202  if (f == NULL) { return NULL; }
203  poly tmp = NULL;
204  poly h = pCopy(f);
205  int i = findRingSolver(h, G, r);
206  int c = 1;
207  while (h != NULL && i >= 0) {
208 // Print("%d-step NF - h:", c);
209 // wrp(h);
210 // PrintS(" ");
211 // PrintS("G->m[i]:");
212 // wrp(G->m[i]);
213 // PrintLn();
214  tmp = h;
215  h = plain_spoly(h, G->m[i]);
216  pDelete(&tmp);
217 // PrintS("=> h=");
218 // wrp(h);
219 // PrintLn();
220  i = findRingSolver(h, G, r);
221  c++;
222  }
223  return h;

◆ ringRedNF()

poly ringRedNF ( poly  f,
ideal  G,
ring  r 
)

Definition at line 116 of file ringgb.cc.

118 {
119  // If f = 0, then normal form is also 0
120  if (f == NULL) { return NULL; }
121  poly h = NULL;
122  poly g = pCopy(f);
123  int c = 0;
124  while (g != NULL)
125  {
126  Print("%d-step RedNF - g=", c);
127  wrp(g);
128  PrintS(" | h=");
129  wrp(h);
130  PrintLn();
131  g = ringNF(g, G, r);
132  if (g != NULL) {
133  h = pAdd(h, pHead(g));
134  pLmDelete(&g);
135  }
136  c++;
137  }
138  return h;

◆ testGB()

int testGB ( ideal  I,
ideal  GI 
)

Definition at line 225 of file ringgb.cc.

226  {
227  poly f, g, h, nf;
228  int i = 0;
229  int j = 0;
230  PrintS("I included?");
231  for (i = 0; i < IDELEMS(I); i++) {
232  if (ringNF(I->m[i], GI, currRing) != NULL) {
233  PrintS("Not reduced to zero from I: ");
234  wrp(I->m[i]);
235  PrintS(" --> ");
236  wrp(ringNF(I->m[i], GI, currRing));
237  PrintLn();
238  return(0);
239  }
240  PrintS("-");
241  }
242  PrintS(" Yes!\nspoly --> 0?");
243  for (i = 0; i < IDELEMS(GI); i++)
244  {
245  for (j = i + 1; j < IDELEMS(GI); j++)
246  {
247  f = pCopy(GI->m[i]);
248  g = pCopy(GI->m[j]);
249  h = plain_spoly(f, g);
250  nf = ringNF(h, GI, currRing);
251  if (nf != NULL)
252  {
253  PrintS("spoly(");
254  wrp(GI->m[i]);
255  PrintS(", ");
256  wrp(GI->m[j]);
257  PrintS(") = ");
258  wrp(h);
259  PrintS(" --> ");
260  wrp(nf);
261  PrintLn();
262  return(0);
263  }
264  pDelete(&f);
265  pDelete(&g);
266  pDelete(&h);
267  pDelete(&nf);
268  PrintS("-");
269  }
270  }
271  if (!(rField_is_Domain(currRing)))
272  {
273  PrintS(" Yes!\nzero-spoly --> 0?");
274  for (i = 0; i < IDELEMS(GI); i++)
275  {
276  f = plain_zero_spoly(GI->m[i]);
277  nf = ringNF(f, GI, currRing);
278  if (nf != NULL) {
279  PrintS("spoly(");
280  wrp(GI->m[i]);
281  PrintS(", ");
282  wrp(0);
283  PrintS(") = ");
284  wrp(h);
285  PrintS(" --> ");
286  wrp(nf);
287  PrintLn();
288  return(0);
289  }
290  pDelete(&f);
291  pDelete(&nf);
292  PrintS("-");
293  }
294  }
295  PrintS(" Yes!");
296  PrintLn();
297  return(1);
ksCheckCoeff
int ksCheckCoeff(number *a, number *b)
kFindZeroPoly
poly kFindZeroPoly(poly input_p, ring leadRing, ring tailRing)
Definition: kstd2.cc:454
j
int j
Definition: facHensel.cc:105
f
FILE * f
Definition: checklibs.c:9
ppMult_mm
#define ppMult_mm(p, m)
Definition: polys.h:189
rField_is_Domain
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:481
h
STATIC_VAR Poly * h
Definition: janet.cc:971
cf
CanonicalForm cf
Definition: cfModGcd.cc:4024
g
g
Definition: cfModGcd.cc:4031
findRingSolver
int findRingSolver(poly rside, ideal G, ring r)
Definition: ringgb.cc:151
pDelete
#define pDelete(p_ptr)
Definition: polys.h:175
nf
Definition: gnumpfl.cc:25
i
int i
Definition: cfEzgcd.cc:125
PrintS
void PrintS(const char *s)
Definition: reporter.cc:283
G
STATIC_VAR TreeM * G
Definition: janet.cc:31
k_GetLeadTerms
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:960
cg
CanonicalForm cg
Definition: cfModGcd.cc:4024
pAdd
#define pAdd(p, q)
Definition: polys.h:191
plain_spoly
poly plain_spoly(poly f, poly g)
Definition: ringgb.cc:167
Print
#define Print
Definition: emacs.cc:79
pSetCoeff0
#define pSetCoeff0(p, n)
Definition: monomials.h:56
NULL
#define NULL
Definition: omList.c:11
pLmDelete
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:74
p
int p
Definition: cfModGcd.cc:4019
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
pCopy
#define pCopy(p)
return a copy of the poly
Definition: polys.h:174
ringNF
poly ringNF(poly f, ideal G, ring r)
Definition: ringgb.cc:198
IDELEMS
#define IDELEMS(i)
Definition: simpleideals.h:23
plain_zero_spoly
poly plain_zero_spoly(poly h)
Definition: ringgb.cc:184
pHead
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:65
pGetCoeff
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:41
PrintLn
void PrintLn()
Definition: reporter.cc:309
pSub
#define pSub(a, b)
Definition: polys.h:271
nCopy
#define nCopy(n)
Definition: numbers.h:14
wrp
void wrp(poly p)
Definition: polys.h:294