33 commonGcd = commonGcdCache;
40 for (
poly gCache=g; gCache;
pIter(gCache))
43 number newCoeff =
n_Div(oldCoeff,commonGcd,r->cf);
72 for (gCache = g; gCache;
pIter(gCache))
91 number coeff0 =
n_Div(coeff,p,r->cf);
97 WerrorS(
"pReduce: overflow in exponent");
106 toBeChecked=
p_Add_q(toBeChecked,subst,r);
111 pNext(gEnd)=toBeChecked;
150 for (gCache = g; gCache;
pIter(gCache))
169 number coeff0 =
n_Div(coeff,p,r->cf);
175 WerrorS(
"pReduce: overflow in exponent");
184 toBeChecked=
p_Add_q(toBeChecked,subst,r);
189 pNext(gEnd)=toBeChecked;
263 ideal I = (ideal) u->
CopyD();
264 number
p = (number) v->
CopyD();
268 res->
data = (
char*) I;
294 res->
data = (
char*) g;
304 for (
int i=0;
i<
k;
i++)
331 for (hCache=h; hCache;
pIter(hCache))
339 for (
int i=2;
i<=r->N;
i++)
381 res->
data = (
char*) h;
401 for (
int i=1;
i<n;
i++)
413 for (
int i=0;
i<
m;
i++)
419 for (
int i=0;
i<m-1;
i++)
420 for (
int j=
i+1;
j<
m;
j++)
427 for (
int i=0;
i<m-1;
i++)
428 for (
int j=
i+1;
j<
m;
j++)
452 I = (ideal) u->
CopyD();
453 p = (number) v->
CopyD();
459 I = (ideal) u->
CopyD();
460 p = (number) v->
CopyD();
464 res->
data = (
char*) I;
485 for (j=n-1; j>0; j--)
487 if (
p_LmCmp(I->m[j], I->m[j-1],r)>0)
489 poly cache = I->m[
j];
501 for (
int i=0;
i<
j;
i++)
504 for (
int k=j+1;
k<n;
k++)
508 for (
int l=j+1;
l<
k;
l++)
517 for (
int i=0;
i<
j;
i++)
518 for (
int k=j;
k<n;
k++)
521 for (
int k=j;
k<n-1;
k++)
522 for (
int l=
k+1;
l<n;
l++)
547 ideal I; number
p;
poly g;
550 I = (ideal) u->
CopyD();
551 p = (number) v->
CopyD();
558 I = (ideal) u->
CopyD();
559 p = (number) v->
CopyD();
564 res->
data = (
char*) I;
577 for (
int i=0;
i<
l;
i++)
587 static void sortMarks(
const ideal
H,
const ring
r, std::vector<mark> &
T)
589 std::pair<int,int> pointerToTerm;
594 for (
int i=1;
i<k-1;
i++)
596 int generatorA = T[
i-1].first;
597 int termA = T[
i-1].second;
598 int generatorB = T[
i].first;
599 int termB = T[
i].second;
624 for (
unsigned i=0;
i<T.size();
i++)
626 if (T[
i].first>=newEntry)
627 T[
i].first = T[
i].first+1;
635 for (
unsigned i=0;
i<T.size();)
638 T.erase(T.begin()+
i);
671 for (
int i=0;
i<
m;
i++)
675 T.push_back(std::make_pair<int,int>(
i,1));
686 int i=0;
for (; i<
k; i++)
692 for (
int j=2;
j<=r->N;
j++)
700 T[0].second = T[0].second+1;
708 for (
int i=0;
i<
k;
i++)
710 for (
int j=0;
j<
m;
j++)
739 H = (ideal) u->
CopyD();
740 p = (number) v->
CopyD();
741 G = (ideal) w->
CopyD();
746 res->
data = (
char*) H;
767 std::map<long,ideal>
H;
int n =
idSize(I);
768 for (
int i=0;
i<n;
i++)
772 for (
int j=2;
j<=r->N;
j++)
774 std::map<long,ideal>::iterator it = H.find(d);
779 std::pair<long,ideal> Hd(d,
idInit(1));
780 Hd.second->m[0] = I->m[
i];
785 std::map<long,ideal>::iterator it=H.begin();
786 ideal Hi = it->second;
801 GG->nrows = 1; GG->rank = 1; GG->m=
NULL;
803 for (it++; it!=H.end(); it++)
813 for (
int i=1;
i<
k;
i++)
826 for (
int i=n-m-l;
i<n;
i++)
830 memcpy(&(G->m[
i]),&(Hi->m[kH]),(n-
i)*
sizeof(
poly));
836 G->m[
i] = G->m[kG++];
838 G->m[
i] = Hi->m[kH++];
868 ideal I = (ideal) u->
CopyD();
869 number
p = (number) v->
Data();
872 res->
data = (
char*) I;
BOOLEAN ppreduceInitially2(leftv res, leftv args)
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...
const CanonicalForm int s
Class used for (list of) interpreter objects.
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.
BOOLEAN reduceInitiallyDebug(leftv res, leftv args)
static poly p_LmDeleteAndNext(poly p, const ring r)
static poly ppNext(poly p, int l)
std::pair< int, int > mark
bool isOrderingLocalInT(const ring r)
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
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...
static poly p_Mult_mm(poly p, poly m, const ring r)
static poly getTerm(const ideal H, const mark ab)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void WerrorS(const char *s)
static void cleanupMarks(const ideal H, std::vector< mark > &T)
static number p_SetCoeff(poly p, number n, ring r)
static poly p_Copy(poly p, const ring r)
returns a copy of p
CanonicalForm subst(const CanonicalForm &f, const CFList &a, const CFList &b, const CanonicalForm &Rstar, bool isFunctionField)
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
static poly p_Head(poly p, const ring r)
bool p_xLeadmonomDivisibleBy(const poly g, const poly f, const ring r)
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
BOOLEAN pReduceDebug(leftv res, leftv args)
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
BOOLEAN ppreduceInitially3(leftv res, leftv args)
void pReduce(poly &g, const number p, const 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:...
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted ...
static int p_LmCmp(poly p, poly q, const ring r)
static poly p_Mult_nn(poly p, number n, const ring r)
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void ptNormalize(poly *gStar, const number p, const ring r)
static void p_Delete(poly *p, const ring r)
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...
ideal idInit(int idsize, int rank)
initialise an ideal / module
const Variable & v
< [in] a sqrfree bivariate poly
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
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_Copy(number n, const coeffs r)
return a copy of 'n'
BOOLEAN ppreduceInitially0(leftv res, leftv args)
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...
void divideByCommonGcd(poly &g, const ring r)
BOOLEAN ppreduceInitially1(leftv res, leftv args)
static void adjustMarks(std::vector< mark > &T, const int newEntry)
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
static poly p_LmInit(poly p, const ring r)
static void p_Setm(poly p, const ring r)
static long p_AddExp(poly p, int v, long ee, ring r)
static int idSize(const ideal id)
Count the effective size of an ideal (without the trailing allocated zero-elements) ...
static poly p_Neg(poly p, const ring r)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static poly p_Add_q(poly p, poly q, const ring r)
#define omFreeBin(addr, bin)
static poly p_Init(const ring r, omBin bin)
poly p_Cleardenom(poly p, const ring r)
static poly p_Mult_q(poly p, poly q, const ring r)
static BOOLEAN p_LeadmonomDivisibleBy(poly a, poly b, const ring r)
p_LmDivisibleBy checks also the divisibility of coefficients
void pReduceInhomogeneous(poly &g, const number p, const ring r)
void idShallowDelete(ideal *h)
id_ShallowDelete deletes the monomials of the polynomials stored inside of it