28 commonGcd = commonGcdCache;
35 for (poly gCache=
g; gCache;
pIter(gCache))
38 number newCoeff =
n_Div(oldCoeff,commonGcd,r->cf);
60 poly toBeChecked =
pNext(
g);
67 for (gCache =
g; gCache;
pIter(gCache))
86 number coeff0 =
n_Div(coeff,
p,r->cf);
92 WerrorS(
"pReduce: overflow in exponent");
106 pNext(gEnd)=toBeChecked;
138 poly toBeChecked =
pNext(
g);
145 for (gCache =
g; gCache;
pIter(gCache))
164 number coeff0 =
n_Div(coeff,
p,r->cf);
170 WerrorS(
"pReduce: overflow in exponent");
184 pNext(gEnd)=toBeChecked;
248 ideal I = (ideal) u->
CopyD();
249 number
p = (number)
v->CopyD();
253 res->data = (
char*) I;
261void pReduce(ideal &I,
const number
p,
const ring r)
264 for (
int i=0;
i<
k;
i++)
290 for (hCache=
h; hCache;
pIter(hCache))
298 for (
int i=2;
i<=r->N;
i++)
328 for (
int i=1;
i<n;
i++)
340 for (
int i=0;
i<
m;
i++)
346 for (
int i=0;
i<
m-1;
i++)
347 for (
int j=
i+1;
j<
m;
j++)
354 for (
int i=0;
i<
m-1;
i++)
355 for (
int j=
i+1;
j<
m;
j++)
380 for (
j=n-1;
j>0;
j--)
384 poly cache = I->m[
j];
396 for (
int i=0;
i<
j;
i++)
399 for (
int k=
j+1;
k<n;
k++)
403 for (
int l=
j+1;
l<
k;
l++)
412 for (
int i=0;
i<
j;
i++)
413 for (
int k=
j;
k<n;
k++)
416 for (
int k=
j;
k<n-1;
k++)
417 for (
int l=
k+1;
l<n;
l++)
433 for (
int i=0;
i<
l;
i++)
443static void sortMarks(
const ideal
H,
const ring r, std::vector<mark> &
T)
445 std::pair<int,int> pointerToTerm;
450 for (
int i=1;
i<
k-1;
i++)
452 int generatorA =
T[
i-1].first;
453 int termA =
T[
i-1].second;
454 int generatorB =
T[
i].first;
455 int termB =
T[
i].second;
480 for (
unsigned i=0;
i<
T.size();
i++)
482 if (
T[
i].first>=newEntry)
483 T[
i].first =
T[
i].first+1;
491 for (
unsigned i=0;
i<
T.size();)
494 T.erase(
T.begin()+
i);
527 for (
int i=0;
i<
m;
i++)
533 T.push_back(std::pair<int,int>(
i,1));
557 for (
int j=2;
j<=r->N;
j++)
565 T[0].second =
T[0].second+1;
573 for (
int i=0;
i<
k;
i++)
577 for (
int j=0;
j<
m;
j++)
605 std::map<long,ideal>
H;
int n =
IDELEMS(I);
606 for (
int i=0;
i<n;
i++)
612 for (
int j=2;
j<=r->N;
j++)
614 std::map<long,ideal>::iterator it =
H.find(d);
619 std::pair<long,ideal> Hd(d,
idInit(1));
620 Hd.second->m[0] = I->m[
i];
626 std::map<long,ideal>::iterator it=
H.begin();
627 ideal Hi = it->second;
645 for (it++; it!=
H.end(); it++)
655 for (
int i=1;
i<
k;
i++)
668 for (
int i=n-
m-
l;
i<n;
i++)
672 memcpy(&(
G->m[
i]),&(Hi->m[kH]),(n-
i)*
sizeof(poly));
678 G->m[
i] =
G->m[kG++];
680 G->m[
i] = Hi->m[kH++];
Class used for (list of) interpreter objects.
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
beware that ExtGCD is only relevant for a few chosen coeff. domains and may perform something unexpec...
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
const CanonicalForm int s
CanonicalForm subst(const CanonicalForm &f, const CFList &a, const CFList &b, const CanonicalForm &Rstar, bool isFunctionField)
const Variable & v
< [in] a sqrfree bivariate poly
void WerrorS(const char *s)
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted
#define omFreeBin(addr, bin)
poly p_Cleardenom(poly p, const ring r)
static poly p_Neg(poly p, const ring r)
static poly p_Add_q(poly p, poly q, const ring r)
static poly p_Mult_q(poly p, poly q, const ring r)
static long p_AddExp(poly p, int v, long ee, ring r)
static poly p_LmInit(poly p, const ring r)
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
static void p_Setm(poly p, const ring r)
static number p_SetCoeff(poly p, number n, ring r)
static poly p_Head(const poly p, const ring r)
copy the (leading) term of p
static int p_LmCmp(poly p, poly q, const ring r)
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
static poly p_Mult_nn(poly p, number n, const ring r)
static void p_Delete(poly *p, const ring r)
static poly p_Mult_mm(poly p, poly m, const ring r)
static poly p_Init(const ring r, omBin bin)
static poly p_LmDeleteAndNext(poly p, const ring r)
static poly p_Copy(poly p, const ring r)
returns a copy of p
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
void pReduceInhomogeneous(poly &g, const number p, const ring r)
void ptNormalize(poly *gStar, const number p, const ring r)
static poly ppNext(poly p, int l)
static void cleanupMarks(const ideal H, std::vector< mark > &T)
bool isOrderingLocalInT(const ring r)
void pReduce(poly &g, const number p, const ring r)
static poly getTerm(const ideal H, const mark ab)
void divideByCommonGcd(poly &g, const ring r)
static void adjustMarks(std::vector< mark > &T, const int newEntry)
static void sortMarks(const ideal H, const ring r, std::vector< mark > &T)
bool ppreduceInitially(poly *hStar, const poly g, const ring r)
reduces h initially with respect to g, returns false if h was initially reduced in the first place,...
bool p_xLeadmonomDivisibleBy(const poly g, const poly f, const ring r)
std::pair< int, int > mark
ideal idInit(int idsize, int rank)
initialise an ideal / module
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static void idShallowDelete(ideal *h)
id_ShallowDelete deletes the monomials of the polynomials stored inside of it
static BOOLEAN p_LeadmonomDivisibleBy(poly a, poly b, const ring r)
p_LmDivisibleBy checks also the divisibility of coefficients