Functions
ratgring.cc File Reference
#include <kernel/mod2.h>
#include <kernel/GBEngine/ratgring.h>
#include <polys/nc/nc.h>
#include <polys/monomials/ring.h>
#include <kernel/polys.h>
#include <coeffs/numbers.h>
#include <kernel/ideals.h>
#include <polys/matpol.h>
#include <polys/kbuckets.h>
#include <kernel/GBEngine/kstd1.h>
#include <polys/sbuckets.h>
#include <polys/prCopy.h>
#include <polys/operations/p_Mult_q.h>
#include <polys/clapsing.h>
#include <misc/options.h>

Go to the source code of this file.

Functions

void pLcmRat (poly a, poly b, poly m, int rat_shift)
 
poly p_HeadRat (poly p, int ishift, ring r)
 
void p_ExpVectorDiffRat (poly pr, poly p1, poly p2, int ishift, ring r)
 
ideal ncGCD2 (poly p, poly q, const ring r)
 
ideal ncGCD (poly p, poly q, const ring r)
 
poly nc_rat_CreateSpoly (poly pp1, poly pp2, int ishift, const ring r)
 
poly nc_rat_ReduceSpolyNew (const poly p1, poly p2, int ishift, const ring r)
 
BOOLEAN p_DivisibleByRat (poly a, poly b, int ishift, const ring r)
 
int redRat (poly *h, poly *reducer, int *red_length, int rl, int ishift, ring r)
 
BOOLEAN p_LmIsConstantRat (const poly p, const ring r)
 
BOOLEAN p_LmIsConstantCompRat (const poly p, const ring r)
 

Function Documentation

§ nc_rat_CreateSpoly()

poly nc_rat_CreateSpoly ( poly  pp1,
poly  pp2,
int  ishift,
const ring  r 
)

Definition at line 341 of file ratgring.cc.

342 {
343 
344  poly p1 = p_Copy(pp1,r);
345  poly p2 = p_Copy(pp2,r);
346 
347  const long lCompP1 = p_GetComp(p1,r);
348  const long lCompP2 = p_GetComp(p2,r);
349 
350  if ((lCompP1!=lCompP2) && (lCompP1!=0) && (lCompP2!=0))
351  {
352 #ifdef PDEBUG
353  WerrorS("nc_rat_CreateSpoly: different non-zero components!");
354 #endif
355  return(NULL);
356  }
357 
358  if ( (p_LmIsConstantRat(p1,r)) || (p_LmIsConstantRat(p2,r)) )
359  {
360  p_Delete(&p1,r);
361  p_Delete(&p2,r);
362  return( NULL );
363  }
364 
365 
366 /* note: prod. crit does not apply! */
367  poly pL=pOne();
368  poly m1=pOne();
369  poly m2=pOne();
370  int is = ishift; /* TODO */
371  pLcmRat(p1,p2,pL,is);
372  p_Setm(pL,r);
373 #ifdef PDEBUG
374  p_Test(pL,r);
375 #endif
376  poly pr1 = p_GetExp_k_n(p1,1,ishift,r); /* rat D-exp of p1 */
377  poly pr2 = p_GetExp_k_n(p2,1,ishift,r); /* rat D-exp of p2 */
378  p_ExpVectorDiff(m1,pL,pr1,r); /* purely in D part by construction */
379  p_ExpVectorDiff(m2,pL,pr2,r); /* purely in D part by construction */
380  p_Delete(&pr1,r);
381  p_Delete(&pr2,r);
382  p_Delete(&pL,r);
383 #ifdef PDEBUG
384  p_Test(m1,r);
385  PrintS("d^{gamma-alpha} = "); p_wrp(m1,r); PrintLn();
386  p_Test(m2,r);
387  PrintS("d^{gamma-beta} = "); p_wrp(m2,r); PrintLn();
388 #endif
389 
390  poly HF = NULL;
391  HF = p_HeadRat(p1,is,r); // lm_D(f)
392  HF = nc_mm_Mult_p(m1, HF, r); // // d^{gamma-alpha} lm_D(f)
393  poly C = p_GetCoeffRat(HF, is, r); // c = lc_D(h_f) in the paper
394 
395  poly HG = NULL;
396  HG = p_HeadRat(p2,is,r); // lm_D(g)
397  HG = nc_mm_Mult_p(m2, HG, r); // // d^{gamma-beta} lm_D(g)
398  poly K = p_GetCoeffRat(HG, is, r); // k = lc_D(h_g) in the paper
399 
400 #ifdef PDEBUG
401  PrintS("f: "); p_wrp(p1,r); PrintS("\n");
402  PrintS("c: "); p_wrp(C,r); PrintS("\n");
403  PrintS("g: "); p_wrp(p2,r); PrintS("\n");
404  PrintS("k: "); p_wrp(K,r); PrintS("\n");
405 #endif
406 
407  ideal ncsyz = ncGCD(C,K,r);
408  poly KK = ncsyz->m[0]; ncsyz->m[0]=NULL; //p_Copy(ncsyz->m[0],r); // k'
409  poly CC = ncsyz->m[1]; ncsyz->m[1]= NULL; //p_Copy(ncsyz->m[1],r); // c'
410  id_Delete(&ncsyz,r);
411 
412  p_LmDeleteAndNextRat(&p1, is, r); // t_f
413  p_LmDeleteAndNextRat(&HF, is, r); // r_f = h_f - lt_D(h_f)
414 
415  p_LmDeleteAndNextRat(&p2, is, r); // t_g
416  p_LmDeleteAndNextRat(&HG, is, r); // r_g = h_g - lt_D(h_g)
417 
418 
419 #ifdef PDEBUG
420  PrintS(" t_f: "); p_wrp(p1,r); PrintS("\n");
421  PrintS(" t_g: "); p_wrp(p2,r); PrintS("\n");
422  PrintS(" r_f: "); p_wrp(HF,r); PrintS("\n");
423  PrintS(" r_g: "); p_wrp(HG,r); PrintS("\n");
424  PrintS(" c': "); p_wrp(CC,r); PrintS("\n");
425  PrintS(" k': "); p_wrp(KK,r); PrintS("\n");
426 
427 #endif
428 
429  // k'(r_f + d^{gamma-alpha} t_f)
430 
431  p1 = p_Mult_q(m1, p1, r); // p1 = d^{gamma-alpha} t_f
432  p1 = p_Add_q(p1,HF,r); // p1 = r_f + d^{gamma-alpha} t_f
433  p1 = p_Mult_q(KK,p1,r); // p1 = k'(r_f + d^{gamma-alpha} t_f)
434 
435  // c'(r_f + d^{gamma-beta} t_g)
436 
437  p2 = p_Mult_q(m2, p2, r); // p2 = d^{gamma-beta} t_g
438  p2 = p_Add_q(p2,HG,r); // p2 = r_g + d^{gamma-beta} t_g
439  p2 = p_Mult_q(CC,p2,r); // p2 = c'(r_g + d^{gamma-beta} t_g)
440 
441 #ifdef PDEBUG
442  p_Test(p1,r);
443  p_Test(p2,r);
444  PrintS(" k'(r_f + d^{gamma-alpha} t_f): "); p_wrp(p1,r);
445  PrintS(" c'(r_g + d^{gamma-beta} t_g): "); p_wrp(p2,r);
446 #endif
447 
448  poly out = p_Add_q(p1,p2,r); // delete p1, p2; // the sum
449 
450 #ifdef PDEBUG
451  p_Test(out,r);
452 #endif
453 
454  // if ( out!=NULL ) pContent(out); // postponed to enterS
455  return(out);
456 }
void PrintLn()
Definition: reporter.cc:310
void pLcmRat(poly a, poly b, poly m, int rat_shift)
Definition: ratgring.cc:30
#define p_GetComp(p, r)
Definition: monomials.h:72
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void WerrorS(const char *s)
Definition: feFopen.cc:24
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
static poly nc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: nc.h:250
const ring r
Definition: syzextra.cc:208
void p_LmDeleteAndNextRat(poly *p, int ishift, ring r)
Definition: p_polys.cc:1622
poly p_GetCoeffRat(poly p, int ishift, ring r)
Definition: p_polys.cc:1644
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:298
poly p_HeadRat(poly p, int ishift, ring r)
Definition: ratgring.cc:64
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
BOOLEAN p_LmIsConstantRat(const poly p, const ring r)
Definition: ratgring.cc:643
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1397
#define NULL
Definition: omList.c:10
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
static poly p_GetExp_k_n(poly p, int l, int k, const ring r)
Definition: p_polys.h:1295
ideal ncGCD(poly p, poly q, const ring r)
Definition: ratgring.cc:160
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020

§ nc_rat_ReduceSpolyNew()

poly nc_rat_ReduceSpolyNew ( const poly  p1,
poly  p2,
int  ishift,
const ring  r 
)

Definition at line 466 of file ratgring.cc.

467 {
468  const long lCompP1 = p_GetComp(p1,r);
469  const long lCompP2 = p_GetComp(p2,r);
470 
471  if ((lCompP1!=lCompP2) && (lCompP1!=0) && (lCompP2!=0))
472  {
473 #ifdef PDEBUG
474  WerrorS("nc_rat_ReduceSpolyNew: different non-zero components!");
475 #endif
476  return(NULL);
477  }
478 
479  if (p_LmIsConstantRat(p1,r))
480  {
481  return( NULL );
482  }
483 
484 
485  int is = ishift; /* TODO */
486 
487  poly m = pOne();
488  p_ExpVectorDiffRat(m, p2, p1, ishift, r); // includes X and D parts
489  //p_Setm(m,r);
490  // m = p_GetExp_k_n(m,1,ishift,r); /* rat D-exp of m */
491 #ifdef PDEBUG
492  p_Test(m,r);
493  PrintS("d^alpha = "); p_wrp(m,r); PrintLn();
494 #endif
495 
496  /* pSetComp(m,r)=0? */
497  poly HH = NULL;
498  poly H = NULL;
499  HH = p_HeadRat(p1,is,r); //p_Copy(p_HeadRat(p1,is,r),r); // lm_D(g)
500 // H = r->nc->p_Procs.mm_Mult_p(m, p_Copy(HH, r), r); // d^aplha lm_D(g)
501  H = nc_mm_Mult_p(m, HH, r); // d^aplha lm_D(g) == h_g in the paper
502 
503  poly K = p_GetCoeffRat(H, is, r); //p_Copy( p_GetCoeffRat(H, is, r), r); // k in the paper
504  poly P = p_GetCoeffRat(p2, is, r); //p_Copy( p_GetCoeffRat(p2, is, r), r); // lc_D(p_2) == lc_D(f)
505 
506 #ifdef PDEBUG
507  PrintS("k: "); p_wrp(K,r); PrintS("\n");
508  PrintS("p: "); p_wrp(P,r); PrintS("\n");
509  PrintS("f: "); p_wrp(p2,r); PrintS("\n");
510  PrintS("g: "); p_wrp(p1,r); PrintS("\n");
511 #endif
512  // alt:
513  poly out = p_Copy(p1,r);
514  p_LmDeleteAndNextRat(&out, is, r); // out == t_g
515 
516  ideal ncsyz = ncGCD(P,K,r);
517  poly KK = ncsyz->m[0]; ncsyz->m[0]=NULL; //p_Copy(ncsyz->m[0],r); // k'
518  poly PP = ncsyz->m[1]; ncsyz->m[1]= NULL; //p_Copy(ncsyz->m[1],r); // p'
519 
520 #ifdef PDEBUG
521  PrintS("t_g: "); p_wrp(out,r);
522  PrintS("k': "); p_wrp(KK,r); PrintS("\n");
523  PrintS("p': "); p_wrp(PP,r); PrintS("\n");
524 #endif
525  id_Delete(&ncsyz,r);
526  p_LmDeleteAndNextRat(&p2, is, r); // t_f
527  p_LmDeleteAndNextRat(&H, is, r); // r_g = h_g - lt_D(h_g)
528 
529 #ifdef PDEBUG
530  PrintS(" t_f: "); p_wrp(p2,r);
531  PrintS(" r_g: "); p_wrp(H,r);
532 #endif
533 
534  p2 = p_Mult_q(KK, p2, r); // p2 = k' t_f
535 
536 #ifdef PDEBUG
537  p_Test(p2,r);
538  PrintS(" k' t_f: "); p_wrp(p2,r);
539 #endif
540 
541 // out = r->nc->p_Procs.mm_Mult_p(m, out, r); // d^aplha t_g
542  out = nc_mm_Mult_p(m, out, r); // d^aplha t_g
543  p_Delete(&m,r);
544 
545 #ifdef PDEBUG
546  PrintS(" d^a t_g: "); p_wrp(out,r);
547  PrintS(" end reduction\n");
548 #endif
549 
550  out = p_Add_q(H, out, r); // r_g + d^a t_g
551 
552 #ifdef PDEBUG
553  p_Test(out,r);
554 #endif
555  out = p_Mult_q(PP, out, r); // p' (r_g + d^a t_g)
556  out = p_Add_q(p2,out,r); // delete out, p2; // the sum
557 
558 #ifdef PDEBUG
559  p_Test(out,r);
560 #endif
561 
562  // if ( out!=NULL ) pContent(out); // postponed to enterS
563  return(out);
564 }
void PrintLn()
Definition: reporter.cc:310
#define p_GetComp(p, r)
Definition: monomials.h:72
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void WerrorS(const char *s)
Definition: feFopen.cc:24
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
static poly nc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: nc.h:250
const ring r
Definition: syzextra.cc:208
void p_LmDeleteAndNextRat(poly *p, int ishift, ring r)
Definition: p_polys.cc:1622
int m
Definition: cfEzgcd.cc:119
poly p_GetCoeffRat(poly p, int ishift, ring r)
Definition: p_polys.cc:1644
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:298
CanonicalForm H
Definition: facAbsFact.cc:64
poly p_HeadRat(poly p, int ishift, ring r)
Definition: ratgring.cc:64
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
BOOLEAN p_LmIsConstantRat(const poly p, const ring r)
Definition: ratgring.cc:643
#define NULL
Definition: omList.c:10
void p_ExpVectorDiffRat(poly pr, poly p1, poly p2, int ishift, ring r)
Definition: ratgring.cc:81
ideal ncGCD(poly p, poly q, const ring r)
Definition: ratgring.cc:160
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
kBucketDestroy & P
Definition: myNF.cc:191
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020

§ ncGCD()

ideal ncGCD ( poly  p,
poly  q,
const ring  r 
)

Definition at line 160 of file ratgring.cc.

161 {
162  // destroys p and q
163  // assume: p,q are in the comm. ring
164  // to be used in the coeff business
165 #ifdef PDEBUG
166  PrintS(" GCD_start:");
167 #endif
168  poly g = singclap_gcd(p_Copy(p,r),p_Copy(q,r), r);
169 #ifdef PDEBUG
170  p_wrp(g,r);
171  PrintS(" GCD_end;\n");
172 #endif
173  poly u = singclap_pdivide(q, g, r); //q/g
174  poly v = singclap_pdivide(p, g, r); //p/g
175  v = p_Neg(v,r);
176  p_Delete(&p,r);
177  p_Delete(&q,r);
178  ideal h = idInit(2,1);
179  h->m[0] = u; // p_Copy(u,r);
180  h->m[1] = v; // p_Copy(v,r);
181  return(h);
182 }
return P p
Definition: myNF.cc:203
poly singclap_gcd(poly f, poly g, const ring r)
destroys f and g
Definition: clapsing.cc:287
g
Definition: cfModGcd.cc:4031
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:547
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
const ring r
Definition: syzextra.cc:208
void PrintS(const char *s)
Definition: reporter.cc:284
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1013
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

§ ncGCD2()

ideal ncGCD2 ( poly  p,
poly  q,
const ring  r 
)

Definition at line 112 of file ratgring.cc.

113 {
114  // todo: must destroy p,q
115  intvec *w = NULL;
116  ideal h = idInit(2,1);
117  h->m[0] = p_Copy(p,r);
118  h->m[1] = p_Copy(q,r);
119 #ifdef PDEBUG
120  PrintS("running syzygy comp. for nc_GCD:\n");
121 #endif
122  ideal sh = idSyzygies(h, testHomog, &w);
123 #ifdef PDEBUG
124  PrintS("done syzygy comp. for nc_GCD\n");
125 #endif
126  /* in comm case, there is only 1 syzygy */
127  /* singclap_gcd(); */
128  poly K, K1, K2;
129  K = sh->m[0]; /* take just the first element - to be enhanced later */
130  K1 = pTakeOutComp(&K, 1); // 1st component is taken out from K
131 // pShift(&K,-2); // 2nd component to 0th comp.
132  K2 = pTakeOutComp(&K, 1);
133 // K2 = K;
134 
135  PrintS("syz1: "); p_wrp(K1,r);
136  PrintS("syz2: "); p_wrp(K2,r);
137 
138  /* checking signs before multiplying */
139  number ck1 = p_GetCoeff(K1,r);
140  number ck2 = p_GetCoeff(K2,r);
141  BOOLEAN bck1, bck2;
142  bck1 = n_GreaterZero(ck1,r);
143  bck2 = n_GreaterZero(ck2,r);
144  /* K1 <0, K2 <0 (-K1,-K2) */
145 // if ( !(bck1 && bck2) ) /* - , - */
146 // {
147 // K1 = p_Neg(K1,r);
148 // K2 = p_Neg(K2,r);
149 // }
150  id_Delete(&h,r);
151  h = idInit(2,1);
152  h->m[0] = p_Copy(K1,r);
153  h->m[1] = p_Copy(K2,r);
154  id_Delete(&sh,r);
155  return(h);
156 }
return P p
Definition: myNF.cc:203
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
void PrintS(const char *s)
Definition: reporter.cc:284
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
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 ...
Definition: polys.h:322
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define p_GetCoeff(p, r)
Definition: monomials.h:57
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:498
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:88
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg)
Definition: ideals.cc:515

§ p_DivisibleByRat()

BOOLEAN p_DivisibleByRat ( poly  a,
poly  b,
int  ishift,
const ring  r 
)

Definition at line 570 of file ratgring.cc.

571 {
572 #ifdef PDEBUG
573  PrintS("invoke p_DivByRat with a = ");
574  p_wrp(p_Head(a,r),r);
575  PrintS(" and b= ");
576  p_wrp(p_Head(b,r),r);
577  PrintLn();
578 #endif
579  int i;
580  for(i=r->N; i>ishift; i--)
581  {
582 #ifdef PDEBUG
583  Print("i=%d,",i);
584 #endif
585  if (p_GetExp(a,i,r) > p_GetExp(b,i,r)) return FALSE;
586  }
587  return ((p_GetComp(a,r)==p_GetComp(b,r)) || (p_GetComp(a,r)==0));
588 }
const poly a
Definition: syzextra.cc:212
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:97
#define p_GetComp(p, r)
Definition: monomials.h:72
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:812
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
const poly b
Definition: syzextra.cc:213

§ p_ExpVectorDiffRat()

void p_ExpVectorDiffRat ( poly  pr,
poly  p1,
poly  p2,
int  ishift,
ring  r 
)

Definition at line 81 of file ratgring.cc.

82 {
83  p_LmCheckPolyRing1(p1, r);
85  p_LmCheckPolyRing1(pr, r);
86  int i;
87  poly t=pr;
88  int e1,e2;
89  for (i=ishift+1; i<=r->N; i++)
90  {
91  e1 = p_GetExp(p1, i, r);
92  e2 = p_GetExp(p2, i, r);
93  // pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r));
94  if (e1 < e2)
95  {
96 #ifdef PDEBUG
97  PrintS("negative ExpVectorDiff\n");
98 #endif
99  p_Delete(&t,r);
100  break;
101  }
102  else
103  {
104  p_SetExp(t,i, e1-e2,r);
105  }
106  }
107  p_Setm(t,r);
108 }
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
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
Definition: p_polys.h:483
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
polyrec * poly
Definition: hilb.h:10

§ p_HeadRat()

poly p_HeadRat ( poly  p,
int  ishift,
ring  r 
)

Definition at line 64 of file ratgring.cc.

65 {
66  poly q = pNext(p);
67  if (q == NULL) return p;
68  poly res = p_Head(p,r);
69  const long cmp = p_GetComp(p, r);
70  while ( (q!=NULL) && (p_Comp_k_n(p, q, ishift+1, r)) && (p_GetComp(q, r) == cmp) )
71  {
72  res = p_Add_q(res,p_Head(q,r),r);
73  q = pNext(q);
74  }
75  p_SetCompP(res,cmp,r);
76  return res;
77 }
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
poly res
Definition: myNF.cc:322
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:812
const ring r
Definition: syzextra.cc:208
static int p_Comp_k_n(poly a, poly b, int k, ring r)
Definition: p_polys.h:635
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:249
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877

§ p_LmIsConstantCompRat()

BOOLEAN p_LmIsConstantCompRat ( const poly  p,
const ring  r 
)

Definition at line 652 of file ratgring.cc.

653 {
654  int i = r->real_var_end;
655 
656  while ( (p_GetExp(p,i,r)==0) && (i>=r->real_var_start))
657  {
658  i--;
659  }
660  return ( i+1 == r->real_var_start );
661 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int i
Definition: cfEzgcd.cc:123

§ p_LmIsConstantRat()

BOOLEAN p_LmIsConstantRat ( const poly  p,
const ring  r 
)

Definition at line 643 of file ratgring.cc.

644 {
645  if (p_LmIsConstantCompRat(p, r))
646  return (p_GetComp(p, r) == 0);
647  return FALSE;
648 }
#define FALSE
Definition: auxiliary.h:97
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
const ring r
Definition: syzextra.cc:208
BOOLEAN p_LmIsConstantCompRat(const poly p, const ring r)
Definition: ratgring.cc:652

§ pLcmRat()

void pLcmRat ( poly  a,
poly  b,
poly  m,
int  rat_shift 
)

Definition at line 30 of file ratgring.cc.

31 {
32  /* rat_shift is the last exp one should count with */
33  int i;
34  for (i=(currRing->N); i>=rat_shift; i--)
35  {
36  pSetExp(m,i, si_max( pGetExp(a,i), pGetExp(b,i)));
37  }
39  /* Don't do a pSetm here, otherwise hres/lres chockes */
40 }
const poly a
Definition: syzextra.cc:212
#define pSetExp(p, i, v)
Definition: polys.h:42
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
#define pSetComp(p, v)
Definition: polys.h:38
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
int i
Definition: cfEzgcd.cc:123
const poly b
Definition: syzextra.cc:213

§ redRat()

int redRat ( poly h,
poly reducer,
int *  red_length,
int  rl,
int  ishift,
ring  r 
)

Definition at line 594 of file ratgring.cc.

595 {
596  if ((*h)==NULL) return 0;
597 
598  int j,i,l;
599 
600  loop
601  {
602  j=rl;l=MAX_INT_VAL;
603  for(i=rl-1;i>=0;i--)
604  {
605  // Print("test %d, l=%d (curr=%d, l=%d\n",i,red_length[i],j,l);
606  if ((l>red_length[i]) && (p_DivisibleByRat(reducer[i],*h,ishift,r)))
607  {
608  j=i; l=red_length[i];
609  // PrintS(" yes\n");
610  }
611  // else PrintS(" no\n");
612  }
613  if (j >=rl)
614  {
615  return 1; // not reducible
616  }
617 
618  if (TEST_OPT_DEBUG)
619  {
620  PrintS("reduce ");
621  p_wrp(*h,r);
622  PrintS(" with ");
623  p_wrp(reducer[j],r);
624  }
625  poly hh=nc_rat_ReduceSpolyNew(reducer[j], *h, ishift, r);
626  // p_Delete(h,r);
627  *h=hh;
628  if (TEST_OPT_DEBUG)
629  {
630  PrintS(" to ");
631  p_wrp(*h,r);
632  PrintLn();
633  }
634  if ((*h)==NULL)
635  {
636  return 0;
637  }
638  }
639 }
void PrintLn()
Definition: reporter.cc:310
loop
Definition: myNF.cc:98
BOOLEAN p_DivisibleByRat(poly a, poly b, int ishift, const ring r)
Definition: ratgring.cc:570
poly nc_rat_ReduceSpolyNew(const poly p1, poly p2, int ishift, const ring r)
Definition: ratgring.cc:466
#define TEST_OPT_DEBUG
Definition: options.h:103
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
const int MAX_INT_VAL
Definition: mylimits.h:12
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define NULL
Definition: omList.c:10
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int l
Definition: cfEzgcd.cc:94