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();
162 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED) 181 #ifdef TEST_OPT_DEBUG_RED 192 ring tailRing = PR->tailRing;
196 poly p1 = PR->GetLmTailRing();
197 poly p2 = PW->GetLmTailRing();
198 poly t2 =
pNext(p2), lm = p1;
219 poly _p = (PR->t_p !=
NULL ? PR->t_p : PR->p);
222 if (PR->t_p!=
NULL) PR->t_p=_p;
else PR->p=_p;
231 PR->LmDeleteAndIter();
232 if (coef !=
NULL) *coef =
n_Init(1, tailRing);
245 if (strat ==
NULL)
return 2;
248 p1 = PR->GetLmTailRing();
249 p2 = PW->GetLmTailRing();
264 if ((ct == 0) || (ct == 2))
265 PR->Tail_Mult_nn(an);
266 if (coef !=
NULL) *coef = an;
271 if (coef !=
NULL) *coef =
n_Init(1, tailRing);
276 PR->Tail_Minus_mm_Mult_qq(lm, t2,
pLength(t2) , spNoether);
278 PR->LmDeleteAndIter();
281 #ifdef HAVE_SHIFTBBA_NONEXISTENT 290 PR->SetShortExpVector();
294 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED) 320 #ifdef TEST_OPT_DEBUG_RED 329 ring tailRing = PR->tailRing;
363 poly sigMult =
pCopy(PW->sig);
366 printf(
"IN KSREDUCEPOLYSIG: \n");
370 printf(
"--------------\n");
375 printf(
"------------------- IN KSREDUCEPOLYSIG: --------------------\n");
380 printf(
"--------------\n");
387 printf(
"%d -- %d sig\n",sigSafe,PW->is_sigsafe);
396 PR->is_redundant =
TRUE;
401 PR->is_redundant =
FALSE;
402 poly p1 = PR->GetLmTailRing();
403 poly p2 = PW->GetLmTailRing();
404 poly t2 =
pNext(p2), lm = p1;
425 poly _p = (PR->t_p !=
NULL ? PR->t_p : PR->p);
428 if (PR->t_p!=
NULL) PR->t_p=_p;
else PR->p=_p;
437 PR->LmDeleteAndIter();
438 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
451 if (strat ==
NULL)
return 2;
454 p1 = PR->GetLmTailRing();
455 p2 = PW->GetLmTailRing();
470 if ((ct == 0) || (ct == 2))
471 PR->Tail_Mult_nn(an);
472 if (coef !=
NULL) *coef = an;
477 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
482 PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
484 PR->LmDeleteAndIter();
487 #ifdef HAVE_SHIFTBBA_NONEXISTENT 496 PR->SetShortExpVector();
500 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED) 518 #ifdef TEST_OPT_DEBUG_RED 527 ring tailRing = PR->tailRing;
561 poly sigMult =
pCopy(PW->sig);
564 printf(
"IN KSREDUCEPOLYSIG: \n");
568 printf(
"--------------\n");
582 printf(
"------------------- IN KSREDUCEPOLYSIG: --------------------\n");
587 printf(
"--------------\n");
596 printf(
"%d -- %d sig\n",sigSafe,PW->is_sigsafe);
602 poly origsig =
pCopy(PR->sig);
613 if(
pLtCmp(PR->sig,origsig) == 1)
617 PR->is_redundant =
TRUE;
623 if(
pLtCmp(PR->sig,origsig) == -1)
635 PR->is_redundant =
TRUE;
640 PR->is_redundant =
FALSE;
641 poly p1 = PR->GetLmTailRing();
642 poly p2 = PW->GetLmTailRing();
643 poly t2 =
pNext(p2), lm = p1;
664 poly _p = (PR->t_p !=
NULL ? PR->t_p : PR->p);
667 if (PR->t_p!=
NULL) PR->t_p=_p;
else PR->p=_p;
676 PR->LmDeleteAndIter();
677 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
690 if (strat ==
NULL)
return 2;
693 p1 = PR->GetLmTailRing();
694 p2 = PW->GetLmTailRing();
705 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
715 if (((ct == 0) || (ct == 2)))
716 PR->Tail_Mult_nn(an);
717 if (coef !=
NULL) *coef = an;
722 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
727 PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
729 PR->LmDeleteAndIter();
732 #ifdef HAVE_SHIFTBBA_NONEXISTENT 741 PR->SetShortExpVector();
744 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED) 760 int use_buckets, ring tailRing,
769 Pair->tailRing = tailRing;
809 if (Pair->i_r1 == -1)
815 l1 = (R[Pair->i_r1])->GetpLength() - 1;
817 if ((Pair->i_r2 == -1)||(R[Pair->i_r2]==
NULL))
823 l2 = (R[Pair->i_r2])->GetpLength() - 1;
828 if (spNoether !=
NULL)
831 a2 = tailRing->p_Procs->pp_Mult_mm_Noether(a2, m2, spNoether, l2, tailRing);
835 a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing);
840 Pair->SetLmTail(m2, a2, l2, use_buckets, tailRing);
843 Pair->Tail_Minus_mm_Mult_qq(m1, a1, l1, spNoether);
846 Pair->LmDeleteAndIter();
862 #ifdef HAVE_SHIFTBBA_NONEXISTENT 871 Pair->SetShortExpVector();
881 poly Lp = PR->GetLmCurrRing();
882 poly Save = PW->GetLmCurrRing();
902 if (Current == PR->p && PR->t_p !=
NULL)
908 pNext(Current) = Red.GetLmTailRing();
909 if (Current == PR->p && PR->t_p !=
NULL)
917 #ifdef HAVE_SHIFTBBA_NONEXISTENT 926 PR->SetShortExpVector();
937 poly Lp = PR->GetLmCurrRing();
938 poly Save = PW->GetLmCurrRing();
958 if (Current == PR->p && PR->t_p !=
NULL)
964 pNext(Current) = Red.GetLmTailRing();
965 if (Current == PR->p && PR->t_p !=
NULL)
973 #ifdef HAVE_SHIFTBBA_NONEXISTENT 982 PR->SetShortExpVector();
1056 if ((c1==c2)||(c2!=0))
1106 if ((c1==c2)||(c1!=0))
#define __p_GetComp(p, r)
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)
static CanonicalForm bound(const CFMatrix &M)
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)
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 ksReducePolyTailBound(LObject *PR, TObject *PW, int bound, poly Current, poly spNoether)
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)
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)
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)
static unsigned pLength(poly a)
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
int ksReducePolyBound(LObject *PR, TObject *PW, int bound, poly spNoether, number *coef, kStrategy strat)
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)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
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)