27 #define TEST_OPT_DEBUG_RED
49 #ifdef TEST_OPT_DEBUG_RED
60 ring tailRing = PR->tailRing;
64 poly p1 = PR->GetLmTailRing();
65 poly p2 = PW->GetLmTailRing();
66 poly t2 =
pNext(p2), lm = p1;
87 poly _p = (PR->t_p !=
NULL ? PR->t_p : PR->p);
90 if (PR->t_p!=
NULL) PR->t_p=_p;
else PR->p=_p;
99 PR->LmDeleteAndIter();
100 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
113 if (strat ==
NULL)
return 2;
116 p1 = PR->GetLmTailRing();
117 p2 = PW->GetLmTailRing();
132 if ((ct == 0) || (ct == 2))
133 PR->Tail_Mult_nn(an);
134 if (coef !=
NULL) *coef = an;
139 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
144 PR->Tail_Minus_mm_Mult_qq(lm, t2,
pLength(t2) , spNoether);
146 PR->LmDeleteAndIter();
149 #ifdef HAVE_SHIFTBBA_NONEXISTENT
158 PR->SetShortExpVector();
174 #ifdef TEST_OPT_DEBUG_RED
185 ring tailRing = PR->tailRing;
189 poly p1 = PR->GetLmTailRing();
190 poly p2 = PW->GetLmTailRing();
191 poly t2 =
pNext(p2), lm = p1;
212 poly _p = (PR->t_p !=
NULL ? PR->t_p : PR->p);
215 if (PR->t_p!=
NULL) PR->t_p=_p;
else PR->p=_p;
224 PR->LmDeleteAndIter();
225 if (coef !=
NULL) *coef =
n_Init(1, tailRing);
238 if (strat ==
NULL)
return 2;
241 p1 = PR->GetLmTailRing();
242 p2 = PW->GetLmTailRing();
257 if ((ct == 0) || (ct == 2))
258 PR->Tail_Mult_nn(an);
259 if (coef !=
NULL) *coef = an;
264 if (coef !=
NULL) *coef =
n_Init(1, tailRing);
269 PR->Tail_Minus_mm_Mult_qq(lm, t2,
pLength(t2) , spNoether);
271 PR->LmDeleteAndIter();
274 #ifdef HAVE_SHIFTBBA_NONEXISTENT
283 PR->SetShortExpVector();
287 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
313 #ifdef TEST_OPT_DEBUG_RED
322 ring tailRing = PR->tailRing;
356 poly sigMult =
pCopy(PW->sig);
359 printf(
"IN KSREDUCEPOLYSIG: \n");
363 printf(
"--------------\n");
368 printf(
"------------------- IN KSREDUCEPOLYSIG: --------------------\n");
373 printf(
"--------------\n");
380 printf(
"%d -- %d sig\n",sigSafe,PW->is_sigsafe);
389 PR->is_redundant =
TRUE;
394 PR->is_redundant =
FALSE;
395 poly p1 = PR->GetLmTailRing();
396 poly p2 = PW->GetLmTailRing();
397 poly t2 =
pNext(p2), lm = p1;
418 poly _p = (PR->t_p !=
NULL ? PR->t_p : PR->p);
421 if (PR->t_p!=
NULL) PR->t_p=_p;
else PR->p=_p;
430 PR->LmDeleteAndIter();
431 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
444 if (strat ==
NULL)
return 2;
447 p1 = PR->GetLmTailRing();
448 p2 = PW->GetLmTailRing();
463 if ((ct == 0) || (ct == 2))
464 PR->Tail_Mult_nn(an);
465 if (coef !=
NULL) *coef = an;
470 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
475 PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
477 PR->LmDeleteAndIter();
480 #ifdef HAVE_SHIFTBBA_NONEXISTENT
489 PR->SetShortExpVector();
493 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
511 #ifdef TEST_OPT_DEBUG_RED
520 ring tailRing = PR->tailRing;
554 poly sigMult =
pCopy(PW->sig);
557 printf(
"IN KSREDUCEPOLYSIG: \n");
561 printf(
"--------------\n");
575 printf(
"------------------- IN KSREDUCEPOLYSIG: --------------------\n");
580 printf(
"--------------\n");
589 printf(
"%d -- %d sig\n",sigSafe,PW->is_sigsafe);
595 poly origsig =
pCopy(PR->sig);
606 if(
pLtCmp(PR->sig,origsig) == 1)
610 PR->is_redundant =
TRUE;
616 if(
pLtCmp(PR->sig,origsig) == -1)
628 PR->is_redundant =
TRUE;
633 PR->is_redundant =
FALSE;
634 poly p1 = PR->GetLmTailRing();
635 poly p2 = PW->GetLmTailRing();
636 poly t2 =
pNext(p2), lm = p1;
657 poly _p = (PR->t_p !=
NULL ? PR->t_p : PR->p);
660 if (PR->t_p!=
NULL) PR->t_p=_p;
else PR->p=_p;
669 PR->LmDeleteAndIter();
670 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
683 if (strat ==
NULL)
return 2;
686 p1 = PR->GetLmTailRing();
687 p2 = PW->GetLmTailRing();
698 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
708 if (((ct == 0) || (ct == 2)))
709 PR->Tail_Mult_nn(an);
710 if (coef !=
NULL) *coef = an;
715 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
720 PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
722 PR->LmDeleteAndIter();
725 #ifdef HAVE_SHIFTBBA_NONEXISTENT
734 PR->SetShortExpVector();
737 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
753 int use_buckets, ring tailRing,
762 Pair->tailRing = tailRing;
802 if (Pair->i_r1 == -1)
808 l1 = (
R[Pair->i_r1])->GetpLength() - 1;
810 if ((Pair->i_r2 == -1)||(
R[Pair->i_r2]==
NULL))
816 l2 = (
R[Pair->i_r2])->GetpLength() - 1;
821 if (spNoether !=
NULL)
824 a2 = tailRing->p_Procs->pp_Mult_mm_Noether(a2, m2, spNoether, l2, tailRing);
828 a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing);
833 Pair->SetLmTail(m2, a2, l2, use_buckets, tailRing);
836 Pair->Tail_Minus_mm_Mult_qq(m1, a1, l1, spNoether);
839 Pair->LmDeleteAndIter();
855 #ifdef HAVE_SHIFTBBA_NONEXISTENT
864 Pair->SetShortExpVector();
874 poly Lp = PR->GetLmCurrRing();
875 poly Save = PW->GetLmCurrRing();
895 if (Current == PR->p && PR->t_p !=
NULL)
901 pNext(Current) = Red.GetLmTailRing();
902 if (Current == PR->p && PR->t_p !=
NULL)
910 #ifdef HAVE_SHIFTBBA_NONEXISTENT
919 PR->SetShortExpVector();
930 poly Lp = PR->GetLmCurrRing();
931 poly Save = PW->GetLmCurrRing();
951 if (Current == PR->p && PR->t_p !=
NULL)
957 pNext(Current) = Red.GetLmTailRing();
958 if (Current == PR->p && PR->t_p !=
NULL)
966 #ifdef HAVE_SHIFTBBA_NONEXISTENT
975 PR->SetShortExpVector();
1049 if ((c1==c2)||(c2!=0))
1099 if ((c1==c2)||(c1!=0))
static CanonicalForm bound(const CFMatrix &M)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
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_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
int ksCheckCoeff(number *a, number *b)
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
int ksReducePolyTail(LObject *PR, TObject *PW, poly Current, poly spNoether)
int ksReducePolyTailBound(LObject *PR, TObject *PW, int bound, poly Current, poly spNoether)
int ksReducePolySig(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
int ksReducePolyBound(LObject *PR, TObject *PW, int bound, poly spNoether, number *coef, kStrategy strat)
int ksReducePolySigRing(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
BOOLEAN kTest_L(LObject *L, ring strat_tailRing, BOOLEAN testp, int lpos, TSet T, int tlength)
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
BOOLEAN kTest_T(TObject *T, ring strat_tailRing, int i, char TN)
void nc_PolyPolyRed(poly &b, poly p, number *c, const ring r)
static void nc_kBucketPolyRed_Z(kBucket_pt b, poly p, number *c)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
#define __p_GetComp(p, r)
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
static void p_LmDelete(poly p, const ring r)
BOOLEAN pIsMonomOf(poly p, poly m)
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
static void p_SetCompP(poly p, int i, 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 unsigned long p_SetComp(poly p, unsigned long c, ring r)
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
static void p_Setm(poly p, const ring r)
static number p_SetCoeff(poly p, number n, ring r)
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 BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
static unsigned pLength(poly a)
BOOLEAN p_CheckPolyRing(poly p, ring r)
static void p_LmFree(poly p, ring)
static poly p_Init(const ring r, omBin bin)
BOOLEAN pHaveCommonMonoms(poly p, poly q)
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
static void p_ExpVectorAddSub(poly p1, poly p2, poly p3, const ring r)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Compatiblity layer for legacy polynomial operations (over currRing)
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
#define pCopy(p)
return a copy of the poly
static BOOLEAN rField_is_Ring(const ring r)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
static BOOLEAN rField_is_Domain(const ring r)
poly p_Shrink(poly p, int lV, const ring r)