My Project
Loading...
Searching...
No Matches
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 163 of file ringgb.cc.

164{
165 number cf = nCopy(pGetCoeff(f)), cg = nCopy(pGetCoeff(g));
166 (void)ksCheckCoeff(&cf, &cg, currRing->cf); // gcd and zero divisors
167 poly fm, gm;
168 k_GetLeadTerms(f, g, currRing, fm, gm, currRing);
169 pSetCoeff0(fm, cg);
170 pSetCoeff0(gm, cf); // and now, m1 * LT(p1) == m2 * LT(p2)
171 poly sp = pSub(ppMult_mm(f, fm), ppMult_mm(g, gm));
172 pDelete(&fm);
173 pDelete(&gm);
174 return(sp);
175}
g
Definition cfModGcd.cc:4098
CanonicalForm cf
Definition cfModGcd.cc:4091
CanonicalForm cg
Definition cfModGcd.cc:4091
FILE * f
Definition checklibs.c:9
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:1015
int ksCheckCoeff(number *a, number *b, const coeffs r)
Definition kbuckets.cc:1504
#define pSetCoeff0(p, n)
Definition monomials.h:59
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition monomials.h:44
#define nCopy(n)
Definition numbers.h:15
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
#define pDelete(p_ptr)
Definition polys.h:187
#define ppMult_mm(p, m)
Definition polys.h:202
#define pSub(a, b)
Definition polys.h:288

◆ reduce_poly_fct()

poly reduce_poly_fct ( poly p,
ring r )

Definition at line 28 of file ringgb.cc.

29{
30 return kFindZeroPoly(p, r, r);
31}
int p
Definition cfModGcd.cc:4086
poly kFindZeroPoly(poly input_p, ring leadRing, ring tailRing)
Definition kstd2.cc:613

◆ ringNF()

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

Definition at line 196 of file ringgb.cc.

197{
198 // If f = 0, then normal form is also 0
199 if (f == NULL) { return NULL; }
200 poly tmp = NULL;
201 poly h = pCopy(f);
202 int i = findRingSolver(h, G, r);
203 int c = 1;
204 while (h != NULL && i >= 0) {
205// Print("%d-step NF - h:", c);
206// wrp(h);
207// PrintS(" ");
208// PrintS("G->m[i]:");
209// wrp(G->m[i]);
210// PrintLn();
211 tmp = h;
212 h = plain_spoly(h, G->m[i]);
213 pDelete(&tmp);
214// PrintS("=> h=");
215// wrp(h);
216// PrintLn();
217 i = findRingSolver(h, G, r);
218 c++;
219 }
220 return h;
221}
int i
Definition cfEzgcd.cc:132
STATIC_VAR TreeM * G
Definition janet.cc:31
STATIC_VAR Poly * h
Definition janet.cc:971
#define NULL
Definition omList.c:12
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
int findRingSolver(poly rside, ideal G, ring r)
Definition ringgb.cc:147
poly plain_spoly(poly f, poly g)
Definition ringgb.cc:163

◆ ringRedNF()

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

Definition at line 116 of file ringgb.cc.

117{
118 // If f = 0, then normal form is also 0
119 if (f == NULL) { return NULL; }
120 poly h = NULL;
121 poly g = pCopy(f);
122 int c = 0;
123 while (g != NULL)
124 {
125 Print("%d-step RedNF - g=", c);
126 wrp(g);
127 PrintS(" | h=");
128 wrp(h);
129 PrintLn();
130 g = ringNF(g, G, r);
131 if (g != NULL) {
132 h = pAdd(h, pHead(g));
133 pLmDelete(&g);
134 }
135 c++;
136 }
137 return h;
138}
#define Print
Definition emacs.cc:80
#define pAdd(p, q)
Definition polys.h:204
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition polys.h:68
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition polys.h:77
void wrp(poly p)
Definition polys.h:311
void PrintS(const char *s)
Definition reporter.cc:284
void PrintLn()
Definition reporter.cc:310
poly ringNF(poly f, ideal G, ring r)
Definition ringgb.cc:196

◆ testGB()

int testGB ( ideal I,
ideal GI )

Definition at line 223 of file ringgb.cc.

223 {
224 poly f, g, h, nf;
225 int i = 0;
226 int j = 0;
227 PrintS("I included?");
228 for (i = 0; i < IDELEMS(I); i++) {
229 if (ringNF(I->m[i], GI, currRing) != NULL) {
230 PrintS("Not reduced to zero from I: ");
231 wrp(I->m[i]);
232 PrintS(" --> ");
233 wrp(ringNF(I->m[i], GI, currRing));
234 PrintLn();
235 return(0);
236 }
237 PrintS("-");
238 }
239 PrintS(" Yes!\nspoly --> 0?");
240 for (i = 0; i < IDELEMS(GI); i++)
241 {
242 for (j = i + 1; j < IDELEMS(GI); j++)
243 {
244 f = pCopy(GI->m[i]);
245 g = pCopy(GI->m[j]);
246 h = plain_spoly(f, g);
247 nf = ringNF(h, GI, currRing);
248 if (nf != NULL)
249 {
250 PrintS("spoly(");
251 wrp(GI->m[i]);
252 PrintS(", ");
253 wrp(GI->m[j]);
254 PrintS(") = ");
255 wrp(h);
256 PrintS(" --> ");
257 wrp(nf);
258 PrintLn();
259 return(0);
260 }
261 pDelete(&f);
262 pDelete(&g);
263 pDelete(&h);
264 pDelete(&nf);
265 PrintS("-");
266 }
267 }
269 {
270 PrintS(" Yes!\nzero-spoly --> 0?");
271 for (i = 0; i < IDELEMS(GI); i++)
272 {
273 f = plain_zero_spoly(GI->m[i]);
274 nf = ringNF(f, GI, currRing);
275 if (nf != NULL) {
276 PrintS("spoly(");
277 wrp(GI->m[i]);
278 PrintS(", ");
279 wrp(0);
280 PrintS(") = ");
281 wrp(h);
282 PrintS(" --> ");
283 wrp(nf);
284 PrintLn();
285 return(0);
286 }
287 pDelete(&f);
288 pDelete(&nf);
289 PrintS("-");
290 }
291 }
292 PrintS(" Yes!");
293 PrintLn();
294 return(1);
295}
int j
Definition facHensel.cc:110
static BOOLEAN rField_is_Domain(const ring r)
Definition ring.h:493
poly plain_zero_spoly(poly h)
Definition ringgb.cc:180
#define IDELEMS(i)
Definition gnumpfl.cc:25