67 if (q ==
NULL)
return p;
68 poly
res = p_Head(
p,r);
70 while ( (q!=
NULL) && (p_Comp_k_n(
p, q, ishift+1, r)) && (
p_GetComp(q, r) == cmp) )
72 res = p_Add_q(
res,p_Head(q,r),r);
75 p_SetCompP(
res,cmp,r);
89 for (
i=ishift+1;
i<=r->N;
i++)
91 e1 = p_GetExp(p1,
i, r);
92 e2 = p_GetExp(p2,
i, r);
97 PrintS(
"negative ExpVectorDiff\n");
104 p_SetExp(t,
i, e1-e2,r);
117 h->m[0] = p_Copy(
p,r);
118 h->m[1] = p_Copy(q,r);
120 PrintS(
"running syzygy comp. for nc_GCD:\n");
124 PrintS(
"done syzygy comp. for nc_GCD\n");
142 bck1 = n_GreaterZero(ck1,r);
143 bck2 = n_GreaterZero(ck2,r);
152 h->m[0] = p_Copy(K1,r);
153 h->m[1] = p_Copy(K2,r);
343 poly p1 = p_Copy(pp1,r);
344 poly p2 = p_Copy(pp2,r);
349 if ((lCompP1!=lCompP2) && (lCompP1!=0) && (lCompP2!=0))
352 WerrorS(
"nc_rat_CreateSpoly: different non-zero components!");
375 poly pr1 = p_GetExp_k_n(p1,1,ishift,r);
376 poly pr2 = p_GetExp_k_n(p2,1,ishift,r);
377 p_ExpVectorDiff(m1,pL,pr1,r);
378 p_ExpVectorDiff(m2,pL,pr2,r);
406 ideal ncsyz =
ncGCD(C,K,r);
407 poly KK = ncsyz->m[0]; ncsyz->m[0]=
NULL;
408 poly CC = ncsyz->m[1]; ncsyz->m[1]=
NULL;
430 p1 = p_Mult_q(m1, p1, r);
431 p1 = p_Add_q(p1,HF,r);
432 p1 = p_Mult_q(KK,p1,r);
436 p2 = p_Mult_q(m2, p2, r);
437 p2 = p_Add_q(p2,HG,r);
438 p2 = p_Mult_q(CC,p2,r);
443 PrintS(
" k'(r_f + d^{gamma-alpha} t_f): ");
p_wrp(p1,r);
444 PrintS(
" c'(r_g + d^{gamma-beta} t_g): ");
p_wrp(p2,r);
447 poly out = p_Add_q(p1,p2,r);
470 if ((lCompP1!=lCompP2) && (lCompP1!=0) && (lCompP2!=0))
473 WerrorS(
"nc_rat_ReduceSpolyNew: different non-zero components!");
512 poly out = p_Copy(p1,r);
515 ideal ncsyz =
ncGCD(P,K,r);
516 poly KK = ncsyz->m[0]; ncsyz->m[0]=
NULL;
517 poly PP = ncsyz->m[1]; ncsyz->m[1]=
NULL;
533 p2 = p_Mult_q(KK, p2, r);
546 PrintS(
" end reduction\n");
549 out = p_Add_q(
H, out, r);
554 out = p_Mult_q(PP, out, r);
555 out = p_Add_q(p2,out,r);
572 PrintS(
"invoke p_DivByRat with a = ");
573 p_wrp(p_Head(a,r),r);
579 for(
i=r->N;
i>ishift;
i--)
584 if (p_GetExp(a,
i,r) > p_GetExp(
b,
i,r))
return FALSE;
593int redRat (poly*
h, poly *reducer,
int *red_length,
int rl,
int ishift, ring r)
595 if ((*
h)==
NULL)
return 0;
607 j=
i;
l=red_length[
i];
653 int i = r->real_var_end;
655 while ( (p_GetExp(
p,
i,r)==0) && (
i>=r->real_var_start))
659 return (
i+1 == r->real_var_start );
poly singclap_pdivide(poly f, poly g, const ring r)
const Variable & v
< [in] a sqrfree bivariate poly
void WerrorS(const char *s)
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
static poly nc_mm_Mult_p(const poly m, poly p, const ring r)
#define p_LmCheckPolyRing1(p, r)
void p_LmDeleteAndNextRat(poly *p, int ishift, ring r)
poly p_GetCoeffRat(poly p, int ishift, ring r)
void p_wrp(poly p, ring lmRing, ring tailRing)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
poly singclap_gcd(poly f, poly g, const ring r)
polynomial gcd via singclap_gcd_r resp. idSyzygies destroys f and g
Compatibility layer for legacy polynomial operations (over currRing).
#define pGetComp(p)
Component.
#define pGetExp(p, i)
Exponent.
void pTakeOutComp(poly *p, long comp, poly *q, int *lq, const ring R=currRing)
Splits *p into two polys: *q which consists of all monoms with component == comp and *p of all other ...
BOOLEAN p_DivisibleByRat(poly a, poly b, int ishift, const ring r)
poly nc_rat_CreateSpoly(poly pp1, poly pp2, int ishift, const ring r)
BOOLEAN p_LmIsConstantCompRat(const poly p, const ring r)
BOOLEAN p_LmIsConstantRat(const poly p, const ring r)
void pLcmRat(poly a, poly b, poly m, int rat_shift)
poly p_HeadRat(poly p, int ishift, ring r)
ideal ncGCD2(poly p, poly q, const ring r)
void p_ExpVectorDiffRat(poly pr, poly p1, poly p2, int ishift, ring r)
ideal ncGCD(poly p, poly q, const ring r)
int redRat(poly *h, poly *reducer, int *red_length, int rl, int ishift, ring r)
poly nc_rat_ReduceSpolyNew(const poly p1, poly p2, int ishift, const ring r)
void PrintS(const char *s)
ideal idInit(int idsize, int rank)
initialise an ideal / module
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix