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.

{
number cf = nCopy(pGetCoeff(f)), cg = nCopy(pGetCoeff(g));
(void)ksCheckCoeff(&cf, &cg, currRing->cf); // gcd and zero divisors
poly fm, gm;
k_GetLeadTerms(f, g, currRing, fm, gm, currRing);
pSetCoeff0(fm, cg);
pSetCoeff0(gm, cf); // and now, m1 * LT(p1) == m2 * LT(p2)
poly sp = pSub(ppMult_mm(f, fm), ppMult_mm(g, gm));
pDelete(&fm);
pDelete(&gm);
return(sp);
}
g
g
Definition cfModGcd.cc:4098
cf
CanonicalForm cf
Definition cfModGcd.cc:4091
cg
CanonicalForm cg
Definition cfModGcd.cc:4091
f
FILE * f
Definition checklibs.c:9
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:1018
ksCheckCoeff
int ksCheckCoeff(number *a, number *b, const coeffs r)
Definition kbuckets.cc:1504
pSetCoeff0
#define pSetCoeff0(p, n)
Definition monomials.h:59
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:44
nCopy
#define nCopy(n)
Definition numbers.h:15
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
pDelete
#define pDelete(p_ptr)
Definition polys.h:187
ppMult_mm
#define ppMult_mm(p, m)
Definition polys.h:202
pSub
#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.

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

## ringNF()

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

Definition at line 196 of file ringgb.cc.

{
// If f = 0, then normal form is also 0
if (f == NULL) { return NULL; }
poly tmp = NULL;
poly h = pCopy(f);
int i = findRingSolver(h, G, r);
int c = 1;
while (h != NULL && i >= 0) {
// Print("%d-step NF - h:", c);
// wrp(h);
// PrintS(" ");
// PrintS("G->m[i]:");
// wrp(G->m[i]);
// PrintLn();
tmp = h;
h = plain_spoly(h, G->m[i]);
pDelete(&tmp);
// PrintS("=> h=");
// wrp(h);
// PrintLn();
i = findRingSolver(h, G, r);
c++;
}
return h;
}
i
int i
Definition cfEzgcd.cc:132
G
STATIC_VAR TreeM * G
Definition janet.cc:31
h
STATIC_VAR Poly * h
Definition janet.cc:971
NULL
#define NULL
Definition omList.c:12
pCopy
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
findRingSolver
int findRingSolver(poly rside, ideal G, ring r)
Definition ringgb.cc:147
plain_spoly
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.

{
// If f = 0, then normal form is also 0
if (f == NULL) { return NULL; }
poly h = NULL;
poly g = pCopy(f);
int c = 0;
while (g != NULL)
{
Print("%d-step RedNF - g=", c);
wrp(g);
PrintS(" | h=");
wrp(h);
PrintLn();
g = ringNF(g, G, r);
if (g != NULL) {
h = pAdd(h, pHead(g));
pLmDelete(&g);
}
c++;
}
return h;
}
Print
#define Print
Definition emacs.cc:80
pAdd
#define pAdd(p, q)
Definition polys.h:204
pHead
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition polys.h:68
pLmDelete
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition polys.h:77
wrp
void wrp(poly p)
Definition polys.h:311
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
PrintLn
void PrintLn()
Definition reporter.cc:314
ringNF
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.

{
poly f, g, h, nf;
int i = 0;
int j = 0;
PrintS("I included?");
for (i = 0; i < IDELEMS(I); i++) {
if (ringNF(I->m[i], GI, currRing) != NULL) {
PrintS("Not reduced to zero from I: ");
wrp(I->m[i]);
PrintS(" --> ");
wrp(ringNF(I->m[i], GI, currRing));
PrintLn();
return(0);
}
PrintS("-");
}
PrintS(" Yes!\nspoly --> 0?");
for (i = 0; i < IDELEMS(GI); i++)
{
for (j = i + 1; j < IDELEMS(GI); j++)
{
f = pCopy(GI->m[i]);
g = pCopy(GI->m[j]);
h = plain_spoly(f, g);
nf = ringNF(h, GI, currRing);
if (nf != NULL)
{
PrintS("spoly(");
wrp(GI->m[i]);
PrintS(", ");
wrp(GI->m[j]);
PrintS(") = ");
wrp(h);
PrintS(" --> ");
wrp(nf);
PrintLn();
return(0);
}
pDelete(&f);
pDelete(&g);
pDelete(&h);
pDelete(&nf);
PrintS("-");
}
}
if (!(rField_is_Domain(currRing)))
{
PrintS(" Yes!\nzero-spoly --> 0?");
for (i = 0; i < IDELEMS(GI); i++)
{
f = plain_zero_spoly(GI->m[i]);
nf = ringNF(f, GI, currRing);
if (nf != NULL) {
PrintS("spoly(");
wrp(GI->m[i]);
PrintS(", ");
wrp(0);
PrintS(") = ");
wrp(h);
PrintS(" --> ");
wrp(nf);
PrintLn();
return(0);
}
pDelete(&f);
pDelete(&nf);
PrintS("-");
}
}
PrintS(" Yes!");
PrintLn();
return(1);
}
j
int j
Definition facHensel.cc:110
rField_is_Domain
static BOOLEAN rField_is_Domain(const ring r)
Definition ring.h:493
plain_zero_spoly
poly plain_zero_spoly(poly h)
Definition ringgb.cc:180
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23
nf
Definition gnumpfl.cc:25