31 #define TEST_OPT_DEBUG_RED 48 #ifdef TEST_OPT_DEBUG_RED 63 poly p1 = PR->GetLmTailRing();
64 poly p2 = PW->GetLmTailRing();
86 poly _p = (PR->t_p !=
NULL ? PR->t_p : PR->p);
89 if (PR->t_p!=
NULL) PR->t_p=_p;
else PR->p=_p;
98 PR->LmDeleteAndIter();
112 if (strat ==
NULL)
return 2;
115 p1 = PR->GetLmTailRing();
116 p2 = PW->GetLmTailRing();
131 if ((ct == 0) || (ct == 2))
132 PR->Tail_Mult_nn(an);
133 if (coef !=
NULL) *coef = an;
138 if (coef !=
NULL) *coef =
n_Init(1, tailRing);
143 PR->Tail_Minus_mm_Mult_qq(lm, t2,
pLength(t2) , spNoether);
145 PR->LmDeleteAndIter();
148 #ifdef HAVE_SHIFTBBA_NONEXISTENT 157 PR->SetShortExpVector();
161 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED) 187 #ifdef TEST_OPT_DEBUG_RED 233 printf(
"IN KSREDUCEPOLYSIG: \n");
237 printf(
"--------------\n");
242 printf(
"------------------- IN KSREDUCEPOLYSIG: --------------------\n");
247 printf(
"--------------\n");
254 printf(
"%d -- %d sig\n",sigSafe,PW->is_sigsafe);
263 PR->is_redundant =
TRUE;
268 PR->is_redundant =
FALSE;
269 poly p1 = PR->GetLmTailRing();
270 poly p2 = PW->GetLmTailRing();
292 poly _p = (PR->t_p !=
NULL ? PR->t_p : PR->p);
295 if (PR->t_p!=
NULL) PR->t_p=_p;
else PR->p=_p;
304 PR->LmDeleteAndIter();
305 if (coef !=
NULL) *coef =
n_Init(1, tailRing);
318 if (strat ==
NULL)
return 2;
321 p1 = PR->GetLmTailRing();
322 p2 = PW->GetLmTailRing();
337 if ((ct == 0) || (ct == 2))
338 PR->Tail_Mult_nn(an);
339 if (coef !=
NULL) *coef = an;
344 if (coef !=
NULL) *coef =
n_Init(1, tailRing);
349 PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
351 PR->LmDeleteAndIter();
354 #ifdef HAVE_SHIFTBBA_NONEXISTENT 363 PR->SetShortExpVector();
367 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED) 384 printf(
"\nksReducePolySig\n");
390 #ifdef TEST_OPT_DEBUG_RED 436 printf(
"IN KSREDUCEPOLYSIG: \n");
440 printf(
"--------------\n");
454 printf(
"------------------- IN KSREDUCEPOLYSIG: --------------------\n");
459 printf(
"--------------\n");
468 printf(
"%d -- %d sig\n",sigSafe,PW->is_sigsafe);
482 printf(
"\nPossible sigdrop in ksreducepolysig (lost signature)\n");
488 if(
pLtCmp(PR->sig,origsig) == 1)
492 PR->is_redundant =
TRUE;
498 if(
pLtCmp(PR->sig,origsig) == -1)
501 printf(
"\nSigdrop in ksreducepolysig from * to *\n");
pWrite(origsig);
pWrite(PR->sig);
513 PR->is_redundant =
TRUE;
518 PR->is_redundant =
FALSE;
519 poly p1 = PR->GetLmTailRing();
520 poly p2 = PW->GetLmTailRing();
542 poly _p = (PR->t_p !=
NULL ? PR->t_p : PR->p);
545 if (PR->t_p!=
NULL) PR->t_p=_p;
else PR->p=_p;
554 PR->LmDeleteAndIter();
555 if (coef !=
NULL) *coef =
n_Init(1, tailRing);
568 if (strat ==
NULL)
return 2;
571 p1 = PR->GetLmTailRing();
572 p2 = PW->GetLmTailRing();
583 if (coef !=
NULL) *coef =
n_Init(1, tailRing);
593 if (((ct == 0) || (ct == 2)))
594 PR->Tail_Mult_nn(an);
595 if (coef !=
NULL) *coef = an;
600 if (coef !=
NULL) *coef =
n_Init(1, tailRing);
605 PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
607 PR->LmDeleteAndIter();
610 #ifdef HAVE_SHIFTBBA_NONEXISTENT 619 PR->SetShortExpVector();
622 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED) 684 if (Pair->i_r1 == -1)
690 l1 = (R[Pair->i_r1])->GetpLength() - 1;
692 if ((Pair->i_r2 == -1)||(R[Pair->i_r2]==
NULL))
698 l2 = (R[Pair->i_r2])->GetpLength() - 1;
703 if (spNoether !=
NULL)
706 a2 = tailRing->p_Procs->pp_Mult_mm_Noether(a2, m2, spNoether, l2, tailRing);
710 a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing);
715 Pair->SetLmTail(m2, a2, l2, use_buckets, tailRing);
718 Pair->Tail_Minus_mm_Mult_qq(m1, a1, l1, spNoether);
721 Pair->LmDeleteAndIter();
737 #ifdef HAVE_SHIFTBBA_NONEXISTENT 746 Pair->SetShortExpVector();
756 poly Lp = PR->GetLmCurrRing();
757 poly Save = PW->GetLmCurrRing();
777 if (Current == PR->p && PR->t_p !=
NULL)
783 pNext(Current) = Red.GetLmTailRing();
784 if (Current == PR->p && PR->t_p !=
NULL)
792 #ifdef HAVE_SHIFTBBA_NONEXISTENT 801 PR->SetShortExpVector();
875 if ((c1==c2)||(c2!=0))
927 if ((c1==c2)||(c1!=0))
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
static void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
void nc_PolyPolyRed(poly &b, poly p, number *c, const ring r)
Compatiblity layer for legacy polynomial operations (over currRing)
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
int ksCheckCoeff(number *a, number *b)
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
static BOOLEAN rField_is_Domain(const ring r)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
BOOLEAN pHaveCommonMonoms(poly p, poly q)
static number p_SetCoeff(poly p, number n, ring r)
static void p_LmFree(poly p, ring)
BOOLEAN pIsMonomOf(poly p, poly m)
static int pLength(poly a)
int ksReducePolySig(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
poly p_Shrink(poly p, int lV, const ring r)
BOOLEAN p_CheckPolyRing(poly p, ring r)
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
static void p_SetCompP(poly p, int i, 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:
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
static int p_LmCmp(poly p, poly q, const ring r)
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
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 BOOLEAN rField_is_Ring(const ring r)
static void p_Setm(poly p, const ring r)
static void p_LmDelete(poly p, const ring r)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static void p_ExpVectorAddSub(poly p1, poly p2, poly p3, const ring r)
int ksReducePolyTail(LObject *PR, TObject *PW, poly Current, poly spNoether)
static poly p_Init(const ring r, omBin bin)
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
#define pCopy(p)
return a copy of the poly
int ksReducePolySigRing(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)