28#define TEST_OPT_DEBUG_RED
42#ifdef STDZ_EXCHANGE_DURING_REDUCTION
51#ifdef TEST_OPT_DEBUG_RED
62 ring tailRing =
PR->tailRing;
68 poly p1 =
PR->GetLmTailRing();
69 poly p2 =
PW->GetLmTailRing();
110 if ((
ct == 0) || (
ct == 2))
111 PR->Tail_Mult_nn(
an);
112 if (coef !=
NULL) *coef =
an;
115 PR->LmDeleteAndIter();
116 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
129 if (strat ==
NULL)
return 2;
132 p1 =
PR->GetLmTailRing();
133 p2 =
PW->GetLmTailRing();
143 if (tailRing->isLPring)
158 if ((
ct == 0) || (
ct == 2))
159 PR->Tail_Mult_nn(
an);
160 if (coef !=
NULL) *coef =
an;
165 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
171 if (tailRing->isLPring)
181 PR->LmDeleteAndIter();
197#ifdef TEST_OPT_DEBUG_RED
208 ring tailRing =
PR->tailRing;
215 poly p1 =
PR->GetLmTailRing();
216 poly p2 =
PW->GetLmTailRing();
250 PR->LmDeleteAndIter();
251 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
264 if (strat ==
NULL)
return 2;
267 p1 =
PR->GetLmTailRing();
268 p2 =
PW->GetLmTailRing();
278 if (tailRing->isLPring)
311 if ((
ct == 0) || (
ct == 2))
312 PR->Tail_Mult_nn(
an);
313 if (coef !=
NULL) *coef =
an;
318 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
324 if (tailRing->isLPring)
326 poly
tmp=tailRing->p_Procs->pp_Mult_mm(t2,
lmRight, tailRing);
338 PR->LmDeleteAndIter();
343#ifdef STDZ_EXCHANGE_DURING_REDUCTION
352#ifdef TEST_OPT_DEBUG_RED
363 ring tailRing =
PR->tailRing;
370 poly p1 =
PR->GetLmTailRing();
371 poly p2 =
PW->GetLmTailRing();
407 if (strat ==
NULL)
return 2;
410 p1 =
PR->GetLmTailRing();
411 p2 =
PW->GetLmTailRing();
420 if (tailRing->isLPring)
444 PR->Tail_Mult_nn(
an);
448 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
454 if (tailRing->isLPring)
485#ifdef TEST_OPT_DEBUG_RED
498 ring tailRing =
PR->tailRing;
505 poly p1 =
PR->GetLmTailRing();
506 poly p2 =
PW->GetLmTailRing();
544 if (strat ==
NULL)
return 2;
547 p1 =
PR->GetLmTailRing();
548 p2 =
PW->GetLmTailRing();
557 if (tailRing->isLPring)
567 if (tailRing->isLPring)
578 PR->LmDeleteAndIter();
581#if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
600#ifdef TEST_OPT_DEBUG_RED
611 ring tailRing =
PR->tailRing;
618 poly p1 =
PR->GetLmTailRing();
619 poly p2 =
PW->GetLmTailRing();
653 PR->LmDeleteAndIter();
654 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
667 if (strat ==
NULL)
return 2;
670 p1 =
PR->GetLmTailRing();
671 p2 =
PW->GetLmTailRing();
681 if (tailRing->isLPring)
696 if ((
ct == 0) || (
ct == 2))
697 PR->Tail_Mult_nn(
an);
698 if (coef !=
NULL) *coef =
an;
703 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
709 if (tailRing->isLPring)
719 PR->LmDeleteAndIter();
721#if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
747#ifdef TEST_OPT_DEBUG_RED
756 ring tailRing =
PR->tailRing;
796 printf(
"IN KSREDUCEPOLYSIG: \n");
800 printf(
"--------------\n");
805 printf(
"------------------- IN KSREDUCEPOLYSIG: --------------------\n");
810 printf(
"--------------\n");
832 poly p1 =
PR->GetLmTailRing();
833 poly p2 =
PW->GetLmTailRing();
867 PR->LmDeleteAndIter();
868 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
881 if (strat ==
NULL)
return 2;
884 p1 =
PR->GetLmTailRing();
885 p2 =
PW->GetLmTailRing();
895 if (tailRing->isLPring)
910 if ((
ct == 0) || (
ct == 2))
911 PR->Tail_Mult_nn(
an);
912 if (coef !=
NULL) *coef =
an;
917 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
923 if (tailRing->isLPring)
933 PR->LmDeleteAndIter();
935#if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
953#ifdef TEST_OPT_DEBUG_RED
962 ring tailRing =
PR->tailRing;
1002 printf(
"IN KSREDUCEPOLYSIG: \n");
1006 printf(
"--------------\n");
1020 printf(
"------------------- IN KSREDUCEPOLYSIG: --------------------\n");
1025 printf(
"--------------\n");
1079 poly p1 =
PR->GetLmTailRing();
1080 poly p2 =
PW->GetLmTailRing();
1114 PR->LmDeleteAndIter();
1115 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
1128 if (strat ==
NULL)
return 2;
1131 p1 =
PR->GetLmTailRing();
1132 p2 =
PW->GetLmTailRing();
1142 if (tailRing->isLPring)
1154 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
1164 if (((
ct == 0) || (
ct == 2)))
1165 PR->Tail_Mult_nn(
an);
1166 if (coef !=
NULL) *coef =
an;
1171 if (coef !=
NULL) *coef =
n_Init(1, tailRing->cf);
1177 if (tailRing->isLPring)
1187 PR->LmDeleteAndIter();
1189#if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
1205 int use_buckets,
ring tailRing,
1213 Pair->tailRing = tailRing;
1250 if (tailRing->isLPring)
1264 if (
Pair->i_r1 == -1)
1270 l1 = (
R[
Pair->i_r1])->GetpLength() - 1;
1278 l2 = (
R[
Pair->i_r2])->GetpLength() - 1;
1284 if (tailRing->isLPring)
1287 poly
tmp= tailRing->p_Procs->pp_mm_Mult(a2, m2, tailRing);
1288 a2 = tailRing->p_Procs->pp_Mult_mm(
tmp,
m22, tailRing);
1296 a2 = tailRing->p_Procs->pp_Mult_mm_Noether(a2, m2,
spNoether,
l2, tailRing);
1301 a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing);
1305 Pair->SetLmTail(m2, a2,
l2, use_buckets, tailRing);
1308 if (tailRing->isLPring)
1311 poly
tmp=tailRing->p_Procs->pp_Mult_mm(a1,
m12, tailRing);
1323 Pair->LmDeleteAndIter();
1326 if (tailRing->isLPring)
1355 poly
Lp =
PR->GetLmCurrRing();
1356 poly
Save =
PW->GetLmCurrRing();
1374 if (Current ==
PR->p &&
PR->t_p !=
NULL)
1380 pNext(Current) =
Red.GetLmTailRing();
1381 if (Current ==
PR->p &&
PR->t_p !=
NULL)
1395 poly
Lp =
PR->GetLmCurrRing();
1396 poly
Save =
PW->GetLmCurrRing();
1414 if (Current ==
PR->p &&
PR->t_p !=
NULL)
1420 pNext(Current) =
Red.GetLmTailRing();
1421 if (Current ==
PR->p &&
PR->t_p !=
NULL)
1452 if (tailRing->isLPring)
1492 if (tailRing->isLPring)
1533 if (tailRing->isLPring && (
shift2!=0))
1585 if (tailRing->isLPring && (
shift1!=0))
1644 if (tailRing->isLPring)
1663 if (tailRing->isLPring)
1696 if (tailRing->isLPring)
1738 if (tailRing->isLPring)
static int si_max(const int a, const int b)
static CanonicalForm bound(const CFMatrix &M)
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
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_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, const coeffs r)
int ksReducePolyLC(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 ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, poly *mon, kStrategy strat, BOOLEAN reduce)
int ksReducePolySig(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
int ksReducePolyBound(LObject *PR, TObject *PW, int, 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 kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
BOOLEAN kTest_L(LObject *L, kStrategy strat, BOOLEAN testp, int lpos, TSet T, int tlength)
BOOLEAN kTest_T(TObject *T, kStrategy strat, int i, char TN)
int ksReducePolyGCD(LObject *PR, TObject *PW, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
int ksReducePolyZ(LObject *PR, TObject *PW, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
static void nc_kBucketPolyRed_Z(kBucket_pt b, poly p, number *c, BOOLEAN reduce)
void nc_PolyPolyRed(poly &b, poly p, number *c, const ring r)
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 int pLength(poly a)
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 void p_Delete(poly *p, const ring r)
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)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Compatibility 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
void StringSetS(const char *st)
void StringAppendS(const char *st)
void PrintS(const char *s)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
static BOOLEAN rField_is_Domain(const ring r)
#define rField_is_Ring(R)
poly p_LPCopyAndShiftLM(poly p, int sh, const ring r)
int p_mFirstVblock(poly p, const ring ri)
int p_FirstVblock(poly p, const ring r)
void k_SplitFrame(poly &m1, poly &m2, int at, const ring r)