My Project  UNKNOWN_GIT_VERSION
Macros | Functions | Variables
p_polys.cc File Reference
#include <ctype.h>
#include "omalloc/omalloc.h"
#include "misc/auxiliary.h"
#include "misc/options.h"
#include "misc/intvec.h"
#include "coeffs/longrat.h"
#include "coeffs/numbers.h"
#include "polys/PolyEnumerator.h"
#include "polys/ext_fields/transext.h"
#include "polys/ext_fields/algext.h"
#include "polys/weight.h"
#include "polys/simpleideals.h"
#include "ring.h"
#include "p_polys.h"
#include "polys/templates/p_MemCmp.h"
#include "polys/templates/p_MemAdd.h"
#include "polys/templates/p_MemCopy.h"
#include "nc/nc.h"
#include "nc/sca.h"
#include "clapsing.h"
#include "polys/templates/p_Delete__T.cc"

Go to the source code of this file.

Macros

#define TRANSEXT_PRIVATES
 
#define MYTEST   0
 
#define CLEARENUMERATORS   1
 
#define Sy_bit_L(x)   (((unsigned long)1L)<<(x))
 
#define LINKAGE
 
#define p_Delete__T   p_ShallowDelete
 
#define n_Delete__T(n, r)   do {} while (0)
 

Functions

poly p_Farey (poly p, number N, const ring r)
 
poly p_ChineseRemainder (poly *xx, number *x, number *q, int rl, CFArray &inv_cache, const ring R)
 
void p_Setm_General (poly p, const ring r)
 
void p_Setm_Syz (poly p, ring r, int *Components, long *ShiftedComponents)
 
void p_Setm_Dummy (poly p, const ring r)
 
void p_Setm_TotalDegree (poly p, const ring r)
 
void p_Setm_WFirstTotalDegree (poly p, const ring r)
 
p_SetmProc p_GetSetmProc (const ring r)
 
long p_Deg (poly a, const ring r)
 
long p_WFirstTotalDegree (poly p, const ring r)
 
long p_WTotaldegree (poly p, const ring r)
 
long p_DegW (poly p, const short *w, const ring R)
 
int p_Weight (int i, const ring r)
 
long p_WDegree (poly p, const ring r)
 
long pLDeg0 (poly p, int *l, const ring r)
 
long pLDeg0c (poly p, int *l, const ring r)
 
long pLDegb (poly p, int *l, const ring r)
 
long pLDeg1 (poly p, int *l, const ring r)
 
long pLDeg1c (poly p, int *l, const ring r)
 
long pLDeg1_Deg (poly p, int *l, const ring r)
 
long pLDeg1c_Deg (poly p, int *l, const ring r)
 
long pLDeg1_Totaldegree (poly p, int *l, const ring r)
 
long pLDeg1c_Totaldegree (poly p, int *l, const ring r)
 
long pLDeg1_WFirstTotalDegree (poly p, int *l, const ring r)
 
long pLDeg1c_WFirstTotalDegree (poly p, int *l, const ring r)
 
static unsigned long p_GetMaxExpL2 (unsigned long l1, unsigned long l2, const ring r, unsigned long number_of_exp)
 
static unsigned long p_GetMaxExpL2 (unsigned long l1, unsigned long l2, const ring r)
 
poly p_GetMaxExpP (poly p, const ring r)
 return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0, next == NULL, ord is not set More...
 
unsigned long p_GetMaxExpL (poly p, const ring r, unsigned long l_max)
 return the maximal exponent of p in form of the maximal long var More...
 
BOOLEAN p_OneComp (poly p, const ring r)
 return TRUE if all monoms have the same component More...
 
int p_IsPurePower (const poly p, const ring r)
 return i, if head depends only on var(i) More...
 
int p_IsUnivariate (poly p, const ring r)
 return i, if poly depends only on var(i) More...
 
int p_GetVariables (poly p, int *e, const ring r)
 set entry e[i] to 1 if var(i) occurs in p, ignore var(j) if e[j]>0 return #(e[i]>0) More...
 
poly p_ISet (long i, const ring r)
 returns the poly representing the integer i More...
 
poly p_One (const ring r)
 
void p_Split (poly p, poly *h)
 
BOOLEAN p_HasNotCF (poly p1, poly p2, const ring r)
 
const char * p_Read (const char *st, poly &rc, const ring r)
 
poly p_mInit (const char *st, BOOLEAN &ok, const ring r)
 
poly p_NSet (number n, const ring r)
 returns the poly representing the number n, destroys n More...
 
poly p_MDivide (poly a, poly b, const ring r)
 
poly p_Div_nn (poly p, const number n, const ring r)
 
poly p_Div_mm (poly p, const poly m, const ring r)
 divide polynomial by monomial More...
 
poly p_DivideM (poly a, poly b, const ring r)
 
BOOLEAN p_DivisibleByRingCase (poly f, poly g, const ring r)
 divisibility check over ground ring (which may contain zero divisors); TRUE iff LT(f) divides LT(g), i.e., LT(f)*c*m = LT(g), for some coefficient c and some monomial m; does not take components into account More...
 
void p_Lcm (const poly a, const poly b, poly m, const ring r)
 
poly p_Lcm (const poly a, const poly b, const ring r)
 
poly p_LcmRat (const poly a, const poly b, const long lCompM, const ring r)
 
void p_LmDeleteAndNextRat (poly *p, int ishift, ring r)
 
poly p_GetCoeffRat (poly p, int ishift, ring r)
 
void p_ContentRat (poly &ph, const ring r)
 
poly p_PolyDiv (poly &p, const poly divisor, const BOOLEAN needResult, const ring r)
 assumes that p and divisor are univariate polynomials in r, mentioning the same variable; assumes divisor != NULL; p may be NULL; assumes a global monomial ordering in r; performs polynomial division of p by divisor: More...
 
poly p_Diff (poly a, int k, const ring r)
 
static poly p_DiffOpM (poly a, poly b, BOOLEAN multiply, const ring r)
 
poly p_DiffOp (poly a, poly b, BOOLEAN multiply, const ring r)
 
poly p_Sub (poly p1, poly p2, const ring r)
 
static poly p_MonPower (poly p, int exp, const ring r)
 
static void p_MonMult (poly p, poly q, const ring r)
 
static poly p_MonMultC (poly p, poly q, const ring rr)
 
static number * pnBin (int exp, const ring r)
 
static void pnFreeBin (number *bin, int exp, const coeffs r)
 
static poly p_TwoMonPower (poly p, int exp, const ring r)
 
static poly p_Pow (poly p, int i, const ring r)
 
static poly p_Pow_charp (poly p, int i, const ring r)
 
poly p_Power (poly p, int i, const ring r)
 
void p_Content (poly ph, const ring r)
 
void p_ContentForGB (poly ph, const ring r)
 
void p_SimpleContent (poly ph, int smax, const ring r)
 
number p_InitContent (poly ph, const ring r)
 
poly p_Cleardenom (poly p, const ring r)
 
void p_Cleardenom_n (poly ph, const ring r, number &c)
 
void p_ProjectiveUnique (poly ph, const ring r)
 
int p_Size (poly p, const ring r)
 
poly p_Homogen (poly p, int varnum, const ring r)
 
BOOLEAN p_IsHomogeneous (poly p, const ring r)
 
BOOLEAN p_VectorHasUnitB (poly p, int *k, const ring r)
 
void p_VectorHasUnit (poly p, int *k, int *len, const ring r)
 
poly p_TakeOutComp1 (poly *p, int k, const ring r)
 
poly p_TakeOutComp (poly *p, int k, const ring r)
 
void p_TakeOutComp (poly *r_p, long comp, poly *r_q, int *lq, const ring r)
 
void p_DeleteComp (poly *p, int k, const ring r)
 
poly p_Vec2Poly (poly v, int k, const ring r)
 
void p_Vec2Array (poly v, poly *p, int len, const ring r)
 vector to already allocated array (len>=p_MaxComp(v,r)) More...
 
void p_Vec2Polys (poly v, poly **p, int *len, const ring r)
 
void pSetDegProcs (ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
 
void pRestoreDegProcs (ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
 
static long pModDeg (poly p, ring r)
 
void p_SetModDeg (intvec *w, ring r)
 
void pEnlargeSet (poly **p, int l, int increment)
 
void p_Norm (poly p1, const ring r)
 
void p_Normalize (poly p, const ring r)
 
static void p_SplitAndReversePoly (poly p, int n, poly *non_zero, poly *zero, const ring r)
 
static poly p_Subst1 (poly p, int n, const ring r)
 
static poly p_Subst2 (poly p, int n, number e, const ring r)
 
static poly p_Subst0 (poly p, int n, const ring r)
 
poly p_Subst (poly p, int n, poly e, const ring r)
 
poly n_PermNumber (const number z, const int *par_perm, const int, const ring src, const ring dst)
 
poly p_PermPoly (poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
 
poly pp_Jet (poly p, int m, const ring R)
 
poly p_Jet (poly p, int m, const ring R)
 
poly pp_JetW (poly p, int m, short *w, const ring R)
 
poly p_JetW (poly p, int m, short *w, const ring R)
 
int p_MinDeg (poly p, intvec *w, const ring R)
 
static poly p_Invers (int n, poly u, intvec *w, const ring R)
 
poly p_Series (int n, poly p, poly u, intvec *w, const ring R)
 
BOOLEAN p_EqualPolys (poly p1, poly p2, const ring r)
 
static BOOLEAN p_ExpVectorEqual (poly p1, poly p2, const ring r1, const ring r2)
 
BOOLEAN p_EqualPolys (poly p1, poly p2, const ring r1, const ring r2)
 same as the usual p_EqualPolys for polys belonging to equal rings More...
 
BOOLEAN p_ComparePolys (poly p1, poly p2, const ring r)
 returns TRUE if p1 is a skalar multiple of p2 assume p1 != NULL and p2 != NULL More...
 
poly p_Last (const poly p, int &l, const ring r)
 
int p_Var (poly m, const ring r)
 
int p_LowVar (poly p, const ring r)
 the minimal index of used variables - 1 More...
 
void p_Shift (poly *p, int i, const ring r)
 shifts components of the vector p by i More...
 
static unsigned long GetBitFields (const long e, const unsigned int s, const unsigned int n)
 
unsigned long p_GetShortExpVector (const poly p, const ring r)
 
unsigned long p_GetShortExpVector (const poly p, const poly pp, const ring r)
 p_GetShortExpVector of p * pp More...
 
int p_Compare (const poly a, const poly b, const ring R)
 
poly p_GcdMon (poly f, poly g, const ring r)
 polynomial gcd for f=mon More...
 

Variables

static int * _components = NULL
 
static long * _componentsShifted = NULL
 
static int _componentsExternal = 0
 
BOOLEAN pSetm_error =0
 
static pFDegProc pOldFDeg
 
static pLDegProc pOldLDeg
 
static BOOLEAN pOldLexOrder
 

Macro Definition Documentation

◆ CLEARENUMERATORS

#define CLEARENUMERATORS   1

Definition at line 2281 of file p_polys.cc.

◆ LINKAGE

#define LINKAGE

Definition at line 4792 of file p_polys.cc.

◆ MYTEST

#define MYTEST   0

Definition at line 151 of file p_polys.cc.

◆ n_Delete__T

#define n_Delete__T (   n,
 
)    do {} while (0)

Definition at line 4796 of file p_polys.cc.

◆ p_Delete__T

#define p_Delete__T   p_ShallowDelete

Definition at line 4794 of file p_polys.cc.

◆ Sy_bit_L

#define Sy_bit_L (   x)    (((unsigned long)1L)<<(x))

◆ TRANSEXT_PRIVATES

#define TRANSEXT_PRIVATES

Definition at line 26 of file p_polys.cc.

Function Documentation

◆ GetBitFields()

static unsigned long GetBitFields ( const long  e,
const unsigned int  s,
const unsigned int  n 
)
inlinestatic

Definition at line 4646 of file p_polys.cc.

4648 {
4649 #define Sy_bit_L(x) (((unsigned long)1L)<<(x))
4650  unsigned int i = 0;
4651  unsigned long ev = 0L;
4652  assume(n > 0 && s < BIT_SIZEOF_LONG);
4653  do
4654  {
4656  if (e > (long) i) ev |= Sy_bit_L(s+i);
4657  else break;
4658  i++;
4659  }
4660  while (i < n);
4661  return ev;
4662 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
#define Sy_bit_L(x)
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:78

◆ n_PermNumber()

poly n_PermNumber ( const number  z,
const int *  par_perm,
const int  ,
const ring  src,
const ring  dst 
)

Definition at line 3924 of file p_polys.cc.

3925 {
3926 #if 0
3927  PrintS("\nSource Ring: \n");
3928  rWrite(src);
3929 
3930  if(0)
3931  {
3932  number zz = n_Copy(z, src->cf);
3933  PrintS("z: "); n_Write(zz, src);
3934  n_Delete(&zz, src->cf);
3935  }
3936 
3937  PrintS("\nDestination Ring: \n");
3938  rWrite(dst);
3939 
3940  /*Print("\nOldPar: %d\n", OldPar);
3941  for( int i = 1; i <= OldPar; i++ )
3942  {
3943  Print("par(%d) -> par/var (%d)\n", i, par_perm[i-1]);
3944  }*/
3945 #endif
3946  if( z == NULL )
3947  return NULL;
3948 
3949  const coeffs srcCf = src->cf;
3950  assume( srcCf != NULL );
3951 
3952  assume( !nCoeff_is_GF(srcCf) );
3953  assume( src->cf->extRing!=NULL );
3954 
3955  poly zz = NULL;
3956 
3957  const ring srcExtRing = srcCf->extRing;
3958  assume( srcExtRing != NULL );
3959 
3960  const coeffs dstCf = dst->cf;
3961  assume( dstCf != NULL );
3962 
3963  if( nCoeff_is_algExt(srcCf) ) // nCoeff_is_GF(srcCf)?
3964  {
3965  zz = (poly) z;
3966  if( zz == NULL ) return NULL;
3967  }
3968  else if (nCoeff_is_transExt(srcCf))
3969  {
3970  assume( !IS0(z) );
3971 
3972  zz = NUM((fraction)z);
3973  p_Test (zz, srcExtRing);
3974 
3975  if( zz == NULL ) return NULL;
3976  if( !DENIS1((fraction)z) )
3977  {
3978  if (!p_IsConstant(DEN((fraction)z),srcExtRing))
3979  WarnS("Not defined: Cannot map a rational fraction and make a polynomial out of it! Ignoring the denominator.");
3980  }
3981  }
3982  else
3983  {
3984  assume (FALSE);
3985  WerrorS("Number permutation is not implemented for this data yet!");
3986  return NULL;
3987  }
3988 
3989  assume( zz != NULL );
3990  p_Test (zz, srcExtRing);
3991 
3992  nMapFunc nMap = n_SetMap(srcExtRing->cf, dstCf);
3993 
3994  assume( nMap != NULL );
3995 
3996  poly qq;
3997  if ((par_perm == NULL) && (rPar(dst) != 0 && rVar (srcExtRing) > 0))
3998  {
3999  int* perm;
4000  perm=(int *)omAlloc0((rVar(srcExtRing)+1)*sizeof(int));
4001  perm[0]= 0;
4002  for(int i=si_min(rVar(srcExtRing),rPar(dst));i>0;i--)
4003  perm[i]=-i;
4004  qq = p_PermPoly(zz, perm, srcExtRing, dst, nMap, NULL, rVar(srcExtRing)-1);
4005  omFreeSize ((ADDRESS)perm, (rVar(srcExtRing)+1)*sizeof(int));
4006  }
4007  else
4008  qq = p_PermPoly(zz, par_perm-1, srcExtRing, dst, nMap, NULL, rVar (srcExtRing)-1);
4009 
4010  if(nCoeff_is_transExt(srcCf)
4011  && (!DENIS1((fraction)z))
4012  && p_IsConstant(DEN((fraction)z),srcExtRing))
4013  {
4014  number n=nMap(pGetCoeff(DEN((fraction)z)),srcExtRing->cf, dstCf);
4015  qq=p_Div_nn(qq,n,dst);
4016  n_Delete(&n,dstCf);
4017  p_Normalize(qq,dst);
4018  }
4019  p_Test (qq, dst);
4020 
4021  return qq;
4022 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
#define FALSE
Definition: auxiliary.h:94
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:589
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
poly p_Div_nn(poly p, const number n, const ring r)
Definition: p_polys.cc:1467
void * ADDRESS
Definition: auxiliary.h:133
void WerrorS(const char *s)
Definition: feFopen.cc:24
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define WarnS
Definition: emacs.cc:78
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
Definition: p_polys.cc:4028
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:932
#define assume(x)
Definition: mod2.h:390
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1929
The main handler for Singular numbers which are suitable for Singular polynomials.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:591
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:940
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:227
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:861
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:721
#define p_Test(p, r)
Definition: p_polys.h:164
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3723
#define NULL
Definition: omList.c:10
Definition: readcf.cc:164
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ p_ChineseRemainder()

poly p_ChineseRemainder ( poly *  xx,
number *  x,
number *  q,
int  rl,
CFArray inv_cache,
const ring  R 
)

Definition at line 85 of file p_polys.cc.

86 {
87  poly r,h,hh;
88  int j;
89  poly res_p=NULL;
90  loop
91  {
92  /* search the lead term */
93  r=NULL;
94  for(j=rl-1;j>=0;j--)
95  {
96  h=xx[j];
97  if ((h!=NULL)
98  &&((r==NULL)||(p_LmCmp(r,h,R)==-1)))
99  r=h;
100  }
101  /* nothing found -> return */
102  if (r==NULL) break;
103  /* create the monomial in h */
104  h=p_Head(r,R);
105  /* collect the coeffs in x[..]*/
106  for(j=rl-1;j>=0;j--)
107  {
108  hh=xx[j];
109  if ((hh!=NULL) && (p_LmCmp(h,hh,R)==0))
110  {
111  x[j]=pGetCoeff(hh);
112  hh=p_LmFreeAndNext(hh,R);
113  xx[j]=hh;
114  }
115  else
116  x[j]=n_Init(0, R->cf);
117  }
118  number n=n_ChineseRemainderSym(x,q,rl,TRUE,inv_cache,R->cf);
119  for(j=rl-1;j>=0;j--)
120  {
121  x[j]=NULL; // n_Init(0...) takes no memory
122  }
123  if (n_IsZero(n,R->cf)) p_Delete(&h,R);
124  else
125  {
126  //Print("new mon:");pWrite(h);
127  p_SetCoeff(h,n,R);
128  pNext(h)=res_p;
129  res_p=h; // building res_p in reverse order!
130  }
131  }
132  res_p=pReverse(res_p);
133  p_Test(res_p, R);
134  return res_p;
135 }
int j
Definition: facHensel.cc:105
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
#define TRUE
Definition: auxiliary.h:98
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:826
static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs r)
Definition: coeffs.h:786
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1498
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:704
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
static poly pReverse(poly p)
Definition: p_polys.h:336
#define p_Test(p, r)
Definition: p_polys.h:164
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
Variable x
Definition: cfModGcd.cc:4023
#define pNext(p)
Definition: monomials.h:37
static Poly * h
Definition: janet.cc:972

◆ p_Cleardenom()

poly p_Cleardenom ( poly  p,
const ring  r 
)

Definition at line 2782 of file p_polys.cc.

2783 {
2784  if( p == NULL )
2785  return NULL;
2786 
2787  assume( r != NULL ); assume( r->cf != NULL ); const coeffs C = r->cf;
2788 
2789 #if CLEARENUMERATORS
2790  if( 0 )
2791  {
2792  CPolyCoeffsEnumerator itr(p);
2793  n_ClearDenominators(itr, C);
2794  n_ClearContent(itr, C); // divide out the content
2795  p_Test(p, r); n_Test(pGetCoeff(p), C);
2796  assume(n_GreaterZero(pGetCoeff(p), C)); // ??
2797 // if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2798  return p;
2799  }
2800 #endif
2801 
2802  number d, h;
2803 
2804  if (rField_is_Ring(r))
2805  {
2806  p_ContentForGB(p,r);
2807  if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2808  return p;
2809  }
2810 
2812  {
2813  if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2814  return p;
2815  }
2816 
2817  assume(p != NULL);
2818 
2819  if(pNext(p)==NULL)
2820  {
2821  if (!TEST_OPT_CONTENTSB
2822  && !rField_is_Ring(r))
2823  p_SetCoeff(p,n_Init(1,r->cf),r);
2824  else if(!n_GreaterZero(pGetCoeff(p),C))
2825  p = p_Neg(p,r);
2826  return p;
2827  }
2828 
2829  assume(pNext(p)!=NULL);
2830  poly start=p;
2831 
2832 #if 0 && CLEARENUMERATORS
2833 //CF: does not seem to work that well..
2834 
2835  if( nCoeff_is_Q(C) || nCoeff_is_Q_a(C) )
2836  {
2837  CPolyCoeffsEnumerator itr(p);
2838  n_ClearDenominators(itr, C);
2839  n_ClearContent(itr, C); // divide out the content
2840  p_Test(p, r); n_Test(pGetCoeff(p), C);
2841  assume(n_GreaterZero(pGetCoeff(p), C)); // ??
2842 // if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2843  return start;
2844  }
2845 #endif
2846 
2847  if(1)
2848  {
2849  // get lcm of all denominators ----------------------------------
2850  h = n_Init(1,r->cf);
2851  while (p!=NULL)
2852  {
2853  n_Normalize(pGetCoeff(p),r->cf);
2854  d=n_NormalizeHelper(h,pGetCoeff(p),r->cf);
2855  n_Delete(&h,r->cf);
2856  h=d;
2857  pIter(p);
2858  }
2859  /* h now contains the 1/lcm of all denominators */
2860  if(!n_IsOne(h,r->cf))
2861  {
2862  // multiply by the lcm of all denominators
2863  p = start;
2864  while (p!=NULL)
2865  {
2866  d=n_Mult(h,pGetCoeff(p),r->cf);
2867  n_Normalize(d,r->cf);
2868  p_SetCoeff(p,d,r);
2869  pIter(p);
2870  }
2871  }
2872  n_Delete(&h,r->cf);
2873  p=start;
2874 
2875  p_ContentForGB(p,r);
2876 #ifdef HAVE_RATGRING
2877  if (rIsRatGRing(r))
2878  {
2879  /* quick unit detection in the rational case is done in gr_nc_bba */
2880  p_ContentRat(p, r);
2881  start=p;
2882  }
2883 #endif
2884  }
2885 
2886  if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2887 
2888  return start;
2889 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:419
#define TEST_OPT_CONTENTSB
Definition: options.h:125
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
void p_ContentForGB(poly ph, const ring r)
Definition: p_polys.cc:2283
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:578
static FORCE_INLINE number n_NormalizeHelper(number a, number b, const coeffs r)
assume that r is a quotient field (otherwise, return 1) for arguments (a1/a2,b1/b2) return (lcm(a1,...
Definition: coeffs.h:717
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:828
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r)
Definition: coeffs.h:907
#define pIter(p)
Definition: monomials.h:38
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
void p_ContentRat(poly &ph, const ring r)
Definition: p_polys.cc:1691
static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r)
Computes the content and (inplace) divides it out on a collection of numbers number c is the content ...
Definition: coeffs.h:950
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
#define assume(x)
Definition: mod2.h:390
The main handler for Singular numbers which are suitable for Singular polynomials.
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:738
#define p_Test(p, r)
Definition: p_polys.h:164
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:491
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1044
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition: coeffs.h:494
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &d, const coeffs r)
(inplace) Clears denominators on a collection of numbers number d is the LCM of all the coefficient d...
Definition: coeffs.h:957

◆ p_Cleardenom_n()

void p_Cleardenom_n ( poly  ph,
const ring  r,
number &  c 
)

Definition at line 2891 of file p_polys.cc.

2892 {
2893  const coeffs C = r->cf;
2894  number d, h;
2895 
2896  assume( ph != NULL );
2897 
2898  poly p = ph;
2899 
2900 #if CLEARENUMERATORS
2901  if( 0 )
2902  {
2903  CPolyCoeffsEnumerator itr(ph);
2904 
2905  n_ClearDenominators(itr, d, C); // multiply with common denom. d
2906  n_ClearContent(itr, h, C); // divide by the content h
2907 
2908  c = n_Div(d, h, C); // d/h
2909 
2910  n_Delete(&d, C);
2911  n_Delete(&h, C);
2912 
2913  n_Test(c, C);
2914 
2915  p_Test(ph, r); n_Test(pGetCoeff(ph), C);
2916  assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
2917 /*
2918  if(!n_GreaterZero(pGetCoeff(ph),C))
2919  {
2920  ph = p_Neg(ph,r);
2921  c = n_InpNeg(c, C);
2922  }
2923 */
2924  return;
2925  }
2926 #endif
2927 
2928 
2929  if( pNext(p) == NULL )
2930  {
2931  if(!TEST_OPT_CONTENTSB)
2932  {
2933  c=n_Invers(pGetCoeff(p), C);
2934  p_SetCoeff(p, n_Init(1, C), r);
2935  }
2936  else
2937  {
2938  c=n_Init(1,C);
2939  }
2940 
2941  if(!n_GreaterZero(pGetCoeff(ph),C))
2942  {
2943  ph = p_Neg(ph,r);
2944  c = n_InpNeg(c, C);
2945  }
2946 
2947  return;
2948  }
2949  if (TEST_OPT_CONTENTSB) { c=n_Init(1,C); return; }
2950 
2951  assume( pNext(p) != NULL );
2952 
2953 #if CLEARENUMERATORS
2954  if( nCoeff_is_Q(C) || nCoeff_is_Q_a(C) )
2955  {
2956  CPolyCoeffsEnumerator itr(ph);
2957 
2958  n_ClearDenominators(itr, d, C); // multiply with common denom. d
2959  n_ClearContent(itr, h, C); // divide by the content h
2960 
2961  c = n_Div(d, h, C); // d/h
2962 
2963  n_Delete(&d, C);
2964  n_Delete(&h, C);
2965 
2966  n_Test(c, C);
2967 
2968  p_Test(ph, r); n_Test(pGetCoeff(ph), C);
2969  assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
2970 /*
2971  if(!n_GreaterZero(pGetCoeff(ph),C))
2972  {
2973  ph = p_Neg(ph,r);
2974  c = n_InpNeg(c, C);
2975  }
2976 */
2977  return;
2978  }
2979 #endif
2980 
2981 
2982 
2983 
2984  if(1)
2985  {
2986  h = n_Init(1,r->cf);
2987  while (p!=NULL)
2988  {
2989  n_Normalize(pGetCoeff(p),r->cf);
2990  d=n_NormalizeHelper(h,pGetCoeff(p),r->cf);
2991  n_Delete(&h,r->cf);
2992  h=d;
2993  pIter(p);
2994  }
2995  c=h;
2996  /* contains the 1/lcm of all denominators */
2997  if(!n_IsOne(h,r->cf))
2998  {
2999  p = ph;
3000  while (p!=NULL)
3001  {
3002  /* should be: // NOTE: don't use ->coef!!!!
3003  * number hh;
3004  * nGetDenom(p->coef,&hh);
3005  * nMult(&h,&hh,&d);
3006  * nNormalize(d);
3007  * nDelete(&hh);
3008  * nMult(d,p->coef,&hh);
3009  * nDelete(&d);
3010  * nDelete(&(p->coef));
3011  * p->coef =hh;
3012  */
3013  d=n_Mult(h,pGetCoeff(p),r->cf);
3014  n_Normalize(d,r->cf);
3015  p_SetCoeff(p,d,r);
3016  pIter(p);
3017  }
3018  if (rField_is_Q_a(r))
3019  {
3020  loop
3021  {
3022  h = n_Init(1,r->cf);
3023  p=ph;
3024  while (p!=NULL)
3025  {
3026  d=n_NormalizeHelper(h,pGetCoeff(p),r->cf);
3027  n_Delete(&h,r->cf);
3028  h=d;
3029  pIter(p);
3030  }
3031  /* contains the 1/lcm of all denominators */
3032  if(!n_IsOne(h,r->cf))
3033  {
3034  p = ph;
3035  while (p!=NULL)
3036  {
3037  /* should be: // NOTE: don't use ->coef!!!!
3038  * number hh;
3039  * nGetDenom(p->coef,&hh);
3040  * nMult(&h,&hh,&d);
3041  * nNormalize(d);
3042  * nDelete(&hh);
3043  * nMult(d,p->coef,&hh);
3044  * nDelete(&d);
3045  * nDelete(&(p->coef));
3046  * p->coef =hh;
3047  */
3048  d=n_Mult(h,pGetCoeff(p),r->cf);
3049  n_Normalize(d,r->cf);
3050  p_SetCoeff(p,d,r);
3051  pIter(p);
3052  }
3053  number t=n_Mult(c,h,r->cf);
3054  n_Delete(&c,r->cf);
3055  c=t;
3056  }
3057  else
3058  {
3059  break;
3060  }
3061  n_Delete(&h,r->cf);
3062  }
3063  }
3064  }
3065  }
3066 
3067  if(!n_GreaterZero(pGetCoeff(ph),C))
3068  {
3069  ph = p_Neg(ph,r);
3070  c = n_InpNeg(c, C);
3071  }
3072 
3073 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#define TEST_OPT_CONTENTSB
Definition: options.h:125
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
static BOOLEAN rField_is_Q_a(const ring r)
Definition: ring.h:530
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:578
static FORCE_INLINE number n_NormalizeHelper(number a, number b, const coeffs r)
assume that r is a quotient field (otherwise, return 1) for arguments (a1/a2,b1/b2) return (lcm(a1,...
Definition: coeffs.h:717
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:828
#define loop
Definition: structs.h:78
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r)
Definition: coeffs.h:907
#define pIter(p)
Definition: monomials.h:38
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r)
Computes the content and (inplace) divides it out on a collection of numbers number c is the content ...
Definition: coeffs.h:950
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
#define assume(x)
Definition: mod2.h:390
The main handler for Singular numbers which are suitable for Singular polynomials.
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:738
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible
Definition: coeffs.h:564
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)
Definition: coeffs.h:557
#define p_Test(p, r)
Definition: p_polys.h:164
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:615
#define pNext(p)
Definition: monomials.h:37
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1044
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition: coeffs.h:494
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &d, const coeffs r)
(inplace) Clears denominators on a collection of numbers number d is the LCM of all the coefficient d...
Definition: coeffs.h:957

◆ p_Compare()

int p_Compare ( const poly  a,
const poly  b,
const ring  R 
)

Definition at line 4804 of file p_polys.cc.

4805 {
4806  int r=p_Cmp(a,b,R);
4807  if ((r==0)&&(a!=NULL))
4808  {
4809  number h=n_Sub(pGetCoeff(a),pGetCoeff(b),R->cf);
4810  /* compare lead coeffs */
4811  r = -1+n_IsZero(h,R->cf)+2*n_GreaterZero(h,R->cf); /* -1: <, 0:==, 1: > */
4812  n_Delete(&h,R->cf);
4813  }
4814  else if (a==NULL)
4815  {
4816  if (b==NULL)
4817  {
4818  /* compare 0, 0 */
4819  r=0;
4820  }
4821  else if(p_IsConstant(b,R))
4822  {
4823  /* compare 0, const */
4824  r = 1-2*n_GreaterZero(pGetCoeff(b),R->cf); /* -1: <, 1: > */
4825  }
4826  }
4827  else if (b==NULL)
4828  {
4829  if (p_IsConstant(a,R))
4830  {
4831  /* compare const, 0 */
4832  r = -1+2*n_GreaterZero(pGetCoeff(a),R->cf); /* -1: <, 1: > */
4833  }
4834  }
4835  return(r);
4836 }
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
Definition: coeffs.h:669
static int p_Cmp(poly p1, poly p2, ring r)
Definition: p_polys.h:1653
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
CanonicalForm b
Definition: cfModGcd.cc:4044
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1929
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition: coeffs.h:494
static Poly * h
Definition: janet.cc:972

◆ p_ComparePolys()

BOOLEAN p_ComparePolys ( poly  p1,
poly  p2,
const ring  r 
)

returns TRUE if p1 is a skalar multiple of p2 assume p1 != NULL and p2 != NULL

Definition at line 4474 of file p_polys.cc.

4475 {
4476  number n,nn;
4477  pAssume(p1 != NULL && p2 != NULL);
4478 
4479  if (!p_LmEqual(p1,p2,r)) //compare leading mons
4480  return FALSE;
4481  if ((pNext(p1)==NULL) && (pNext(p2)!=NULL))
4482  return FALSE;
4483  if ((pNext(p2)==NULL) && (pNext(p1)!=NULL))
4484  return FALSE;
4485  if (pLength(p1) != pLength(p2))
4486  return FALSE;
4487  #ifdef HAVE_RINGS
4488  if (rField_is_Ring(r))
4489  {
4490  if (!n_DivBy(pGetCoeff(p1), pGetCoeff(p2), r->cf)) return FALSE;
4491  }
4492  #endif
4493  n=n_Div(pGetCoeff(p1),pGetCoeff(p2),r->cf);
4494  while ((p1 != NULL) /*&& (p2 != NULL)*/)
4495  {
4496  if ( ! p_LmEqual(p1, p2,r))
4497  {
4498  n_Delete(&n, r->cf);
4499  return FALSE;
4500  }
4501  if (!n_Equal(pGetCoeff(p1), nn = n_Mult(pGetCoeff(p2),n, r->cf), r->cf))
4502  {
4503  n_Delete(&n, r->cf);
4504  n_Delete(&nn, r->cf);
4505  return FALSE;
4506  }
4507  n_Delete(&nn, r->cf);
4508  pIter(p1);
4509  pIter(p2);
4510  }
4511  n_Delete(&n, r->cf);
4512  return TRUE;
4513 }
#define FALSE
Definition: auxiliary.h:94
#define pAssume(cond)
Definition: monomials.h:91
#define TRUE
Definition: auxiliary.h:98
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define pIter(p)
Definition: monomials.h:38
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:775
static unsigned pLength(poly a)
Definition: p_polys.h:193
#define p_LmEqual(p1, p2, r)
Definition: p_polys.h:1649
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:615
#define pNext(p)
Definition: monomials.h:37
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
Definition: coeffs.h:460
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455

◆ p_Content()

void p_Content ( poly  ph,
const ring  r 
)

Definition at line 2238 of file p_polys.cc.

2239 {
2240  if (ph==NULL) return;
2241  const coeffs cf=r->cf;
2242  if (pNext(ph)==NULL)
2243  {
2244  p_SetCoeff(ph,n_Init(1,cf),r);
2245  }
2246  if (cf->cfSubringGcd==ndGcd) /* trivial gcd*/ return;
2247  number h=p_InitContent(ph,r); /* first guess of a gcd of all coeffs */
2248  poly p;
2249  if(n_IsOne(h,cf))
2250  {
2251  goto content_finish;
2252  }
2253  p=ph;
2254  // take the SubringGcd of all coeffs
2255  while (p!=NULL)
2256  {
2258  number d=n_SubringGcd(h,pGetCoeff(p),cf);
2259  n_Delete(&h,cf);
2260  h = d;
2261  if(n_IsOne(h,cf))
2262  {
2263  goto content_finish;
2264  }
2265  pIter(p);
2266  }
2267  // if found<>1, divide by it
2268  p = ph;
2269  while (p!=NULL)
2270  {
2271  number d = n_ExactDiv(pGetCoeff(p),h,cf);
2272  p_SetCoeff(p,d,r);
2273  pIter(p);
2274  }
2275 content_finish:
2276  n_Delete(&h,r->cf);
2277  // and last: check leading sign:
2278  if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2279 }
number ndGcd(number, number, const coeffs r)
Definition: numbers.cc:162
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:578
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
#define pIter(p)
Definition: monomials.h:38
The main handler for Singular numbers which are suitable for Singular polynomials.
number p_InitContent(poly ph, const ring r)
Definition: p_polys.cc:2549
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
static FORCE_INLINE number n_ExactDiv(number a, number b, const coeffs r)
assume that there is a canonical subring in cf and we know that division is possible for these a and ...
Definition: coeffs.h:622
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:688
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1044
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition: coeffs.h:494
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972

◆ p_ContentForGB()

void p_ContentForGB ( poly  ph,
const ring  r 
)

Definition at line 2283 of file p_polys.cc.

2284 {
2285  if(TEST_OPT_CONTENTSB) return;
2286  assume( ph != NULL );
2287 
2288  assume( r != NULL ); assume( r->cf != NULL );
2289 
2290 
2291 #if CLEARENUMERATORS
2292  if( 0 )
2293  {
2294  const coeffs C = r->cf;
2295  // experimentall (recursive enumerator treatment) of alg. Ext!
2296  CPolyCoeffsEnumerator itr(ph);
2297  n_ClearContent(itr, r->cf);
2298 
2299  p_Test(ph, r); n_Test(pGetCoeff(ph), C);
2300  assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
2301 
2302  // if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2303  return;
2304  }
2305 #endif
2306 
2307 
2308 #ifdef HAVE_RINGS
2309  if (rField_is_Ring(r))
2310  {
2311  if (rField_has_Units(r))
2312  {
2313  number k = n_GetUnit(pGetCoeff(ph),r->cf);
2314  if (!n_IsOne(k,r->cf))
2315  {
2316  number tmpGMP = k;
2317  k = n_Invers(k,r->cf);
2318  n_Delete(&tmpGMP,r->cf);
2319  poly h = pNext(ph);
2320  p_SetCoeff(ph, n_Mult(pGetCoeff(ph), k,r->cf),r);
2321  while (h != NULL)
2322  {
2323  p_SetCoeff(h, n_Mult(pGetCoeff(h), k,r->cf),r);
2324  pIter(h);
2325  }
2326 // assume( n_GreaterZero(pGetCoeff(ph),r->cf) );
2327 // if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2328  }
2329  n_Delete(&k,r->cf);
2330  }
2331  return;
2332  }
2333 #endif
2334  number h,d;
2335  poly p;
2336 
2337  if(pNext(ph)==NULL)
2338  {
2339  p_SetCoeff(ph,n_Init(1,r->cf),r);
2340  }
2341  else
2342  {
2343  assume( pNext(ph) != NULL );
2344 #if CLEARENUMERATORS
2345  if( nCoeff_is_Q(r->cf) )
2346  {
2347  // experimentall (recursive enumerator treatment) of alg. Ext!
2348  CPolyCoeffsEnumerator itr(ph);
2349  n_ClearContent(itr, r->cf);
2350 
2351  p_Test(ph, r); n_Test(pGetCoeff(ph), r->cf);
2352  assume(n_GreaterZero(pGetCoeff(ph), r->cf)); // ??
2353 
2354  // if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2355  return;
2356  }
2357 #endif
2358 
2359  n_Normalize(pGetCoeff(ph),r->cf);
2360  if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2361  if (rField_is_Q(r)||(getCoeffType(r->cf)==n_transExt)) // should not be used anymore if CLEARENUMERATORS is 1
2362  {
2363  h=p_InitContent(ph,r);
2364  p=ph;
2365  }
2366  else
2367  {
2368  h=n_Copy(pGetCoeff(ph),r->cf);
2369  p = pNext(ph);
2370  }
2371  while (p!=NULL)
2372  {
2373  n_Normalize(pGetCoeff(p),r->cf);
2374  d=n_SubringGcd(h,pGetCoeff(p),r->cf);
2375  n_Delete(&h,r->cf);
2376  h = d;
2377  if(n_IsOne(h,r->cf))
2378  {
2379  break;
2380  }
2381  pIter(p);
2382  }
2383  //number tmp;
2384  if(!n_IsOne(h,r->cf))
2385  {
2386  p = ph;
2387  while (p!=NULL)
2388  {
2389  //d = nDiv(pGetCoeff(p),h);
2390  //tmp = nExactDiv(pGetCoeff(p),h);
2391  //if (!nEqual(d,tmp))
2392  //{
2393  // StringSetS("** div0:");nWrite(pGetCoeff(p));StringAppendS("/");
2394  // nWrite(h);StringAppendS("=");nWrite(d);StringAppendS(" int:");
2395  // nWrite(tmp);Print(StringEndS("\n")); // NOTE/TODO: use StringAppendS("\n"); omFree(s);
2396  //}
2397  //nDelete(&tmp);
2398  d = n_ExactDiv(pGetCoeff(p),h,r->cf);
2399  p_SetCoeff(p,d,r);
2400  pIter(p);
2401  }
2402  }
2403  n_Delete(&h,r->cf);
2404  if (rField_is_Q_a(r))
2405  {
2406  // special handling for alg. ext.:
2407  if (getCoeffType(r->cf)==n_algExt)
2408  {
2409  h = n_Init(1, r->cf->extRing->cf);
2410  p=ph;
2411  while (p!=NULL)
2412  { // each monom: coeff in Q_a
2413  poly c_n_n=(poly)pGetCoeff(p);
2414  poly c_n=c_n_n;
2415  while (c_n!=NULL)
2416  { // each monom: coeff in Q
2417  d=n_NormalizeHelper(h,pGetCoeff(c_n),r->cf->extRing->cf);
2418  n_Delete(&h,r->cf->extRing->cf);
2419  h=d;
2420  pIter(c_n);
2421  }
2422  pIter(p);
2423  }
2424  /* h contains the 1/lcm of all denominators in c_n_n*/
2425  //n_Normalize(h,r->cf->extRing->cf);
2426  if(!n_IsOne(h,r->cf->extRing->cf))
2427  {
2428  p=ph;
2429  while (p!=NULL)
2430  { // each monom: coeff in Q_a
2431  poly c_n=(poly)pGetCoeff(p);
2432  while (c_n!=NULL)
2433  { // each monom: coeff in Q
2434  d=n_Mult(h,pGetCoeff(c_n),r->cf->extRing->cf);
2435  n_Normalize(d,r->cf->extRing->cf);
2436  n_Delete(&pGetCoeff(c_n),r->cf->extRing->cf);
2437  pGetCoeff(c_n)=d;
2438  pIter(c_n);
2439  }
2440  pIter(p);
2441  }
2442  }
2443  n_Delete(&h,r->cf->extRing->cf);
2444  }
2445  /*else
2446  {
2447  // special handling for rat. functions.:
2448  number hzz =NULL;
2449  p=ph;
2450  while (p!=NULL)
2451  { // each monom: coeff in Q_a (Z_a)
2452  fraction f=(fraction)pGetCoeff(p);
2453  poly c_n=NUM(f);
2454  if (hzz==NULL)
2455  {
2456  hzz=n_Copy(pGetCoeff(c_n),r->cf->extRing->cf);
2457  pIter(c_n);
2458  }
2459  while ((c_n!=NULL)&&(!n_IsOne(hzz,r->cf->extRing->cf)))
2460  { // each monom: coeff in Q (Z)
2461  d=n_Gcd(hzz,pGetCoeff(c_n),r->cf->extRing->cf);
2462  n_Delete(&hzz,r->cf->extRing->cf);
2463  hzz=d;
2464  pIter(c_n);
2465  }
2466  pIter(p);
2467  }
2468  // hzz contains the gcd of all numerators in f
2469  h=n_Invers(hzz,r->cf->extRing->cf);
2470  n_Delete(&hzz,r->cf->extRing->cf);
2471  n_Normalize(h,r->cf->extRing->cf);
2472  if(!n_IsOne(h,r->cf->extRing->cf))
2473  {
2474  p=ph;
2475  while (p!=NULL)
2476  { // each monom: coeff in Q_a (Z_a)
2477  fraction f=(fraction)pGetCoeff(p);
2478  NUM(f)=__p_Mult_nn(NUM(f),h,r->cf->extRing);
2479  p_Normalize(NUM(f),r->cf->extRing);
2480  pIter(p);
2481  }
2482  }
2483  n_Delete(&h,r->cf->extRing->cf);
2484  }*/
2485  }
2486  }
2487  if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2488 }
static FORCE_INLINE number n_GetUnit(number n, const coeffs r)
in Z: 1 in Z/kZ (where k is not a prime): largest divisor of n (taken in Z) that is co-prime with k i...
Definition: coeffs.h:532
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:39
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#define TEST_OPT_CONTENTSB
Definition: options.h:125
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
static BOOLEAN rField_is_Q_a(const ring r)
Definition: ring.h:530
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:578
int k
Definition: cfEzgcd.cc:92
static FORCE_INLINE number n_NormalizeHelper(number a, number b, const coeffs r)
assume that r is a quotient field (otherwise, return 1) for arguments (a1/a2,b1/b2) return (lcm(a1,...
Definition: coeffs.h:717
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:828
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
#define pIter(p)
Definition: monomials.h:38
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r)
Computes the content and (inplace) divides it out on a collection of numbers number c is the content ...
Definition: coeffs.h:950
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
#define assume(x)
Definition: mod2.h:390
The main handler for Singular numbers which are suitable for Singular polynomials.
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:738
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible
Definition: coeffs.h:564
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:497
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
number p_InitContent(poly ph, const ring r)
Definition: p_polys.cc:2549
#define p_Test(p, r)
Definition: p_polys.h:164
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition: coeffs.h:36
#define pNext(p)
Definition: monomials.h:37
static FORCE_INLINE number n_ExactDiv(number a, number b, const coeffs r)
assume that there is a canonical subring in cf and we know that division is possible for these a and ...
Definition: coeffs.h:622
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:688
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1044
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition: coeffs.h:494
int p
Definition: cfModGcd.cc:4019
static BOOLEAN rField_has_Units(const ring r)
Definition: ring.h:481
static Poly * h
Definition: janet.cc:972

◆ p_ContentRat()

void p_ContentRat ( poly &  ph,
const ring  r 
)

Definition at line 1691 of file p_polys.cc.

1694 {
1695  // init array of RatLeadCoeffs
1696  // poly p_GetCoeffRat(poly p, int ishift, ring r);
1697 
1698  int len=pLength(ph);
1699  poly *C = (poly *)omAlloc0((len+1)*sizeof(poly)); //rat coeffs
1700  poly *LM = (poly *)omAlloc0((len+1)*sizeof(poly)); // rat lead terms
1701  int *D = (int *)omAlloc0((len+1)*sizeof(int)); //degrees of coeffs
1702  int *L = (int *)omAlloc0((len+1)*sizeof(int)); //lengths of coeffs
1703  int k = 0;
1704  poly p = p_Copy(ph, r); // ph will be needed below
1705  int mintdeg = p_Totaldegree(p, r);
1706  int minlen = len;
1707  int dd = 0; int i;
1708  int HasConstantCoef = 0;
1709  int is = r->real_var_start - 1;
1710  while (p!=NULL)
1711  {
1712  LM[k] = p_GetExp_k_n(p,1,is, r); // need LmRat istead of p_HeadRat(p, is, currRing); !
1713  C[k] = p_GetCoeffRat(p, is, r);
1714  D[k] = p_Totaldegree(C[k], r);
1715  mintdeg = si_min(mintdeg,D[k]);
1716  L[k] = pLength(C[k]);
1717  minlen = si_min(minlen,L[k]);
1718  if (p_IsConstant(C[k], r))
1719  {
1720  // C[k] = const, so the content will be numerical
1721  HasConstantCoef = 1;
1722  // smth like goto cleanup and return(pContent(p));
1723  }
1724  p_LmDeleteAndNextRat(&p, is, r);
1725  k++;
1726  }
1727 
1728  // look for 1 element of minimal degree and of minimal length
1729  k--;
1730  poly d;
1731  int mindeglen = len;
1732  if (k<=0) // this poly is not a ratgring poly -> pContent
1733  {
1734  p_Delete(&C[0], r);
1735  p_Delete(&LM[0], r);
1736  p_ContentForGB(ph, r);
1737  goto cleanup;
1738  }
1739 
1740  int pmindeglen;
1741  for(i=0; i<=k; i++)
1742  {
1743  if (D[i] == mintdeg)
1744  {
1745  if (L[i] < mindeglen)
1746  {
1747  mindeglen=L[i];
1748  pmindeglen = i;
1749  }
1750  }
1751  }
1752  d = p_Copy(C[pmindeglen], r);
1753  // there are dd>=1 mindeg elements
1754  // and pmideglen is the coordinate of one of the smallest among them
1755 
1756  // poly g = singclap_gcd(p_Copy(p,r),p_Copy(q,r));
1757  // return naGcd(d,d2,currRing);
1758 
1759  // adjoin pContentRat here?
1760  for(i=0; i<=k; i++)
1761  {
1762  d=singclap_gcd(d,p_Copy(C[i], r), r);
1763  if (p_Totaldegree(d, r)==0)
1764  {
1765  // cleanup, pContent, return
1766  p_Delete(&d, r);
1767  for(;k>=0;k--)
1768  {
1769  p_Delete(&C[k], r);
1770  p_Delete(&LM[k], r);
1771  }
1772  p_ContentForGB(ph, r);
1773  goto cleanup;
1774  }
1775  }
1776  for(i=0; i<=k; i++)
1777  {
1778  poly h=singclap_pdivide(C[i],d, r);
1779  p_Delete(&C[i], r);
1780  C[i]=h;
1781  }
1782 
1783  // zusammensetzen,
1784  p=NULL; // just to be sure
1785  for(i=0; i<=k; i++)
1786  {
1787  p = p_Add_q(p, p_Mult_q(C[i],LM[i], r), r);
1788  C[i]=NULL; LM[i]=NULL;
1789  }
1790  p_Delete(&ph, r); // do not need it anymore
1791  ph = p;
1792  // aufraeumen, return
1793 cleanup:
1794  omFree(C);
1795  omFree(LM);
1796  omFree(D);
1797  omFree(L);
1798 }
#define D(A)
Definition: gentable.cc:131
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
void p_ContentForGB(poly ph, const ring r)
Definition: p_polys.cc:2283
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1444
int k
Definition: cfEzgcd.cc:92
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:557
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
#define omFree(addr)
Definition: omAllocDecl.h:261
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1929
void p_LmDeleteAndNextRat(poly *p, int ishift, ring r)
Definition: p_polys.cc:1647
poly singclap_gcd(poly f, poly g, const ring r)
polynomial gcd via singclap_gcd_r resp. idSyzygies destroys f and g
Definition: polys.cc:165
poly p_GetCoeffRat(poly p, int ishift, ring r)
Definition: p_polys.cc:1669
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:193
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
#define NULL
Definition: omList.c:10
static poly p_GetExp_k_n(poly p, int l, int k, const ring r)
Definition: p_polys.h:1309
int p
Definition: cfModGcd.cc:4019
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893
static Poly * h
Definition: janet.cc:972
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1051
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ p_Deg()

long p_Deg ( poly  a,
const ring  r 
)

Definition at line 579 of file p_polys.cc.

580 {
581  p_LmCheckPolyRing(a, r);
582 // assume(p_GetOrder(a, r) == p_WTotaldegree(a, r)); // WRONG assume!
583  return p_GetOrder(a, r);
584 }
static long p_GetOrder(poly p, ring r)
Definition: p_polys.h:422
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:120

◆ p_DegW()

long p_DegW ( poly  p,
const short *  w,
const ring  R 
)

Definition at line 682 of file p_polys.cc.

683 {
684  p_Test(p, R);
685  assume( w != NULL );
686  long r=-LONG_MAX;
687 
688  while (p!=NULL)
689  {
690  long t=totaldegreeWecart_IV(p,R,w);
691  if (t>r) r=t;
692  pIter(p);
693  }
694  return r;
695 }
long totaldegreeWecart_IV(poly p, ring r, const short *w)
Definition: weight.cc:237
#define pIter(p)
Definition: monomials.h:38
#define assume(x)
Definition: mod2.h:390
#define p_Test(p, r)
Definition: p_polys.h:164
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
const CanonicalForm & w
Definition: facAbsFact.cc:55
int p
Definition: cfModGcd.cc:4019

◆ p_DeleteComp()

void p_DeleteComp ( poly *  p,
int  k,
const ring  r 
)

Definition at line 3494 of file p_polys.cc.

3495 {
3496  poly q;
3497 
3498  while ((*p!=NULL) && (__p_GetComp(*p,r)==k)) p_LmDelete(p,r);
3499  if (*p==NULL) return;
3500  q = *p;
3501  if (__p_GetComp(q,r)>k)
3502  {
3503  p_SubComp(q,1,r);
3504  p_SetmComp(q,r);
3505  }
3506  while (pNext(q)!=NULL)
3507  {
3508  if (__p_GetComp(pNext(q),r)==k)
3509  p_LmDelete(&(pNext(q)),r);
3510  else
3511  {
3512  pIter(q);
3513  if (__p_GetComp(q,r)>k)
3514  {
3515  p_SubComp(q,1,r);
3516  p_SetmComp(q,r);
3517  }
3518  }
3519  }
3520 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:38
static unsigned long p_SubComp(poly p, unsigned long v, ring r)
Definition: p_polys.h:454
#define p_SetmComp
Definition: p_polys.h:245
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
int p
Definition: cfModGcd.cc:4019

◆ p_Diff()

poly p_Diff ( poly  a,
int  k,
const ring  r 
)

Definition at line 1845 of file p_polys.cc.

1846 {
1847  poly res, f, last;
1848  number t;
1849 
1850  last = res = NULL;
1851  while (a!=NULL)
1852  {
1853  if (p_GetExp(a,k,r)!=0)
1854  {
1855  f = p_LmInit(a,r);
1856  t = n_Init(p_GetExp(a,k,r),r->cf);
1857  pSetCoeff0(f,n_Mult(t,pGetCoeff(a),r->cf));
1858  n_Delete(&t,r->cf);
1859  if (n_IsZero(pGetCoeff(f),r->cf))
1860  p_LmDelete(&f,r);
1861  else
1862  {
1863  p_DecrExp(f,k,r);
1864  p_Setm(f,r);
1865  if (res==NULL)
1866  {
1867  res=last=f;
1868  }
1869  else
1870  {
1871  pNext(last)=f;
1872  last=f;
1873  }
1874  }
1875  }
1876  pIter(a);
1877  }
1878  return res;
1879 }
static poly last
Definition: hdegree.cc:1077
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
int k
Definition: cfEzgcd.cc:92
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define pIter(p)
Definition: monomials.h:38
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
CanonicalForm res
Definition: facAbsFact.cc:64
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
FILE * f
Definition: checklibs.c:9
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1272
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
#define pSetCoeff0(p, n)
Definition: monomials.h:60
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static long p_DecrExp(poly p, int v, ring r)
Definition: p_polys.h:599

◆ p_DiffOp()

poly p_DiffOp ( poly  a,
poly  b,
BOOLEAN  multiply,
const ring  r 
)

Definition at line 1920 of file p_polys.cc.

1921 {
1922  poly result=NULL;
1923  poly h;
1924  for(;a!=NULL;pIter(a))
1925  {
1926  for(h=b;h!=NULL;pIter(h))
1927  {
1928  result=p_Add_q(result,p_DiffOpM(a,h,multiply,r),r);
1929  }
1930  }
1931  return result;
1932 }
static poly p_DiffOpM(poly a, poly b, BOOLEAN multiply, const ring r)
Definition: p_polys.cc:1881
#define pIter(p)
Definition: monomials.h:38
CanonicalForm b
Definition: cfModGcd.cc:4044
#define NULL
Definition: omList.c:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893
static Poly * h
Definition: janet.cc:972
return result
Definition: facAbsBiFact.cc:76

◆ p_DiffOpM()

static poly p_DiffOpM ( poly  a,
poly  b,
BOOLEAN  multiply,
const ring  r 
)
static

Definition at line 1881 of file p_polys.cc.

1882 {
1883  int i,j,s;
1884  number n,h,hh;
1885  poly p=p_One(r);
1886  n=n_Mult(pGetCoeff(a),pGetCoeff(b),r->cf);
1887  for(i=rVar(r);i>0;i--)
1888  {
1889  s=p_GetExp(b,i,r);
1890  if (s<p_GetExp(a,i,r))
1891  {
1892  n_Delete(&n,r->cf);
1893  p_LmDelete(&p,r);
1894  return NULL;
1895  }
1896  if (multiply)
1897  {
1898  for(j=p_GetExp(a,i,r); j>0;j--)
1899  {
1900  h = n_Init(s,r->cf);
1901  hh=n_Mult(n,h,r->cf);
1902  n_Delete(&h,r->cf);
1903  n_Delete(&n,r->cf);
1904  n=hh;
1905  s--;
1906  }
1907  p_SetExp(p,i,s,r);
1908  }
1909  else
1910  {
1911  p_SetExp(p,i,s-p_GetExp(a,i,r),r);
1912  }
1913  }
1914  p_Setm(p,r);
1915  /*if (multiply)*/ p_SetCoeff(p,n,r);
1916  if (n_IsZero(n,r->cf)) p=p_LmDeleteAndNext(p,r); // return NULL as p is a monomial
1917  return p;
1918 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int j
Definition: facHensel.cc:105
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:726
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
CanonicalForm b
Definition: cfModGcd.cc:4044
poly p_One(const ring r)
Definition: p_polys.cc:1305
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
int i
Definition: cfEzgcd.cc:125
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
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
Definition: p_polys.h:489
#define NULL
Definition: omList.c:10
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972

◆ p_Div_mm()

poly p_Div_mm ( poly  p,
const poly  m,
const ring  r 
)

divide polynomial by monomial

Definition at line 1500 of file p_polys.cc.

1501 {
1502  p_Test(p, r);
1503  p_Test(m, r);
1504  poly result = p;
1505  poly prev = NULL;
1506  number n=pGetCoeff(m);
1507  while (p!=NULL)
1508  {
1509  number nc = n_Div(pGetCoeff(p),n,r->cf);
1510  n_Normalize(nc,r->cf);
1511  if (!n_IsZero(nc,r->cf))
1512  {
1513  p_SetCoeff(p,nc,r);
1514  prev=p;
1515  p_ExpVectorSub(p,m,r);
1516  pIter(p);
1517  }
1518  else
1519  {
1520  if (prev==NULL)
1521  {
1522  p_LmDelete(&result,r);
1523  p=result;
1524  }
1525  else
1526  {
1527  p_LmDelete(&pNext(prev),r);
1528  p=pNext(prev);
1529  }
1530  }
1531  }
1532  p_Test(result,r);
1533  return(result);
1534 }
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:578
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
#define pIter(p)
Definition: monomials.h:38
int m
Definition: cfEzgcd.cc:121
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1377
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
#define p_Test(p, r)
Definition: p_polys.h:164
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:615
#define pNext(p)
Definition: monomials.h:37
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
int p
Definition: cfModGcd.cc:4019
return result
Definition: facAbsBiFact.cc:76

◆ p_Div_nn()

poly p_Div_nn ( poly  p,
const number  n,
const ring  r 
)

Definition at line 1467 of file p_polys.cc.

1468 {
1469  pAssume(!n_IsZero(n,r->cf));
1470  p_Test(p, r);
1471  poly result = p;
1472  poly prev = NULL;
1473  while (p!=NULL)
1474  {
1475  number nc = n_Div(pGetCoeff(p),n,r->cf);
1476  if (!n_IsZero(nc,r->cf))
1477  {
1478  p_SetCoeff(p,nc,r);
1479  prev=p;
1480  pIter(p);
1481  }
1482  else
1483  {
1484  if (prev==NULL)
1485  {
1486  p_LmDelete(&result,r);
1487  p=result;
1488  }
1489  else
1490  {
1491  p_LmDelete(&pNext(prev),r);
1492  p=pNext(prev);
1493  }
1494  }
1495  }
1496  p_Test(result,r);
1497  return(result);
1498 }
#define pAssume(cond)
Definition: monomials.h:91
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
#define pIter(p)
Definition: monomials.h:38
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
#define p_Test(p, r)
Definition: p_polys.h:164
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:615
#define pNext(p)
Definition: monomials.h:37
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
int p
Definition: cfModGcd.cc:4019
return result
Definition: facAbsBiFact.cc:76

◆ p_DivideM()

poly p_DivideM ( poly  a,
poly  b,
const ring  r 
)

Definition at line 1540 of file p_polys.cc.

1541 {
1542  if (a==NULL) { p_Delete(&b,r); return NULL; }
1543  poly result=a;
1544  poly prev=NULL;
1545  number inv=pGetCoeff(b);
1546 
1547  while (a!=NULL)
1548  {
1549  if (p_DivisibleBy(b,a,r))
1550  {
1551  p_ExpVectorSub(a,b,r);
1552  prev=a;
1553  pIter(a);
1554  }
1555  else
1556  {
1557  if (prev==NULL)
1558  {
1559  p_LmDelete(&result,r);
1560  a=result;
1561  }
1562  else
1563  {
1564  p_LmDelete(&pNext(prev),r);
1565  a=pNext(prev);
1566  }
1567  }
1568  }
1569  if (result!=NULL)
1570  {
1571  //if ((!rField_is_Ring(r)) || n_IsUnit(inv,r->cf))
1572  if (rField_is_Zp(r))
1573  {
1574  inv = n_Invers(inv,r->cf);
1575  __p_Mult_nn(result,inv,r);
1576  n_Delete(&inv, r->cf);
1577  }
1578  else
1579  {
1580  result = p_Div_nn(result,inv,r);
1581  }
1582  }
1583  p_Delete(&b, r);
1584  return result;
1585 }
poly p_Div_nn(poly p, const number n, const ring r)
Definition: p_polys.cc:1467
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define pIter(p)
Definition: monomials.h:38
CanonicalForm b
Definition: cfModGcd.cc:4044
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1830
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible
Definition: coeffs.h:564
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1377
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:491
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
#define __p_Mult_nn(p, n, r)
Definition: p_polys.h:928
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
return result
Definition: facAbsBiFact.cc:76

◆ p_DivisibleByRingCase()

BOOLEAN p_DivisibleByRingCase ( poly  f,
poly  g,
const ring  r 
)

divisibility check over ground ring (which may contain zero divisors); TRUE iff LT(f) divides LT(g), i.e., LT(f)*c*m = LT(g), for some coefficient c and some monomial m; does not take components into account

Definition at line 1589 of file p_polys.cc.

1590 {
1591  int exponent;
1592  for(int i = (int)rVar(r); i>0; i--)
1593  {
1594  exponent = p_GetExp(g, i, r) - p_GetExp(f, i, r);
1595  if (exponent < 0) return FALSE;
1596  }
1597  return n_DivBy(pGetCoeff(g), pGetCoeff(f), r->cf);
1598 }
#define FALSE
Definition: auxiliary.h:94
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
g
Definition: cfModGcd.cc:4031
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:775
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:125
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )

◆ p_EqualPolys() [1/2]

BOOLEAN p_EqualPolys ( poly  p1,
poly  p2,
const ring  r 
)

Definition at line 4410 of file p_polys.cc.

4411 {
4412  while ((p1 != NULL) && (p2 != NULL))
4413  {
4414  if (! p_LmEqual(p1, p2,r))
4415  return FALSE;
4416  if (! n_Equal(p_GetCoeff(p1,r), p_GetCoeff(p2,r),r->cf ))
4417  return FALSE;
4418  pIter(p1);
4419  pIter(p2);
4420  }
4421  return (p1==p2);
4422 }
#define FALSE
Definition: auxiliary.h:94
#define pIter(p)
Definition: monomials.h:38
#define p_LmEqual(p1, p2, r)
Definition: p_polys.h:1649
#define NULL
Definition: omList.c:10
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
Definition: coeffs.h:460
#define p_GetCoeff(p, r)
Definition: monomials.h:51

◆ p_EqualPolys() [2/2]

BOOLEAN p_EqualPolys ( poly  p1,
poly  p2,
const ring  r1,
const ring  r2 
)

same as the usual p_EqualPolys for polys belonging to equal rings

Definition at line 4448 of file p_polys.cc.

4449 {
4450  assume( r1 == r2 || rSamePolyRep(r1, r2) ); // will be used in rEqual!
4451  assume( r1->cf == r2->cf );
4452 
4453  while ((p1 != NULL) && (p2 != NULL))
4454  {
4455  // returns 1 if ExpVector(p)==ExpVector(q): does not compare numbers !!
4456  // #define p_LmEqual(p1, p2, r) p_ExpVectorEqual(p1, p2, r)
4457 
4458  if (! p_ExpVectorEqual(p1, p2, r1, r2))
4459  return FALSE;
4460 
4461  if (! n_Equal(p_GetCoeff(p1,r1), p_GetCoeff(p2,r2), r1->cf ))
4462  return FALSE;
4463 
4464  pIter(p1);
4465  pIter(p2);
4466  }
4467  return (p1==p2);
4468 }
#define FALSE
Definition: auxiliary.h:94
#define pIter(p)
Definition: monomials.h:38
#define assume(x)
Definition: mod2.h:390
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
Definition: ring.cc:1683
#define NULL
Definition: omList.c:10
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
Definition: coeffs.h:460
#define p_GetCoeff(p, r)
Definition: monomials.h:51
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
Definition: p_polys.cc:4424

◆ p_ExpVectorEqual()

static BOOLEAN p_ExpVectorEqual ( poly  p1,
poly  p2,
const ring  r1,
const ring  r2 
)
inlinestatic

Definition at line 4424 of file p_polys.cc.

4425 {
4426  assume( r1 == r2 || rSamePolyRep(r1, r2) );
4427 
4428  p_LmCheckPolyRing1(p1, r1);
4429  p_LmCheckPolyRing1(p2, r2);
4430 
4431  int i = r1->ExpL_Size;
4432 
4433  assume( r1->ExpL_Size == r2->ExpL_Size );
4434 
4435  unsigned long *ep = p1->exp;
4436  unsigned long *eq = p2->exp;
4437 
4438  do
4439  {
4440  i--;
4441  if (ep[i] != eq[i]) return FALSE;
4442  }
4443  while (i);
4444 
4445  return TRUE;
4446 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define assume(x)
Definition: mod2.h:390
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
Definition: ring.cc:1683
int i
Definition: cfEzgcd.cc:125
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:178

◆ p_Farey()

poly p_Farey ( poly  p,
number  N,
const ring  r 
)

Definition at line 52 of file p_polys.cc.

53 {
54  poly h=p_Copy(p,r);
55  poly hh=h;
56  while(h!=NULL)
57  {
58  number c=pGetCoeff(h);
59  pSetCoeff0(h,n_Farey(c,N,r->cf));
60  n_Delete(&c,r->cf);
61  pIter(h);
62  }
63  while((hh!=NULL)&&(n_IsZero(pGetCoeff(hh),r->cf)))
64  {
65  p_LmDelete(&hh,r);
66  }
67  h=hh;
68  while((h!=NULL) && (pNext(h)!=NULL))
69  {
70  if(n_IsZero(pGetCoeff(pNext(h)),r->cf))
71  {
72  p_LmDelete(&pNext(h),r);
73  }
74  else pIter(h);
75  }
76  return hh;
77 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
#define pIter(p)
Definition: monomials.h:38
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:48
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
Definition: coeffs.h:789
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
#define pSetCoeff0(p, n)
Definition: monomials.h:60
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972

◆ p_GcdMon()

poly p_GcdMon ( poly  f,
poly  g,
const ring  r 
)

polynomial gcd for f=mon

Definition at line 4838 of file p_polys.cc.

4839 {
4840  assume(f!=NULL);
4841  assume(g!=NULL);
4842  assume(pNext(f)==NULL);
4843  poly G=p_Head(f,r);
4844  poly h=g;
4845  int *mf=(int*)omAlloc((r->N+1)*sizeof(int));
4846  p_GetExpV(f,mf,r);
4847  int *mh=(int*)omAlloc((r->N+1)*sizeof(int));
4848  BOOLEAN const_mon;
4849  BOOLEAN one_coeff=n_IsOne(pGetCoeff(G),r->cf);
4850  loop
4851  {
4852  if (h==NULL) break;
4853  if(!one_coeff)
4854  {
4855  number n=n_SubringGcd(pGetCoeff(G),pGetCoeff(h),r->cf);
4856  one_coeff=n_IsOne(n,r->cf);
4857  p_SetCoeff(G,n,r);
4858  }
4859  p_GetExpV(h,mh,r);
4860  const_mon=TRUE;
4861  for(unsigned j=r->N;j!=0;j--)
4862  {
4863  if (mh[j]<mf[j]) mf[j]=mh[j];
4864  if (mf[j]>0) const_mon=FALSE;
4865  }
4866  if (one_coeff && const_mon) break;
4867  pIter(h);
4868  }
4869  mf[0]=0;
4870  p_SetExpV(G,mf,r); // included is p_SetComp, p_Setm
4871  omFreeSize(mf,(r->N+1)*sizeof(int));
4872  omFreeSize(mh,(r->N+1)*sizeof(int));
4873  return G;
4874 }
int j
Definition: facHensel.cc:105
#define FALSE
Definition: auxiliary.h:94
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1457
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define TRUE
Definition: auxiliary.h:98
g
Definition: cfModGcd.cc:4031
#define loop
Definition: structs.h:78
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static TreeM * G
Definition: janet.cc:32
#define omAlloc(size)
Definition: omAllocDecl.h:210
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1472
#define pIter(p)
Definition: monomials.h:38
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:826
#define assume(x)
Definition: mod2.h:390
FILE * f
Definition: checklibs.c:9
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:688
static Poly * h
Definition: janet.cc:972
int BOOLEAN
Definition: auxiliary.h:85

◆ p_GetCoeffRat()

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

Definition at line 1669 of file p_polys.cc.

1670 {
1671  poly q = pNext(p);
1672  poly res; // = p_Head(p,r);
1673  res = p_GetExp_k_n(p, ishift+1, r->N, r); // does pSetm internally
1674  p_SetCoeff(res,n_Copy(p_GetCoeff(p,r),r),r);
1675  poly s;
1676  long cmp = p_GetComp(p, r);
1677  while ( (q!= NULL) && (p_Comp_k_n(p, q, ishift+1, r)) && (p_GetComp(q, r) == cmp) )
1678  {
1679  s = p_GetExp_k_n(q, ishift+1, r->N, r);
1680  p_SetCoeff(s,n_Copy(p_GetCoeff(q,r),r),r);
1681  res = p_Add_q(res,s,r);
1682  q = pNext(q);
1683  }
1684  cmp = 0;
1685  p_SetCompP(res,cmp,r);
1686  return res;
1687 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define p_GetComp(p, r)
Definition: monomials.h:65
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
static int p_Comp_k_n(poly a, poly b, int k, ring r)
Definition: p_polys.h:641
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:255
CanonicalForm res
Definition: facAbsFact.cc:64
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
#define pNext(p)
Definition: monomials.h:37
#define p_GetCoeff(p, r)
Definition: monomials.h:51
static poly p_GetExp_k_n(poly p, int l, int k, const ring r)
Definition: p_polys.h:1309
int p
Definition: cfModGcd.cc:4019
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893

◆ p_GetMaxExpL()

unsigned long p_GetMaxExpL ( poly  p,
const ring  r,
unsigned long  l_max 
)

return the maximal exponent of p in form of the maximal long var

Definition at line 1167 of file p_polys.cc.

1168 {
1169  unsigned long l_p, divmask = r->divmask;
1170  int i;
1171 
1172  while (p != NULL)
1173  {
1174  l_p = p->exp[r->VarL_Offset[0]];
1175  if (l_p > l_max ||
1176  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1177  l_max = p_GetMaxExpL2(l_max, l_p, r);
1178  for (i=1; i<r->VarL_Size; i++)
1179  {
1180  l_p = p->exp[r->VarL_Offset[i]];
1181  // do the divisibility trick to find out whether l has an exponent
1182  if (l_p > l_max ||
1183  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1184  l_max = p_GetMaxExpL2(l_max, l_p, r);
1185  }
1186  pIter(p);
1187  }
1188  return l_max;
1189 }
#define pIter(p)
Definition: monomials.h:38
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
static unsigned long p_GetMaxExpL2(unsigned long l1, unsigned long l2, const ring r, unsigned long number_of_exp)
Definition: p_polys.cc:1099
int p
Definition: cfModGcd.cc:4019

◆ p_GetMaxExpL2() [1/2]

static unsigned long p_GetMaxExpL2 ( unsigned long  l1,
unsigned long  l2,
const ring  r,
unsigned long  number_of_exp 
)
inlinestatic

Definition at line 1099 of file p_polys.cc.

1101 {
1102  const unsigned long bitmask = r->bitmask;
1103  unsigned long ml1 = l1 & bitmask;
1104  unsigned long ml2 = l2 & bitmask;
1105  unsigned long max = (ml1 > ml2 ? ml1 : ml2);
1106  unsigned long j = number_of_exp - 1;
1107 
1108  if (j > 0)
1109  {
1110  unsigned long mask = bitmask << r->BitsPerExp;
1111  while (1)
1112  {
1113  ml1 = l1 & mask;
1114  ml2 = l2 & mask;
1115  max |= ((ml1 > ml2 ? ml1 : ml2) & mask);
1116  j--;
1117  if (j == 0) break;
1118  mask = mask << r->BitsPerExp;
1119  }
1120  }
1121  return max;
1122 }
int j
Definition: facHensel.cc:105
static int max(int a, int b)
Definition: fast_mult.cc:264

◆ p_GetMaxExpL2() [2/2]

static unsigned long p_GetMaxExpL2 ( unsigned long  l1,
unsigned long  l2,
const ring  r 
)
inlinestatic

Definition at line 1125 of file p_polys.cc.

1126 {
1127  return p_GetMaxExpL2(l1, l2, r, r->ExpPerLong);
1128 }
static unsigned long p_GetMaxExpL2(unsigned long l1, unsigned long l2, const ring r, unsigned long number_of_exp)
Definition: p_polys.cc:1099

◆ p_GetMaxExpP()

poly p_GetMaxExpP ( poly  p,
const ring  r 
)

return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0, next == NULL, ord is not set

Definition at line 1130 of file p_polys.cc.

1131 {
1132  p_CheckPolyRing(p, r);
1133  if (p == NULL) return p_Init(r);
1134  poly max = p_LmInit(p, r);
1135  pIter(p);
1136  if (p == NULL) return max;
1137  int i, offset;
1138  unsigned long l_p, l_max;
1139  unsigned long divmask = r->divmask;
1140 
1141  do
1142  {
1143  offset = r->VarL_Offset[0];
1144  l_p = p->exp[offset];
1145  l_max = max->exp[offset];
1146  // do the divisibility trick to find out whether l has an exponent
1147  if (l_p > l_max ||
1148  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1149  max->exp[offset] = p_GetMaxExpL2(l_max, l_p, r);
1150 
1151  for (i=1; i<r->VarL_Size; i++)
1152  {
1153  offset = r->VarL_Offset[i];
1154  l_p = p->exp[offset];
1155  l_max = max->exp[offset];
1156  // do the divisibility trick to find out whether l has an exponent
1157  if (l_p > l_max ||
1158  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1159  max->exp[offset] = p_GetMaxExpL2(l_max, l_p, r);
1160  }
1161  pIter(p);
1162  }
1163  while (p != NULL);
1164  return max;
1165 }
#define pIter(p)
Definition: monomials.h:38
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
static int max(int a, int b)
Definition: fast_mult.cc:264
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1272
static unsigned long p_GetMaxExpL2(unsigned long l1, unsigned long l2, const ring r, unsigned long number_of_exp)
Definition: p_polys.cc:1099
int p
Definition: cfModGcd.cc:4019
int offset
Definition: libparse.cc:1091
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257

◆ p_GetSetmProc()

p_SetmProc p_GetSetmProc ( const ring  r)

Definition at line 552 of file p_polys.cc.

553 {
554  // covers lp, rp, ls,
555  if (r->typ == NULL) return p_Setm_Dummy;
556 
557  if (r->OrdSize == 1)
558  {
559  if (r->typ[0].ord_typ == ro_dp &&
560  r->typ[0].data.dp.start == 1 &&
561  r->typ[0].data.dp.end == r->N &&
562  r->typ[0].data.dp.place == r->pOrdIndex)
563  return p_Setm_TotalDegree;
564  if (r->typ[0].ord_typ == ro_wp &&
565  r->typ[0].data.wp.start == 1 &&
566  r->typ[0].data.wp.end == r->N &&
567  r->typ[0].data.wp.place == r->pOrdIndex &&
568  r->typ[0].data.wp.weights == r->firstwv)
570  }
571  return p_Setm_General;
572 }
void p_Setm_General(poly p, const ring r)
Definition: p_polys.cc:154
Definition: ring.h:54
void p_Setm_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:546
void p_Setm_TotalDegree(poly p, const ring r)
Definition: p_polys.cc:539
void p_Setm_Dummy(poly p, const ring r)
Definition: p_polys.cc:533
#define NULL
Definition: omList.c:10
Definition: ring.h:53

◆ p_GetShortExpVector() [1/2]

unsigned long p_GetShortExpVector ( const poly  p,
const ring  r 
)

Definition at line 4679 of file p_polys.cc.

4680 {
4681  assume(p != NULL);
4682  unsigned long ev = 0; // short exponent vector
4683  unsigned int n = BIT_SIZEOF_LONG / r->N; // number of bits per exp
4684  unsigned int m1; // highest bit which is filled with (n+1)
4685  int i=0,j=1;
4686 
4687  if (n == 0)
4688  {
4689  if (r->N <2*BIT_SIZEOF_LONG)
4690  {
4691  n=1;
4692  m1=0;
4693  }
4694  else
4695  {
4696  for (; j<=r->N; j++)
4697  {
4698  if (p_GetExp(p,j,r) > 0) i++;
4699  if (i == BIT_SIZEOF_LONG) break;
4700  }
4701  if (i>0)
4702  ev = ~(0UL) >> (BIT_SIZEOF_LONG - i);
4703  return ev;
4704  }
4705  }
4706  else
4707  {
4708  m1 = (n+1)*(BIT_SIZEOF_LONG - n*r->N);
4709  }
4710 
4711  n++;
4712  while (i<m1)
4713  {
4714  ev |= GetBitFields(p_GetExp(p, j,r), i, n);
4715  i += n;
4716  j++;
4717  }
4718 
4719  n--;
4720  while (i<BIT_SIZEOF_LONG)
4721  {
4722  ev |= GetBitFields(p_GetExp(p, j,r), i, n);
4723  i += n;
4724  j++;
4725  }
4726  return ev;
4727 }
int j
Definition: facHensel.cc:105
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
static unsigned long GetBitFields(const long e, const unsigned int s, const unsigned int n)
Definition: p_polys.cc:4646
#define NULL
Definition: omList.c:10
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:78
int p
Definition: cfModGcd.cc:4019

◆ p_GetShortExpVector() [2/2]

unsigned long p_GetShortExpVector ( const poly  p,
const poly  pp,
const ring  r 
)

p_GetShortExpVector of p * pp

Definition at line 4731 of file p_polys.cc.

4732 {
4733  assume(p != NULL);
4734  assume(pp != NULL);
4735 
4736  unsigned long ev = 0; // short exponent vector
4737  unsigned int n = BIT_SIZEOF_LONG / r->N; // number of bits per exp
4738  unsigned int m1; // highest bit which is filled with (n+1)
4739  int j=1;
4740  unsigned long i = 0L;
4741 
4742  if (n == 0)
4743  {
4744  if (r->N <2*BIT_SIZEOF_LONG)
4745  {
4746  n=1;
4747  m1=0;
4748  }
4749  else
4750  {
4751  for (; j<=r->N; j++)
4752  {
4753  if (p_GetExp(p,j,r) > 0 || p_GetExp(pp,j,r) > 0) i++;
4754  if (i == BIT_SIZEOF_LONG) break;
4755  }
4756  if (i>0)
4757  ev = ~(0UL) >> (BIT_SIZEOF_LONG - i);
4758  return ev;
4759  }
4760  }
4761  else
4762  {
4763  m1 = (n+1)*(BIT_SIZEOF_LONG - n*r->N);
4764  }
4765 
4766  n++;
4767  while (i<m1)
4768  {
4769  ev |= GetBitFields(p_GetExp(p, j,r) + p_GetExp(pp, j,r), i, n);
4770  i += n;
4771  j++;
4772  }
4773 
4774  n--;
4775  while (i<BIT_SIZEOF_LONG)
4776  {
4777  ev |= GetBitFields(p_GetExp(p, j,r) + p_GetExp(pp, j,r), i, n);
4778  i += n;
4779  j++;
4780  }
4781  return ev;
4782 }
int j
Definition: facHensel.cc:105
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define assume(x)
Definition: mod2.h:390
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
int i
Definition: cfEzgcd.cc:125
static unsigned long GetBitFields(const long e, const unsigned int s, const unsigned int n)
Definition: p_polys.cc:4646
#define NULL
Definition: omList.c:10
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:78
int p
Definition: cfModGcd.cc:4019

◆ p_GetVariables()

int p_GetVariables ( poly  p,
int *  e,
const ring  r 
)

set entry e[i] to 1 if var(i) occurs in p, ignore var(j) if e[j]>0 return #(e[i]>0)

Definition at line 1259 of file p_polys.cc.

1260 {
1261  int i;
1262  int n=0;
1263  while(p!=NULL)
1264  {
1265  n=0;
1266  for(i=r->N; i>0; i--)
1267  {
1268  if(e[i]==0)
1269  {
1270  if (p_GetExp(p,i,r)>0)
1271  {
1272  e[i]=1;
1273  n++;
1274  }
1275  }
1276  else
1277  n++;
1278  }
1279  if (n==r->N) break;
1280  pIter(p);
1281  }
1282  return n;
1283 }
#define pIter(p)
Definition: monomials.h:38
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
int p
Definition: cfModGcd.cc:4019

◆ p_HasNotCF()

BOOLEAN p_HasNotCF ( poly  p1,
poly  p2,
const ring  r 
)

Definition at line 1321 of file p_polys.cc.

1322 {
1323 
1324  if (p_GetComp(p1,r) > 0 || p_GetComp(p2,r) > 0)
1325  return FALSE;
1326  int i = rVar(r);
1327  loop
1328  {
1329  if ((p_GetExp(p1, i, r) > 0) && (p_GetExp(p2, i, r) > 0))
1330  return FALSE;
1331  i--;
1332  if (i == 0)
1333  return TRUE;
1334  }
1335 }
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:65
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
#define TRUE
Definition: auxiliary.h:98
#define loop
Definition: structs.h:78
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
int i
Definition: cfEzgcd.cc:125

◆ p_Homogen()

poly p_Homogen ( poly  p,
int  varnum,
const ring  r 
)

Definition at line 3208 of file p_polys.cc.

3209 {
3210  pFDegProc deg;
3211  if (r->pLexOrder && (r->order[0]==ringorder_lp))
3212  deg=p_Totaldegree;
3213  else
3214  deg=r->pFDeg;
3215 
3216  poly q=NULL, qn;
3217  int o,ii;
3218  sBucket_pt bp;
3219 
3220  if (p!=NULL)
3221  {
3222  if ((varnum < 1) || (varnum > rVar(r)))
3223  {
3224  return NULL;
3225  }
3226  o=deg(p,r);
3227  q=pNext(p);
3228  while (q != NULL)
3229  {
3230  ii=deg(q,r);
3231  if (ii>o) o=ii;
3232  pIter(q);
3233  }
3234  q = p_Copy(p,r);
3235  bp = sBucketCreate(r);
3236  while (q != NULL)
3237  {
3238  ii = o-deg(q,r);
3239  if (ii!=0)
3240  {
3241  p_AddExp(q,varnum, (long)ii,r);
3242  p_Setm(q,r);
3243  }
3244  qn = pNext(q);
3245  pNext(q) = NULL;
3246  sBucket_Add_m(bp, q);
3247  q = qn;
3248  }
3249  sBucketDestroyAdd(bp, &q, &ii);
3250  }
3251  return q;
3252 }
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
void sBucketDestroyAdd(sBucket_pt bucket, poly *p, int *length)
Definition: sbuckets.h:68
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1444
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
#define pIter(p)
Definition: monomials.h:38
sBucket_pt sBucketCreate(const ring r)
Definition: sbuckets.cc:98
#define NULL
Definition: omList.c:10
long(* pFDegProc)(poly p, ring r)
Definition: ring.h:39
#define pNext(p)
Definition: monomials.h:37
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
static long p_AddExp(poly p, int v, long ee, ring r)
Definition: p_polys.h:607
int p
Definition: cfModGcd.cc:4019
void sBucket_Add_m(sBucket_pt bucket, poly p)
Definition: sbuckets.cc:175

◆ p_InitContent()

number p_InitContent ( poly  ph,
const ring  r 
)

Definition at line 2549 of file p_polys.cc.

2552 {
2554  assume(ph!=NULL);
2555  assume(pNext(ph)!=NULL);
2556  assume(rField_is_Q(r));
2557  if (pNext(pNext(ph))==NULL)
2558  {
2559  return n_GetNumerator(pGetCoeff(pNext(ph)),r->cf);
2560  }
2561  poly p=ph;
2562  number n1=n_GetNumerator(pGetCoeff(p),r->cf);
2563  pIter(p);
2564  number n2=n_GetNumerator(pGetCoeff(p),r->cf);
2565  pIter(p);
2566  number d;
2567  number t;
2568  loop
2569  {
2570  nlNormalize(pGetCoeff(p),r->cf);
2571  t=n_GetNumerator(pGetCoeff(p),r->cf);
2572  if (nlGreaterZero(t,r->cf))
2573  d=nlAdd(n1,t,r->cf);
2574  else
2575  d=nlSub(n1,t,r->cf);
2576  nlDelete(&t,r->cf);
2577  nlDelete(&n1,r->cf);
2578  n1=d;
2579  pIter(p);
2580  if (p==NULL) break;
2581  nlNormalize(pGetCoeff(p),r->cf);
2582  t=n_GetNumerator(pGetCoeff(p),r->cf);
2583  if (nlGreaterZero(t,r->cf))
2584  d=nlAdd(n2,t,r->cf);
2585  else
2586  d=nlSub(n2,t,r->cf);
2587  nlDelete(&t,r->cf);
2588  nlDelete(&n2,r->cf);
2589  n2=d;
2590  pIter(p);
2591  if (p==NULL) break;
2592  }
2593  d=nlGcd(n1,n2,r->cf);
2594  nlDelete(&n1,r->cf);
2595  nlDelete(&n2,r->cf);
2596  return d;
2597 }
2598 #else
2599 {
2600  number d=pGetCoeff(ph);
2601  int s;
2602  int s2=-1;
2603  if(rField_is_Q(r))
2604  {
2605  if (SR_HDL(d)&SR_INT) return d;
2606  s=mpz_size1(d->z);
2607  }
2608  else
2609  s=n_Size(d,r->cf);
2610  number d2=d;
2611  loop
2612  {
2613  pIter(ph);
2614  if(ph==NULL)
2615  {
2616  if (s2==-1) return n_Copy(d,r->cf);
2617  break;
2618  }
2619  if (rField_is_Q(r))
2620  {
2621  if (SR_HDL(pGetCoeff(ph))&SR_INT)
2622  {
2623  s2=s;
2624  d2=d;
2625  s=0;
2626  d=pGetCoeff(ph);
2627  if (s2==0) break;
2628  }
2629  else if (mpz_size1((pGetCoeff(ph)->z))<=s)
2630  {
2631  s2=s;
2632  d2=d;
2633  d=pGetCoeff(ph);
2634  s=mpz_size1(d->z);
2635  }
2636  }
2637  else
2638  {
2639  int ns=n_Size(pGetCoeff(ph),r->cf);
2640  if (ns<=3)
2641  {
2642  s2=s;
2643  d2=d;
2644  d=pGetCoeff(ph);
2645  s=ns;
2646  if (s2<=3) break;
2647  }
2648  else if (ns<s)
2649  {
2650  s2=s;
2651  d2=d;
2652  d=pGetCoeff(ph);
2653  s=ns;
2654  }
2655  }
2656  }
2657  return n_SubringGcd(d,d2,r->cf);
2658 }
static FORCE_INLINE number n_GetNumerator(number &n, const coeffs r)
return the numerator of n (if elements of r are by nature not fractional, result is n)
Definition: coeffs.h:608
LINLINE number nlSub(number la, number li, const coeffs r)
Definition: longrat.cc:2599
const CanonicalForm int s
Definition: facAbsFact.cc:55
BOOLEAN nlGreaterZero(number za, const coeffs r)
Definition: longrat.cc:1166
#define TEST_OPT_CONTENTSB
Definition: options.h:125
LINLINE number nlAdd(number la, number li, const coeffs r)
Definition: longrat.cc:2533
number nlGcd(number a, number b, const coeffs r)
Definition: longrat.cc:1203
#define loop
Definition: structs.h:78
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define pIter(p)
Definition: monomials.h:38
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:497
void nlNormalize(number &x, const coeffs r)
Definition: longrat.cc:1345
#define mpz_size1(A)
Definition: si_gmp.h:12
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
LINLINE void nlDelete(number *a, const coeffs r)
Definition: longrat.cc:2498
#define SR_INT
Definition: longrat.h:66
#define pNext(p)
Definition: monomials.h:37
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:688
#define SR_HDL(A)
Definition: tgb.cc:35
int p
Definition: cfModGcd.cc:4019
static FORCE_INLINE int n_Size(number n, const coeffs r)
return a non-negative measure for the complexity of n; return 0 only when n represents zero; (used fo...
Definition: coeffs.h:570

◆ p_Invers()

static poly p_Invers ( int  n,
poly  u,
intvec w,
const ring  R 
)
static

Definition at line 4367 of file p_polys.cc.

4368 {
4369  if(n<0)
4370  return NULL;
4371  number u0=n_Invers(pGetCoeff(u),R->cf);
4372  poly v=p_NSet(u0,R);
4373  if(n==0)
4374  return v;
4375  short *ww=iv2array(w,R);
4376  poly u1=p_JetW(p_Sub(p_One(R),__p_Mult_nn(u,u0,R),R),n,ww,R);
4377  if(u1==NULL)
4378  {
4379  omFreeSize((ADDRESS)ww,(rVar(R)+1)*sizeof(short));
4380  return v;
4381  }
4382  poly v1=__p_Mult_nn(p_Copy(u1,R),u0,R);
4383  v=p_Add_q(v,p_Copy(v1,R),R);
4384  for(int i=n/p_MinDeg(u1,w,R);i>1;i--)
4385  {
4386  v1=p_JetW(p_Mult_q(v1,p_Copy(u1,R),R),n,ww,R);
4387  v=p_Add_q(v,p_Copy(v1,R),R);
4388  }
4389  p_Delete(&u1,R);
4390  p_Delete(&v1,R);
4391  omFreeSize((ADDRESS)ww,(rVar(R)+1)*sizeof(short));
4392  return v;
4393 }
short * iv2array(intvec *iv, const ring R)
Definition: weight.cc:206
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1435
int p_MinDeg(poly p, intvec *w, const ring R)
Definition: p_polys.cc:4346
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
void * ADDRESS
Definition: auxiliary.h:133
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
poly p_Sub(poly p1, poly p2, const ring r)
Definition: p_polys.cc:1937
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
poly p_One(const ring r)
Definition: p_polys.cc:1305
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible
Definition: coeffs.h:564
int i
Definition: cfEzgcd.cc:125
poly p_JetW(poly p, int m, short *w, const ring R)
Definition: p_polys.cc:4328
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define __p_Mult_nn(p, n, r)
Definition: p_polys.h:928
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
const CanonicalForm & w
Definition: facAbsFact.cc:55
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1051

◆ p_ISet()

poly p_ISet ( long  i,
const ring  r 
)

returns the poly representing the integer i

Definition at line 1289 of file p_polys.cc.

1290 {
1291  poly rc = NULL;
1292  if (i!=0)
1293  {
1294  rc = p_Init(r);
1295  pSetCoeff0(rc,n_Init(i,r->cf));
1296  if (n_IsZero(pGetCoeff(rc),r->cf))
1297  p_LmDelete(&rc,r);
1298  }
1299  return rc;
1300 }
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
int i
Definition: cfEzgcd.cc:125
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
#define NULL
Definition: omList.c:10
#define pSetCoeff0(p, n)
Definition: monomials.h:60
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257

◆ p_IsHomogeneous()

BOOLEAN p_IsHomogeneous ( poly  p,
const ring  r 
)

Definition at line 3257 of file p_polys.cc.

3258 {
3259  poly qp=p;
3260  int o;
3261 
3262  if ((p == NULL) || (pNext(p) == NULL)) return TRUE;
3263  pFDegProc d;
3264  if (r->pLexOrder && (r->order[0]==ringorder_lp))
3265  d=p_Totaldegree;
3266  else
3267  d=r->pFDeg;
3268  o = d(p,r);
3269  do
3270  {
3271  if (d(qp,r) != o) return FALSE;
3272  pIter(qp);
3273  }
3274  while (qp != NULL);
3275  return TRUE;
3276 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1444
#define pIter(p)
Definition: monomials.h:38
#define NULL
Definition: omList.c:10
long(* pFDegProc)(poly p, ring r)
Definition: ring.h:39
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019

◆ p_IsPurePower()

int p_IsPurePower ( const poly  p,
const ring  r 
)

return i, if head depends only on var(i)

Definition at line 1218 of file p_polys.cc.

1219 {
1220  int i,k=0;
1221 
1222  for (i=r->N;i;i--)
1223  {
1224  if (p_GetExp(p,i, r)!=0)
1225  {
1226  if(k!=0) return 0;
1227  k=i;
1228  }
1229  }
1230  return k;
1231 }
int k
Definition: cfEzgcd.cc:92
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
int i
Definition: cfEzgcd.cc:125
int p
Definition: cfModGcd.cc:4019

◆ p_IsUnivariate()

int p_IsUnivariate ( poly  p,
const ring  r 
)

return i, if poly depends only on var(i)

Definition at line 1239 of file p_polys.cc.

1240 {
1241  int i,k=-1;
1242 
1243  while (p!=NULL)
1244  {
1245  for (i=r->N;i;i--)
1246  {
1247  if (p_GetExp(p,i, r)!=0)
1248  {
1249  if((k!=-1)&&(k!=i)) return 0;
1250  k=i;
1251  }
1252  }
1253  pIter(p);
1254  }
1255  return k;
1256 }
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:38
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
int p
Definition: cfModGcd.cc:4019

◆ p_Jet()

poly p_Jet ( poly  p,
int  m,
const ring  R 
)

Definition at line 4284 of file p_polys.cc.

4285 {
4286  while((p!=NULL) && (p_Totaldegree(p,R)>m)) p_LmDelete(&p,R);
4287  if (p==NULL) return NULL;
4288  poly r=p;
4289  while (pNext(p)!=NULL)
4290  {
4291  if (p_Totaldegree(pNext(p),R)>m)
4292  {
4293  p_LmDelete(&pNext(p),R);
4294  }
4295  else
4296  pIter(p);
4297  }
4298  return r;
4299 }
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1444
#define pIter(p)
Definition: monomials.h:38
int m
Definition: cfEzgcd.cc:121
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
#define pNext(p)
Definition: monomials.h:37
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
int p
Definition: cfModGcd.cc:4019

◆ p_JetW()

poly p_JetW ( poly  p,
int  m,
short *  w,
const ring  R 
)

Definition at line 4328 of file p_polys.cc.

4329 {
4330  while((p!=NULL) && (totaldegreeWecart_IV(p,R,w)>m)) p_LmDelete(&p,R);
4331  if (p==NULL) return NULL;
4332  poly r=p;
4333  while (pNext(p)!=NULL)
4334  {
4335  if (totaldegreeWecart_IV(pNext(p),R,w)>m)
4336  {
4337  p_LmDelete(&pNext(p),R);
4338  }
4339  else
4340  pIter(p);
4341  }
4342  return r;
4343 }
long totaldegreeWecart_IV(poly p, ring r, const short *w)
Definition: weight.cc:237
#define pIter(p)
Definition: monomials.h:38
int m
Definition: cfEzgcd.cc:121
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:37
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
int p
Definition: cfModGcd.cc:4019

◆ p_Last()

poly p_Last ( const poly  p,
int &  l,
const ring  r 
)

Definition at line 4519 of file p_polys.cc.

4520 {
4521  if (p == NULL)
4522  {
4523  l = 0;
4524  return NULL;
4525  }
4526  l = 1;
4527  poly a = p;
4528  if (! rIsSyzIndexRing(r))
4529  {
4530  poly next = pNext(a);
4531  while (next!=NULL)
4532  {
4533  a = next;
4534  next = pNext(a);
4535  l++;
4536  }
4537  }
4538  else
4539  {
4540  int curr_limit = rGetCurrSyzLimit(r);
4541  poly pp = a;
4542  while ((a=pNext(a))!=NULL)
4543  {
4544  if (__p_GetComp(a,r)<=curr_limit/*syzComp*/)
4545  l++;
4546  else break;
4547  pp = a;
4548  }
4549  a=pp;
4550  }
4551  return a;
4552 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:710
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:713
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93
ListNode * next
Definition: janet.h:31

◆ p_Lcm() [1/2]

void p_Lcm ( const poly  a,
const poly  b,
poly  m,
const ring  r 
)

Definition at line 1602 of file p_polys.cc.

1603 {
1604  for (int i=r->N; i; --i)
1605  p_SetExp(m,i, si_max( p_GetExp(a,i,r), p_GetExp(b,i,r)),r);
1606 
1607  p_SetComp(m, si_max(p_GetComp(a,r), p_GetComp(b,r)),r);
1608  /* Don't do a pSetm here, otherwise hres/lres chockes */
1609 }
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
#define p_GetComp(p, r)
Definition: monomials.h:65
CanonicalForm b
Definition: cfModGcd.cc:4044
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
int m
Definition: cfEzgcd.cc:121
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
int i
Definition: cfEzgcd.cc:125
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
Definition: p_polys.h:489

◆ p_Lcm() [2/2]

poly p_Lcm ( const poly  a,
const poly  b,
const ring  r 
)

Definition at line 1611 of file p_polys.cc.

1612 {
1613  poly m=p_Init(r);
1614  p_Lcm(a, b, m, r);
1615  p_Setm(m,r);
1616  return(m);
1617 }
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1602
CanonicalForm b
Definition: cfModGcd.cc:4044
int m
Definition: cfEzgcd.cc:121
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257

◆ p_LcmRat()

poly p_LcmRat ( const poly  a,
const poly  b,
const long  lCompM,
const ring  r 
)

Definition at line 1624 of file p_polys.cc.

1625 {
1626  poly m = // p_One( r);
1627  p_Init(r);
1628 
1629 // const int (currRing->N) = r->N;
1630 
1631  // for (int i = (currRing->N); i>=r->real_var_start; i--)
1632  for (int i = r->real_var_end; i>=r->real_var_start; i--)
1633  {
1634  const int lExpA = p_GetExp (a, i, r);
1635  const int lExpB = p_GetExp (b, i, r);
1636 
1637  p_SetExp (m, i, si_max(lExpA, lExpB), r);
1638  }
1639 
1640  p_SetComp (m, lCompM, r);
1641  p_Setm(m,r);
1642  n_New(&(p_GetCoeff(m, r)), r);
1643 
1644  return(m);
1645 };
#define n_New(n, r)
Definition: coeffs.h:440
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
CanonicalForm b
Definition: cfModGcd.cc:4044
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
int m
Definition: cfEzgcd.cc:121
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
int i
Definition: cfEzgcd.cc:125
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
Definition: p_polys.h:489
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
#define p_GetCoeff(p, r)
Definition: monomials.h:51
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257

◆ p_LmDeleteAndNextRat()

void p_LmDeleteAndNextRat ( poly *  p,
int  ishift,
ring  r 
)

Definition at line 1647 of file p_polys.cc.

1648 {
1649  /* modifies p*/
1650  // Print("start: "); Print(" "); p_wrp(*p,r);
1651  p_LmCheckPolyRing2(*p, r);
1652  poly q = p_Head(*p,r);
1653  const long cmp = p_GetComp(*p, r);
1654  while ( ( (*p)!=NULL ) && ( p_Comp_k_n(*p, q, ishift+1, r) ) && (p_GetComp(*p, r) == cmp) )
1655  {
1656  p_LmDelete(p,r);
1657  // Print("while: ");p_wrp(*p,r);Print(" ");
1658  }
1659  // p_wrp(*p,r);Print(" ");
1660  // PrintS("end\n");
1661  p_LmDelete(&q,r);
1662 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:200
#define p_GetComp(p, r)
Definition: monomials.h:65
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:826
static int p_Comp_k_n(poly a, poly b, int k, ring r)
Definition: p_polys.h:641
#define NULL
Definition: omList.c:10
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
int p
Definition: cfModGcd.cc:4019

◆ p_LowVar()

int p_LowVar ( poly  p,
const ring  r 
)

the minimal index of used variables - 1

Definition at line 4578 of file p_polys.cc.

4579 {
4580  int k,l,lex;
4581 
4582  if (p == NULL) return -1;
4583 
4584  k = 32000;/*a very large dummy value*/
4585  while (p != NULL)
4586  {
4587  l = 1;
4588  lex = p_GetExp(p,l,r);
4589  while ((l < (rVar(r))) && (lex == 0))
4590  {
4591  l++;
4592  lex = p_GetExp(p,l,r);
4593  }
4594  l--;
4595  if (l < k) k = l;
4596  pIter(p);
4597  }
4598  return k;
4599 }
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:38
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define NULL
Definition: omList.c:10
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ p_MDivide()

poly p_MDivide ( poly  a,
poly  b,
const ring  r 
)

Definition at line 1454 of file p_polys.cc.

1455 {
1456  assume((p_GetComp(a,r)==p_GetComp(b,r)) || (p_GetComp(b,r)==0));
1457  int i;
1458  poly result = p_Init(r);
1459 
1460  for(i=(int)r->N; i; i--)
1461  p_SetExp(result,i, p_GetExp(a,i,r)- p_GetExp(b,i,r),r);
1462  p_SetComp(result, p_GetComp(a,r) - p_GetComp(b,r),r);
1463  p_Setm(result,r);
1464  return result;
1465 }
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
#define p_GetComp(p, r)
Definition: monomials.h:65
CanonicalForm b
Definition: cfModGcd.cc:4044
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
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
Definition: p_polys.h:489
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257
return result
Definition: facAbsBiFact.cc:76

◆ p_MinDeg()

int p_MinDeg ( poly  p,
intvec w,
const ring  R 
)

Definition at line 4346 of file p_polys.cc.

4347 {
4348  if(p==NULL)
4349  return -1;
4350  int d=-1;
4351  while(p!=NULL)
4352  {
4353  int d0=0;
4354  for(int j=0;j<rVar(R);j++)
4355  if(w==NULL||j>=w->length())
4356  d0+=p_GetExp(p,j+1,R);
4357  else
4358  d0+=(*w)[j]*p_GetExp(p,j+1,R);
4359  if(d0<d||d==-1)
4360  d=d0;
4361  pIter(p);
4362  }
4363  return d;
4364 }
int j
Definition: facHensel.cc:105
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
#define pIter(p)
Definition: monomials.h:38
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
const CanonicalForm & w
Definition: facAbsFact.cc:55
int p
Definition: cfModGcd.cc:4019

◆ p_mInit()

poly p_mInit ( const char *  st,
BOOLEAN ok,
const ring  r 
)

Definition at line 1412 of file p_polys.cc.

1413 {
1414  poly p;
1415  const char *s=p_Read(st,p,r);
1416  if (*s!='\0')
1417  {
1418  if ((s!=st)&&isdigit(st[0]))
1419  {
1421  }
1422  ok=FALSE;
1423  p_Delete(&p,r);
1424  return NULL;
1425  }
1426  p_Test(p,r);
1427  ok=!errorreported;
1428  return p;
1429 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
const char * p_Read(const char *st, poly &rc, const ring r)
Definition: p_polys.cc:1340
#define p_Test(p, r)
Definition: p_polys.h:164
short errorreported
Definition: feFopen.cc:23
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
#define NULL
Definition: omList.c:10
int p
Definition: cfModGcd.cc:4019

◆ p_MonMult()

static void p_MonMult ( poly  p,
poly  q,
const ring  r 
)
static

Definition at line 1971 of file p_polys.cc.

1972 {
1973  number x, y;
1974 
1975  y = pGetCoeff(p);
1976  x = n_Mult(y,pGetCoeff(q),r->cf);
1977  n_Delete(&y,r->cf);
1978  pSetCoeff0(p,x);
1979  //for (int i=pVariables; i!=0; i--)
1980  //{
1981  // pAddExp(p,i, pGetExp(q,i));
1982  //}
1983  //p->Order += q->Order;
1984  p_ExpVectorAdd(p,q,r);
1985 }
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1348
Variable x
Definition: cfModGcd.cc:4023
#define pSetCoeff0(p, n)
Definition: monomials.h:60
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
int p
Definition: cfModGcd.cc:4019

◆ p_MonMultC()

static poly p_MonMultC ( poly  p,
poly  q,
const ring  rr 
)
static

Definition at line 1991 of file p_polys.cc.

1992 {
1993  number x;
1994  poly r = p_Init(rr);
1995 
1996  x = n_Mult(pGetCoeff(p),pGetCoeff(q),rr->cf);
1997  pSetCoeff0(r,x);
1998  p_ExpVectorSum(r,p, q, rr);
1999  return r;
2000 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
Variable x
Definition: cfModGcd.cc:4023
#define pSetCoeff0(p, n)
Definition: monomials.h:60
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1362
int p
Definition: cfModGcd.cc:4019
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257

◆ p_MonPower()

static poly p_MonPower ( poly  p,
int  exp,
const ring  r 
)
static

Definition at line 1947 of file p_polys.cc.

1948 {
1949  int i;
1950 
1951  if(!n_IsOne(pGetCoeff(p),r->cf))
1952  {
1953  number x, y;
1954  y = pGetCoeff(p);
1955  n_Power(y,exp,&x,r->cf);
1956  n_Delete(&y,r->cf);
1957  pSetCoeff0(p,x);
1958  }
1959  for (i=rVar(r); i!=0; i--)
1960  {
1961  p_MultExp(p,i, exp,r);
1962  }
1963  p_Setm(p,r);
1964  return p;
1965 }
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:358
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
static long p_MultExp(poly p, int v, long ee, ring r)
Definition: p_polys.h:622
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
int i
Definition: cfEzgcd.cc:125
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
Definition: coeffs.h:632
Variable x
Definition: cfModGcd.cc:4023
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
#define pSetCoeff0(p, n)
Definition: monomials.h:60
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
int p
Definition: cfModGcd.cc:4019

◆ p_Norm()

void p_Norm ( poly  p1,
const ring  r 
)

Definition at line 3670 of file p_polys.cc.

3671 {
3672  if (rField_is_Ring(r))
3673  {
3674  if (!n_IsUnit(pGetCoeff(p1), r->cf)) return;
3675  // Werror("p_Norm not possible in the case of coefficient rings.");
3676  }
3677  else if (p1!=NULL)
3678  {
3679  if (pNext(p1)==NULL)
3680  {
3681  p_SetCoeff(p1,n_Init(1,r->cf),r);
3682  return;
3683  }
3684  poly h;
3685  if (!n_IsOne(pGetCoeff(p1),r->cf))
3686  {
3687  number k, c;
3688  n_Normalize(pGetCoeff(p1),r->cf);
3689  k = pGetCoeff(p1);
3690  c = n_Init(1,r->cf);
3691  pSetCoeff0(p1,c);
3692  h = pNext(p1);
3693  while (h!=NULL)
3694  {
3695  c=n_Div(pGetCoeff(h),k,r->cf);
3696  // no need to normalize: Z/p, R
3697  // normalize already in nDiv: Q_a, Z/p_a
3698  // remains: Q
3699  if (rField_is_Q(r) && (!n_IsOne(c,r->cf))) n_Normalize(c,r->cf);
3700  p_SetCoeff(h,c,r);
3701  pIter(h);
3702  }
3703  n_Delete(&k,r->cf);
3704  }
3705  else
3706  {
3707  //if (r->cf->cfNormalize != nDummy2) //TODO: OPTIMIZE
3708  {
3709  h = pNext(p1);
3710  while (h!=NULL)
3711  {
3712  n_Normalize(pGetCoeff(h),r->cf);
3713  pIter(h);
3714  }
3715  }
3716  }
3717  }
3718 }
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:515
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:578
int k
Definition: cfEzgcd.cc:92
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
#define pIter(p)
Definition: monomials.h:38
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:497
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:615
#define pNext(p)
Definition: monomials.h:37
#define pSetCoeff0(p, n)
Definition: monomials.h:60
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static Poly * h
Definition: janet.cc:972

◆ p_Normalize()

void p_Normalize ( poly  p,
const ring  r 
)

Definition at line 3723 of file p_polys.cc.

3724 {
3725  if (rField_has_simple_inverse(r)) return; /* Z/p, GF(p,n), R, long R/C */
3726  while (p!=NULL)
3727  {
3728  // no test befor n_Normalize: n_Normalize should fix problems
3729  n_Normalize(pGetCoeff(p),r->cf);
3730  pIter(p);
3731  }
3732 }
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:578
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:539
#define pIter(p)
Definition: monomials.h:38
#define NULL
Definition: omList.c:10
int p
Definition: cfModGcd.cc:4019

◆ p_NSet()

poly p_NSet ( number  n,
const ring  r 
)

returns the poly representing the number n, destroys n

Definition at line 1435 of file p_polys.cc.

1436 {
1437  if (n_IsZero(n,r->cf))
1438  {
1439  n_Delete(&n, r->cf);
1440  return NULL;
1441  }
1442  else
1443  {
1444  poly rc = p_Init(r);
1445  pSetCoeff0(rc,n);
1446  return rc;
1447  }
1448 }
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
#define NULL
Definition: omList.c:10
#define pSetCoeff0(p, n)
Definition: monomials.h:60
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257

◆ p_One()

poly p_One ( const ring  r)

Definition at line 1305 of file p_polys.cc.

1306 {
1307  poly rc = p_Init(r);
1308  pSetCoeff0(rc,n_Init(1,r->cf));
1309  return rc;
1310 }
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
#define pSetCoeff0(p, n)
Definition: monomials.h:60
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257

◆ p_OneComp()

BOOLEAN p_OneComp ( poly  p,
const ring  r 
)

return TRUE if all monoms have the same component

Definition at line 1200 of file p_polys.cc.

1201 {
1202  if(p!=NULL)
1203  {
1204  long i = p_GetComp(p, r);
1205  while (pNext(p)!=NULL)
1206  {
1207  pIter(p);
1208  if(i != p_GetComp(p, r)) return FALSE;
1209  }
1210  }
1211  return TRUE;
1212 }
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:65
#define TRUE
Definition: auxiliary.h:98
#define pIter(p)
Definition: monomials.h:38
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019

◆ p_PermPoly()

poly p_PermPoly ( poly  p,
const int *  perm,
const ring  oldRing,
const ring  dst,
nMapFunc  nMap,
const int *  par_perm,
int  OldPar,
BOOLEAN  use_mult 
)

Definition at line 4028 of file p_polys.cc.

4030 {
4031 #if 0
4032  p_Test(p, oldRing);
4033  PrintS("p_PermPoly::p: "); p_Write(p, oldRing, oldRing);
4034 #endif
4035  const int OldpVariables = rVar(oldRing);
4036  poly result = NULL;
4037  poly result_last = NULL;
4038  poly aq = NULL; /* the map coefficient */
4039  poly qq; /* the mapped monomial */
4040  assume(dst != NULL);
4041  assume(dst->cf != NULL);
4042  #ifdef HAVE_PLURAL
4043  poly tmp_mm=p_One(dst);
4044  #endif
4045  while (p != NULL)
4046  {
4047  // map the coefficient
4048  if ( ((OldPar == 0) || (par_perm == NULL) || rField_is_GF(oldRing) || (nMap==ndCopyMap))
4049  && (nMap != NULL) )
4050  {
4051  qq = p_Init(dst);
4052  assume( nMap != NULL );
4053  number n = nMap(p_GetCoeff(p, oldRing), oldRing->cf, dst->cf);
4054  n_Test (n,dst->cf);
4055  if ( nCoeff_is_algExt(dst->cf) )
4056  n_Normalize(n, dst->cf);
4057  p_GetCoeff(qq, dst) = n;// Note: n can be a ZERO!!!
4058  }
4059  else
4060  {
4061  qq = p_One(dst);
4062 // aq = naPermNumber(p_GetCoeff(p, oldRing), par_perm, OldPar, oldRing); // no dst???
4063 // poly n_PermNumber(const number z, const int *par_perm, const int P, const ring src, const ring dst)
4064  aq = n_PermNumber(p_GetCoeff(p, oldRing), par_perm, OldPar, oldRing, dst);
4065  p_Test(aq, dst);
4066  if ( nCoeff_is_algExt(dst->cf) )
4067  p_Normalize(aq,dst);
4068  if (aq == NULL)
4069  p_SetCoeff(qq, n_Init(0, dst->cf),dst); // Very dirty trick!!!
4070  p_Test(aq, dst);
4071  }
4072  if (rRing_has_Comp(dst))
4073  p_SetComp(qq, p_GetComp(p, oldRing), dst);
4074  if ( n_IsZero(pGetCoeff(qq), dst->cf) )
4075  {
4076  p_LmDelete(&qq,dst);
4077  qq = NULL;
4078  }
4079  else
4080  {
4081  // map pars:
4082  int mapped_to_par = 0;
4083  for(int i = 1; i <= OldpVariables; i++)
4084  {
4085  int e = p_GetExp(p, i, oldRing);
4086  if (e != 0)
4087  {
4088  if (perm==NULL)
4089  p_SetExp(qq, i, e, dst);
4090  else if (perm[i]>0)
4091  {
4092  #ifdef HAVE_PLURAL
4093  if(use_mult)
4094  {
4095  p_SetExp(tmp_mm,perm[i],e,dst);
4096  p_Setm(tmp_mm,dst);
4097  qq=p_Mult_mm(qq,tmp_mm,dst);
4098  p_SetExp(tmp_mm,perm[i],0,dst);
4099 
4100  }
4101  else
4102  #endif
4103  p_AddExp(qq,perm[i], e/*p_GetExp( p,i,oldRing)*/, dst);
4104  }
4105  else if (perm[i]<0)
4106  {
4107  number c = p_GetCoeff(qq, dst);
4108  if (rField_is_GF(dst))
4109  {
4110  assume( dst->cf->extRing == NULL );
4111  number ee = n_Param(1, dst);
4112  number eee;
4113  n_Power(ee, e, &eee, dst->cf); //nfDelete(ee,dst);
4114  ee = n_Mult(c, eee, dst->cf);
4115  //nfDelete(c,dst);nfDelete(eee,dst);
4116  pSetCoeff0(qq,ee);
4117  }
4118  else if (nCoeff_is_Extension(dst->cf))
4119  {
4120  const int par = -perm[i];
4121  assume( par > 0 );
4122 // WarnS("longalg missing 3");
4123 #if 1
4124  const coeffs C = dst->cf;
4125  assume( C != NULL );
4126  const ring R = C->extRing;
4127  assume( R != NULL );
4128  assume( par <= rVar(R) );
4129  poly pcn; // = (number)c
4130  assume( !n_IsZero(c, C) );
4131  if( nCoeff_is_algExt(C) )
4132  pcn = (poly) c;
4133  else // nCoeff_is_transExt(C)
4134  pcn = NUM((fraction)c);
4135  if (pNext(pcn) == NULL) // c->z
4136  p_AddExp(pcn, -perm[i], e, R);
4137  else /* more difficult: we have really to multiply: */
4138  {
4139  poly mmc = p_ISet(1, R);
4140  p_SetExp(mmc, -perm[i], e, R);
4141  p_Setm(mmc, R);
4142  number nnc;
4143  // convert back to a number: number nnc = mmc;
4144  if( nCoeff_is_algExt(C) )
4145  nnc = (number) mmc;
4146  else // nCoeff_is_transExt(C)
4147  nnc = ntInit(mmc, C);
4148  p_GetCoeff(qq, dst) = n_Mult((number)c, nnc, C);
4149  n_Delete((number *)&c, C);
4150  n_Delete((number *)&nnc, C);
4151  }
4152  mapped_to_par=1;
4153 #endif
4154  }
4155  }
4156  else
4157  {
4158  /* this variable maps to 0 !*/
4159  p_LmDelete(&qq, dst);
4160  break;
4161  }
4162  }
4163  }
4164  if ( mapped_to_par && (qq!= NULL) && nCoeff_is_algExt(dst->cf) )
4165  {
4166  number n = p_GetCoeff(qq, dst);
4167  n_Normalize(n, dst->cf);
4168  p_GetCoeff(qq, dst) = n;
4169  }
4170  }
4171  pIter(p);
4172 
4173 #if 0
4174  p_Test(aq,dst);
4175  PrintS("aq: "); p_Write(aq, dst, dst);
4176 #endif
4177 
4178 
4179 #if 1
4180  if (qq!=NULL)
4181  {
4182  p_Setm(qq,dst);
4183 
4184  p_Test(aq,dst);
4185  p_Test(qq,dst);
4186 
4187 #if 0
4188  PrintS("qq: "); p_Write(qq, dst, dst);
4189 #endif
4190 
4191  if (aq!=NULL)
4192  qq=p_Mult_q(aq,qq,dst);
4193  aq = qq;
4194  while (pNext(aq) != NULL) pIter(aq);
4195  if (result_last==NULL)
4196  {
4197  result=qq;
4198  }
4199  else
4200  {
4201  pNext(result_last)=qq;
4202  }
4203  result_last=aq;
4204  aq = NULL;
4205  }
4206  else if (aq!=NULL)
4207  {
4208  p_Delete(&aq,dst);
4209  }
4210  }
4211  result=p_SortAdd(result,dst);
4212 #else
4213  // if (qq!=NULL)
4214  // {
4215  // pSetm(qq);
4216  // pTest(qq);
4217  // pTest(aq);
4218  // if (aq!=NULL) qq=pMult(aq,qq);
4219  // aq = qq;
4220  // while (pNext(aq) != NULL) pIter(aq);
4221  // pNext(aq) = result;
4222  // aq = NULL;
4223  // result = qq;
4224  // }
4225  // else if (aq!=NULL)
4226  // {
4227  // pDelete(&aq);
4228  // }
4229  //}
4230  //p = result;
4231  //result = NULL;
4232  //while (p != NULL)
4233  //{
4234  // qq = p;
4235  // pIter(p);
4236  // qq->next = NULL;
4237  // result = pAdd(result, qq);
4238  //}
4239 #endif
4240  p_Test(result,dst);
4241 #if 0
4242  p_Test(result,dst);
4243  PrintS("result: "); p_Write(result,dst,dst);
4244 #endif
4245  #ifdef HAVE_PLURAL
4246  p_LmDelete(&tmp_mm,dst);
4247  #endif
4248  return result;
4249 }
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:998
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
Definition: numbers.cc:252
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
#define p_GetComp(p, r)
Definition: monomials.h:65
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:578
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:512
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
static FORCE_INLINE number n_Param(const int iParameter, const coeffs r)
return the (iParameter^th) parameter as a NEW number NOTE: parameter numbering: 1....
Definition: coeffs.h:805
#define pIter(p)
Definition: monomials.h:38
static poly p_SortAdd(poly p, const ring r, BOOLEAN revert=FALSE)
Definition: p_polys.h:1156
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:932
poly p_One(const ring r)
Definition: p_polys.cc:1305
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
number ntInit(long i, const coeffs cf)
Definition: transext.cc:705
#define assume(x)
Definition: mod2.h:390
The main handler for Singular numbers which are suitable for Singular polynomials.
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:738
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
#define p_Test(p, r)
Definition: p_polys.h:164
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3723
#define rRing_has_Comp(r)
Definition: monomials.h:267
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
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
Definition: p_polys.h:489
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
Definition: coeffs.h:632
#define NULL
Definition: omList.c:10
Definition: readcf.cc:164
poly n_PermNumber(const number z, const int *par_perm, const int, const ring src, const ring dst)
Definition: p_polys.cc:3924
#define R
Definition: sirandom.c:26
#define pNext(p)
Definition: monomials.h:37
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
#define pSetCoeff0(p, n)
Definition: monomials.h:60
static long p_AddExp(poly p, int v, long ee, ring r)
Definition: p_polys.h:607
#define p_GetCoeff(p, r)
Definition: monomials.h:51
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:868
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:204
int p
Definition: cfModGcd.cc:4019
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1289
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1051
return result
Definition: facAbsBiFact.cc:76

◆ p_PolyDiv()

poly p_PolyDiv ( poly &  p,
const poly  divisor,
const BOOLEAN  needResult,
const ring  r 
)

assumes that p and divisor are univariate polynomials in r, mentioning the same variable; assumes divisor != NULL; p may be NULL; assumes a global monomial ordering in r; performs polynomial division of p by divisor:

  • afterwards p contains the remainder of the division, i.e., p_before = result * divisor + p_afterwards;
  • if needResult == TRUE, then the method computes and returns 'result', otherwise NULL is returned (This parametrization can be used when one is only interested in the remainder of the division. In this case, the method will be slightly faster.) leaves divisor unmodified

Definition at line 1817 of file p_polys.cc.

1818 {
1819  assume(divisor != NULL);
1820  if (p == NULL) return NULL;
1821 
1822  poly result = NULL;
1823  number divisorLC = p_GetCoeff(divisor, r);
1824  int divisorLE = p_GetExp(divisor, 1, r);
1825  while ((p != NULL) && (p_Deg(p, r) >= p_Deg(divisor, r)))
1826  {
1827  /* determine t = LT(p) / LT(divisor) */
1828  poly t = p_ISet(1, r);
1829  number c = n_Div(p_GetCoeff(p, r), divisorLC, r->cf);
1830  n_Normalize(c,r->cf);
1831  p_SetCoeff(t, c, r);
1832  int e = p_GetExp(p, 1, r) - divisorLE;
1833  p_SetExp(t, 1, e, r);
1834  p_Setm(t, r);
1835  if (needResult) result = p_Add_q(result, p_Copy(t, r), r);
1836  p = p_Add_q(p, p_Neg(p_Mult_q(t, p_Copy(divisor, r), r), r), r);
1837  }
1838  return result;
1839 }
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:578
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:579
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define assume(x)
Definition: mod2.h:390
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
Definition: p_polys.h:489
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:615
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
#define p_GetCoeff(p, r)
Definition: monomials.h:51
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1044
int p
Definition: cfModGcd.cc:4019
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1289
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1051
return result
Definition: facAbsBiFact.cc:76

◆ p_Pow()

static poly p_Pow ( poly  p,
int  i,
const ring  r 
)
static

Definition at line 2118 of file p_polys.cc.

2119 {
2120  poly rc = p_Copy(p,r);
2121  i -= 2;
2122  do
2123  {
2124  rc = p_Mult_q(rc,p_Copy(p,r),r);
2125  p_Normalize(rc,r);
2126  i--;
2127  }
2128  while (i != 0);
2129  return p_Mult_q(rc,p,r);
2130 }
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
int i
Definition: cfEzgcd.cc:125
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3723
int p
Definition: cfModGcd.cc:4019
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1051

◆ p_Pow_charp()

static poly p_Pow_charp ( poly  p,
int  i,
const ring  r 
)
static

Definition at line 2132 of file p_polys.cc.

2133 {
2134  //assume char_p == i
2135  poly h=p;
2136  while(h!=NULL) { p_MonPower(h,i,r);pIter(h);}
2137  return p;
2138 }
static poly p_MonPower(poly p, int exp, const ring r)
Definition: p_polys.cc:1947
#define pIter(p)
Definition: monomials.h:38
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972

◆ p_Power()

poly p_Power ( poly  p,
int  i,
const ring  r 
)

Definition at line 2144 of file p_polys.cc.

2145 {
2146  poly rc=NULL;
2147 
2148  if (i==0)
2149  {
2150  p_Delete(&p,r);
2151  return p_One(r);
2152  }
2153 
2154  if(p!=NULL)
2155  {
2156  if ( (i > 0) && ((unsigned long ) i > (r->bitmask)))
2157  {
2158  Werror("exponent %d is too large, max. is %ld",i,r->bitmask);
2159  return NULL;
2160  }
2161  switch (i)
2162  {
2163 // cannot happen, see above
2164 // case 0:
2165 // {
2166 // rc=pOne();
2167 // pDelete(&p);
2168 // break;
2169 // }
2170  case 1:
2171  rc=p;
2172  break;
2173  case 2:
2174  rc=p_Mult_q(p_Copy(p,r),p,r);
2175  break;
2176  default:
2177  if (i < 0)
2178  {
2179  p_Delete(&p,r);
2180  return NULL;
2181  }
2182  else
2183  {
2184 #ifdef HAVE_PLURAL
2185  if (rIsNCRing(r)) /* in the NC case nothing helps :-( */
2186  {
2187  int j=i;
2188  rc = p_Copy(p,r);
2189  while (j>1)
2190  {
2191  rc = p_Mult_q(p_Copy(p,r),rc,r);
2192  j--;
2193  }
2194  p_Delete(&p,r);
2195  return rc;
2196  }
2197 #endif
2198  rc = pNext(p);
2199  if (rc == NULL)
2200  return p_MonPower(p,i,r);
2201  /* else: binom ?*/
2202  int char_p=rChar(r);
2203  if ((char_p>0) && (i>char_p)
2204  && ((rField_is_Zp(r,char_p)
2205  || (rField_is_Zp_a(r,char_p)))))
2206  {
2207  poly h=p_Pow_charp(p_Copy(p,r),char_p,r);
2208  int rest=i-char_p;
2209  while (rest>=char_p)
2210  {
2211  rest-=char_p;
2212  h=p_Mult_q(h,p_Pow_charp(p_Copy(p,r),char_p,r),r);
2213  }
2214  poly res=h;
2215  if (rest>0)
2216  res=p_Mult_q(p_Power(p_Copy(p,r),rest,r),h,r);
2217  p_Delete(&p,r);
2218  return res;
2219  }
2220  if ((pNext(rc) != NULL)
2221  || rField_is_Ring(r)
2222  )
2223  return p_Pow(p,i,r);
2224  if ((char_p==0) || (i<=char_p))
2225  return p_TwoMonPower(p,i,r);
2226  return p_Pow(p,i,r);
2227  }
2228  /*end default:*/
2229  }
2230  }
2231  return rc;
2232 }
static poly p_MonPower(poly p, int exp, const ring r)
Definition: p_polys.cc:1947
int j
Definition: facHensel.cc:105
static BOOLEAN rField_is_Zp_a(const ring r)
Definition: ring.h:520
int rChar(ring r)
Definition: ring.cc:686
static poly p_TwoMonPower(poly p, int exp, const ring r)
Definition: p_polys.cc:2053
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
CanonicalForm res
Definition: facAbsFact.cc:64
poly p_One(const ring r)
Definition: p_polys.cc:1305
int i
Definition: cfEzgcd.cc:125
static poly p_Pow(poly p, int i, const ring r)
Definition: p_polys.cc:2118
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:491
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
static poly p_Pow_charp(poly p, int i, const ring r)
Definition: p_polys.cc:2132
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
static BOOLEAN rIsNCRing(const ring r)
Definition: ring.h:409
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1051
poly p_Power(poly p, int i, const ring r)
Definition: p_polys.cc:2144
void Werror(const char *fmt,...)
Definition: reporter.cc:189

◆ p_ProjectiveUnique()

void p_ProjectiveUnique ( poly  ph,
const ring  r 
)

Definition at line 3080 of file p_polys.cc.

3081 {
3082  if( ph == NULL )
3083  return;
3084 
3085  assume( r != NULL ); assume( r->cf != NULL ); const coeffs C = r->cf;
3086 
3087  number h;
3088  poly p;
3089 
3090  if (rField_is_Ring(r))
3091  {
3092  p_ContentForGB(ph,r);
3093  if(!n_GreaterZero(pGetCoeff(ph),C)) ph = p_Neg(ph,r);
3094  assume( n_GreaterZero(pGetCoeff(ph),C) );
3095  return;
3096  }
3097 
3099  {
3100  assume( n_GreaterZero(pGetCoeff(ph),C) );
3101  if(!n_GreaterZero(pGetCoeff(ph),C)) ph = p_Neg(ph,r);
3102  return;
3103  }
3104  p = ph;
3105 
3106  assume(p != NULL);
3107 
3108  if(pNext(p)==NULL) // a monomial
3109  {
3110  p_SetCoeff(p, n_Init(1, C), r);
3111  return;
3112  }
3113 
3114  assume(pNext(p)!=NULL);
3115 
3116  if(!rField_is_Q(r) && !nCoeff_is_transExt(C))
3117  {
3118  h = p_GetCoeff(p, C);
3119  number hInv = n_Invers(h, C);
3120  pIter(p);
3121  while (p!=NULL)
3122  {
3123  p_SetCoeff(p, n_Mult(p_GetCoeff(p, C), hInv, C), r);
3124  pIter(p);
3125  }
3126  n_Delete(&hInv, C);
3127  p = ph;
3128  p_SetCoeff(p, n_Init(1, C), r);
3129  }
3130 
3131  p_Cleardenom(ph, r); //removes also Content
3132 
3133 
3134  /* normalize ph over a transcendental extension s.t.
3135  lead (ph) is > 0 if extRing->cf == Q
3136  or lead (ph) is monic if extRing->cf == Zp*/
3137  if (nCoeff_is_transExt(C))
3138  {
3139  p= ph;
3140  h= p_GetCoeff (p, C);
3141  fraction f = (fraction) h;
3142  number n=p_GetCoeff (NUM (f),C->extRing->cf);
3143  if (rField_is_Q (C->extRing))
3144  {
3145  if (!n_GreaterZero(n,C->extRing->cf))
3146  {
3147  p=p_Neg (p,r);
3148  }
3149  }
3150  else if (rField_is_Zp(C->extRing))
3151  {
3152  if (!n_IsOne (n, C->extRing->cf))
3153  {
3154  n=n_Invers (n,C->extRing->cf);
3155  nMapFunc nMap;
3156  nMap= n_SetMap (C->extRing->cf, C);
3157  number ninv= nMap (n,C->extRing->cf, C);
3158  p=__p_Mult_nn (p, ninv, r);
3159  n_Delete (&ninv, C);
3160  n_Delete (&n, C->extRing->cf);
3161  }
3162  }
3163  p= ph;
3164  }
3165 
3166  return;
3167 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
void p_ContentForGB(poly ph, const ring r)
Definition: p_polys.cc:2283
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
#define pIter(p)
Definition: monomials.h:38
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
The main handler for Singular numbers which are suitable for Singular polynomials.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible
Definition: coeffs.h:564
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:940
FILE * f
Definition: checklibs.c:9
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:497
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:721
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:491
#define __p_Mult_nn(p, n, r)
Definition: p_polys.h:928
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
Definition: readcf.cc:164
#define pNext(p)
Definition: monomials.h:37
#define p_GetCoeff(p, r)
Definition: monomials.h:51
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1044
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition: coeffs.h:494
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2782

◆ p_Read()

const char* p_Read ( const char *  st,
poly &  rc,
const ring  r 
)

Definition at line 1340 of file p_polys.cc.

1341 {
1342  if (r==NULL) { rc=NULL;return st;}
1343  int i,j;
1344  rc = p_Init(r);
1345  const char *s = n_Read(st,&(p_GetCoeff(rc, r)),r->cf);
1346  if (s==st)
1347  /* i.e. it does not start with a coeff: test if it is a ringvar*/
1348  {
1349  j = r_IsRingVar(s,r->names,r->N);
1350  if (j >= 0)
1351  {
1352  p_IncrExp(rc,1+j,r);
1353  while (*s!='\0') s++;
1354  goto done;
1355  }
1356  }
1357  while (*s!='\0')
1358  {
1359  char ss[2];
1360  ss[0] = *s++;
1361  ss[1] = '\0';
1362  j = r_IsRingVar(ss,r->names,r->N);
1363  if (j >= 0)
1364  {
1365  const char *s_save=s;
1366  s = eati(s,&i);
1367  if (((unsigned long)i) > r->bitmask/2)
1368  {
1369  // exponent to large: it is not a monomial
1370  p_LmDelete(&rc,r);
1371  return s_save;
1372  }
1373  p_AddExp(rc,1+j, (long)i, r);
1374  }
1375  else
1376  {
1377  // 1st char of is not a varname
1378  // We return the parsed polynomial nevertheless. This is needed when
1379  // we are parsing coefficients in a rational function field.
1380  s--;
1381  break;
1382  }
1383  }
1384 done:
1385  if (n_IsZero(pGetCoeff(rc),r->cf)) p_LmDelete(&rc,r);
1386  else
1387  {
1388 #ifdef HAVE_PLURAL
1389  // in super-commutative ring
1390  // squares of anti-commutative variables are zeroes!
1391  if(rIsSCA(r))
1392  {
1393  const unsigned int iFirstAltVar = scaFirstAltVar(r);
1394  const unsigned int iLastAltVar = scaLastAltVar(r);
1395 
1396  assume(rc != NULL);
1397 
1398  for(unsigned int k = iFirstAltVar; k <= iLastAltVar; k++)
1399  if( p_GetExp(rc, k, r) > 1 )
1400  {
1401  p_LmDelete(&rc, r);
1402  goto finish;
1403  }
1404  }
1405 #endif
1406 
1407  p_Setm(rc,r);
1408  }
1409 finish:
1410  return s;
1411 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const char * eati(const char *s, int *i)
Definition: reporter.cc:373
int j
Definition: facHensel.cc:105
static FORCE_INLINE const char * n_Read(const char *s, number *a, const coeffs r)
!!! Recommendation: This method is too cryptic to be part of the user- !!! interface....
Definition: coeffs.h:598
static long p_IncrExp(poly p, int v, ring r)
Definition: p_polys.h:592
int k
Definition: cfEzgcd.cc:92
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
int r_IsRingVar(const char *n, char **names, int N)
Definition: ring.cc:213
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define NULL
Definition: omList.c:10
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:190
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
static long p_AddExp(poly p, int v, long ee, ring r)
Definition: p_polys.h:607
#define p_GetCoeff(p, r)
Definition: monomials.h:51
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257

◆ p_Series()

poly p_Series ( int  n,
poly  p,
poly  u,
intvec w,
const ring  R 
)

Definition at line 4396 of file p_polys.cc.

4397 {
4398  short *ww=iv2array(w,R);
4399  if(p!=NULL)
4400  {
4401  if(u==NULL)
4402  p=p_JetW(p,n,ww,R);
4403  else
4404  p=p_JetW(p_Mult_q(p,p_Invers(n-p_MinDeg(p,w,R),u,w,R),R),n,ww,R);
4405  }
4406  omFreeSize((ADDRESS)ww,(rVar(R)+1)*sizeof(short));
4407  return p;
4408 }
short * iv2array(intvec *iv, const ring R)
Definition: weight.cc:206
int p_MinDeg(poly p, intvec *w, const ring R)
Definition: p_polys.cc:4346
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
void * ADDRESS
Definition: auxiliary.h:133
poly p_JetW(poly p, int m, short *w, const ring R)
Definition: p_polys.cc:4328
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
const CanonicalForm & w
Definition: facAbsFact.cc:55
static poly p_Invers(int n, poly u, intvec *w, const ring R)
Definition: p_polys.cc:4367
int p
Definition: cfModGcd.cc:4019
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1051

◆ p_Setm_Dummy()

void p_Setm_Dummy ( poly  p,
const ring  r 
)

Definition at line 533 of file p_polys.cc.

534 {
535  p_LmCheckPolyRing(p, r);
536 }
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:120
int p
Definition: cfModGcd.cc:4019

◆ p_Setm_General()

void p_Setm_General ( poly  p,
const ring  r 
)

!!!????? where?????

Definition at line 154 of file p_polys.cc.

155 {
156  p_LmCheckPolyRing(p, r);
157  int pos=0;
158  if (r->typ!=NULL)
159  {
160  loop
161  {
162  unsigned long ord=0;
163  sro_ord* o=&(r->typ[pos]);
164  switch(o->ord_typ)
165  {
166  case ro_dp:
167  {
168  int a,e;
169  a=o->data.dp.start;
170  e=o->data.dp.end;
171  for(int i=a;i<=e;i++) ord+=p_GetExp(p,i,r);
172  p->exp[o->data.dp.place]=ord;
173  break;
174  }
175  case ro_wp_neg:
177  // no break;
178  case ro_wp:
179  {
180  int a,e;
181  a=o->data.wp.start;
182  e=o->data.wp.end;
183  int *w=o->data.wp.weights;
184 #if 1
185  for(int i=a;i<=e;i++) ord+=((unsigned long)p_GetExp(p,i,r))*((unsigned long)w[i-a]);
186 #else
187  long ai;
188  int ei,wi;
189  for(int i=a;i<=e;i++)
190  {
191  ei=p_GetExp(p,i,r);
192  wi=w[i-a];
193  ai=ei*wi;
194  if (ai/ei!=wi) pSetm_error=TRUE;
195  ord+=ai;
196  if (ord<ai) pSetm_error=TRUE;
197  }
198 #endif
199  p->exp[o->data.wp.place]=ord;
200  break;
201  }
202  case ro_am:
203  {
204  ord = POLY_NEGWEIGHT_OFFSET;
205  const short a=o->data.am.start;
206  const short e=o->data.am.end;
207  const int * w=o->data.am.weights;
208 #if 1
209  for(short i=a; i<=e; i++, w++)
210  ord += ((*w) * p_GetExp(p,i,r));
211 #else
212  long ai;
213  int ei,wi;
214  for(short i=a;i<=e;i++)
215  {
216  ei=p_GetExp(p,i,r);
217  wi=w[i-a];
218  ai=ei*wi;
219  if (ai/ei!=wi) pSetm_error=TRUE;
220  ord += ai;
221  if (ord<ai) pSetm_error=TRUE;
222  }
223 #endif
224  const int c = p_GetComp(p,r);
225 
226  const short len_gen= o->data.am.len_gen;
227 
228  if ((c > 0) && (c <= len_gen))
229  {
230  assume( w == o->data.am.weights_m );
231  assume( w[0] == len_gen );
232  ord += w[c];
233  }
234 
235  p->exp[o->data.am.place] = ord;
236  break;
237  }
238  case ro_wp64:
239  {
240  int64 ord=0;
241  int a,e;
242  a=o->data.wp64.start;
243  e=o->data.wp64.end;
244  int64 *w=o->data.wp64.weights64;
245  int64 ei,wi,ai;
246  for(int i=a;i<=e;i++)
247  {
248  //Print("exp %d w %d \n",p_GetExp(p,i,r),(int)w[i-a]);
249  //ord+=((int64)p_GetExp(p,i,r))*w[i-a];
250  ei=(int64)p_GetExp(p,i,r);
251  wi=w[i-a];
252  ai=ei*wi;
253  if(ei!=0 && ai/ei!=wi)
254  {
256  #if SIZEOF_LONG == 4
257  Print("ai %lld, wi %lld\n",ai,wi);
258  #else
259  Print("ai %ld, wi %ld\n",ai,wi);
260  #endif
261  }
262  ord+=ai;
263  if (ord<ai)
264  {
266  #if SIZEOF_LONG == 4
267  Print("ai %lld, ord %lld\n",ai,ord);
268  #else
269  Print("ai %ld, ord %ld\n",ai,ord);
270  #endif
271  }
272  }
273  int64 mask=(int64)0x7fffffff;
274  long a_0=(long)(ord&mask); //2^31
275  long a_1=(long)(ord >>31 ); /*(ord/(mask+1));*/
276 
277  //Print("mask: %x, ord: %d, a_0: %d, a_1: %d\n"
278  //,(int)mask,(int)ord,(int)a_0,(int)a_1);
279  //Print("mask: %d",mask);
280 
281  p->exp[o->data.wp64.place]=a_1;
282  p->exp[o->data.wp64.place+1]=a_0;
283 // if(p_Setm_error) PrintS("***************************\n"
284 // "***************************\n"
285 // "**WARNING: overflow error**\n"
286 // "***************************\n"
287 // "***************************\n");
288  break;
289  }
290  case ro_cp:
291  {
292  int a,e;
293  a=o->data.cp.start;
294  e=o->data.cp.end;
295  int pl=o->data.cp.place;
296  for(int i=a;i<=e;i++) { p->exp[pl]=p_GetExp(p,i,r); pl++; }
297  break;
298  }
299  case ro_syzcomp:
300  {
301  long c=__p_GetComp(p,r);
302  long sc = c;
303  int* Components = (_componentsExternal ? _components :
304  o->data.syzcomp.Components);
305  long* ShiftedComponents = (_componentsExternal ? _componentsShifted:
306  o->data.syzcomp.ShiftedComponents);
307  if (ShiftedComponents != NULL)
308  {
309  assume(Components != NULL);
310  assume(c == 0 || Components[c] != 0);
311  sc = ShiftedComponents[Components[c]];
312  assume(c == 0 || sc != 0);
313  }
314  p->exp[o->data.syzcomp.place]=sc;
315  break;
316  }
317  case ro_syz:
318  {
319  const unsigned long c = __p_GetComp(p, r);
320  const short place = o->data.syz.place;
321  const int limit = o->data.syz.limit;
322 
323  if (c > (unsigned long)limit)
324  p->exp[place] = o->data.syz.curr_index;
325  else if (c > 0)
326  {
327  assume( (1 <= c) && (c <= (unsigned long)limit) );
328  p->exp[place]= o->data.syz.syz_index[c];
329  }
330  else
331  {
332  assume(c == 0);
333  p->exp[place]= 0;
334  }
335  break;
336  }
337  // Prefix for Induced Schreyer ordering
338  case ro_isTemp: // Do nothing?? (to be removed into suffix later on...?)
339  {
340  assume(p != NULL);
341 
342 #ifndef SING_NDEBUG
343 #if MYTEST
344  Print("p_Setm_General: ro_isTemp ord: pos: %d, p: ", pos); p_wrp(p, r);
345 #endif
346 #endif
347  int c = p_GetComp(p, r);
348 
349  assume( c >= 0 );
350 
351  // Let's simulate case ro_syz above....
352  // Should accumulate (by Suffix) and be a level indicator
353  const int* const pVarOffset = o->data.isTemp.pVarOffset;
354 
355  assume( pVarOffset != NULL );
356 
357  // TODO: Can this be done in the suffix???
358  for( int i = 1; i <= r->N; i++ ) // No v[0] here!!!
359  {
360  const int vo = pVarOffset[i];
361  if( vo != -1) // TODO: optimize: can be done once!
362  {
363  // Hans! Please don't break it again! p_SetExp(p, ..., r, vo) is correct:
364  p_SetExp(p, p_GetExp(p, i, r), r, vo); // copy put them verbatim
365  // Hans! Please don't break it again! p_GetExp(p, r, vo) is correct:
366  assume( p_GetExp(p, r, vo) == p_GetExp(p, i, r) ); // copy put them verbatim
367  }
368  }
369 #ifndef SING_NDEBUG
370  for( int i = 1; i <= r->N; i++ ) // No v[0] here!!!
371  {
372  const int vo = pVarOffset[i];
373  if( vo != -1) // TODO: optimize: can be done once!
374  {
375  // Hans! Please don't break it again! p_GetExp(p, r, vo) is correct:
376  assume( p_GetExp(p, r, vo) == p_GetExp(p, i, r) ); // copy put them verbatim
377  }
378  }
379 #if MYTEST
380 // if( p->exp[o->data.isTemp.start] > 0 )
381  PrintS("after Values: "); p_wrp(p, r);
382 #endif
383 #endif
384  break;
385  }
386 
387  // Suffix for Induced Schreyer ordering
388  case ro_is:
389  {
390 #ifndef SING_NDEBUG
391 #if MYTEST
392  Print("p_Setm_General: ro_is ord: pos: %d, p: ", pos); p_wrp(p, r);
393 #endif
394 #endif
395 
396  assume(p != NULL);
397 
398  int c = p_GetComp(p, r);
399 
400  assume( c >= 0 );
401  const ideal F = o->data.is.F;
402  const int limit = o->data.is.limit;
403  assume( limit >= 0 );
404  const int start = o->data.is.start;
405 
406  if( F != NULL && c > limit )
407  {
408 #ifndef SING_NDEBUG
409 #if MYTEST
410  Print("p_Setm_General: ro_is : in rSetm: pos: %d, c: %d > limit: %d\n", c, pos, limit);
411  PrintS("preComputed Values: ");
412  p_wrp(p, r);
413 #endif
414 #endif
415 // if( c > limit ) // BUG???
416  p->exp[start] = 1;
417 // else
418 // p->exp[start] = 0;
419 
420 
421  c -= limit;
422  assume( c > 0 );
423  c--;
424 
425  if( c >= IDELEMS(F) )
426  break;
427 
428  assume( c < IDELEMS(F) ); // What about others???
429 
430  const poly pp = F->m[c]; // get reference monomial!!!
431 
432  if(pp == NULL)
433  break;
434 
435  assume(pp != NULL);
436 
437 #ifndef SING_NDEBUG
438 #if MYTEST
439  Print("Respective F[c - %d: %d] pp: ", limit, c);
440  p_wrp(pp, r);
441 #endif
442 #endif
443 
444  const int end = o->data.is.end;
445  assume(start <= end);
446 
447 
448 // const int st = o->data.isTemp.start;
449 
450 #ifndef SING_NDEBUG
451 #if MYTEST
452  Print("p_Setm_General: is(-Temp-) :: c: %d, limit: %d, [st:%d] ===>>> %ld\n", c, limit, start, p->exp[start]);
453 #endif
454 #endif
455 
456  // p_ExpVectorAdd(p, pp, r);
457 
458  for( int i = start; i <= end; i++) // v[0] may be here...
459  p->exp[i] += pp->exp[i]; // !!!!!!!! ADD corresponding LT(F)
460 
461  // p_MemAddAdjust(p, ri);
462  if (r->NegWeightL_Offset != NULL)
463  {
464  for (int i=r->NegWeightL_Size-1; i>=0; i--)
465  {
466  const int _i = r->NegWeightL_Offset[i];
467  if( start <= _i && _i <= end )
468  p->exp[_i] -= POLY_NEGWEIGHT_OFFSET;
469  }
470  }
471 
472 
473 #ifndef SING_NDEBUG
474  const int* const pVarOffset = o->data.is.pVarOffset;
475 
476  assume( pVarOffset != NULL );
477 
478  for( int i = 1; i <= r->N; i++ ) // No v[0] here!!!
479  {
480  const int vo = pVarOffset[i];
481  if( vo != -1) // TODO: optimize: can be done once!
482  // Hans! Please don't break it again! p_GetExp(p/pp, r, vo) is correct:
483  assume( p_GetExp(p, r, vo) == (p_GetExp(p, i, r) + p_GetExp(pp, r, vo)) );
484  }
485  // TODO: how to check this for computed values???
486 #if MYTEST
487  PrintS("Computed Values: "); p_wrp(p, r);
488 #endif
489 #endif
490  } else
491  {
492  p->exp[start] = 0; //!!!!????? where?????
493 
494  const int* const pVarOffset = o->data.is.pVarOffset;
495 
496  // What about v[0] - component: it will be added later by
497  // suffix!!!
498  // TODO: Test it!
499  const int vo = pVarOffset[0];
500  if( vo != -1 )
501  p->exp[vo] = c; // initial component v[0]!
502 
503 #ifndef SING_NDEBUG
504 #if MYTEST
505  Print("ELSE p_Setm_General: ro_is :: c: %d <= limit: %d, vo: %d, exp: %d\n", c, limit, vo, p->exp[vo]);
506  p_wrp(p, r);
507 #endif
508 #endif
509  }
510 
511  break;
512  }
513  default:
514  dReportError("wrong ord in rSetm:%d\n",o->ord_typ);
515  return;
516  }
517  pos++;
518  if (pos == r->OrdSize) return;
519  }
520  }
521 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
Definition: ring.h:61
#define POLY_NEGWEIGHT_OFFSET
Definition: monomials.h:237
#define Print
Definition: emacs.cc:80
Definition: ring.h:54
static int _componentsExternal
Definition: p_polys.cc:144
#define p_GetComp(p, r)
Definition: monomials.h:65
long int64
Definition: auxiliary.h:66
#define TRUE
Definition: auxiliary.h:98
#define loop
Definition: structs.h:78
Definition: ring.h:59
Definition: ring.h:57
union sro_ord::@0 data
ro_typ ord_typ
Definition: ring.h:221
if(yy_init)
Definition: libparse.cc:1418
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define assume(x)
Definition: mod2.h:390
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
Definition: ring.h:219
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN pSetm_error
Definition: p_polys.cc:146
#define IDELEMS(i)
Definition: simpleideals.h:24
Definition: ring.h:62
Definition: ring.h:62
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
Definition: p_polys.h:489
#define NULL
Definition: omList.c:10
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:120
static int * _components
Definition: p_polys.cc:142
const CanonicalForm & w
Definition: facAbsFact.cc:55
Definition: ring.h:56
Definition: ring.h:53
Definition: ring.h:55
int dReportError(const char *fmt,...)
Definition: dError.cc:45
static long * _componentsShifted
Definition: p_polys.cc:143
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
int p
Definition: cfModGcd.cc:4019

◆ p_Setm_Syz()

void p_Setm_Syz ( poly  p,
ring  r,
int *  Components,
long *  ShiftedComponents 
)

Definition at line 523 of file p_polys.cc.

524 {
525  _components = Components;
526  _componentsShifted = ShiftedComponents;
528  p_Setm_General(p, r);
530 }
void p_Setm_General(poly p, const ring r)
Definition: p_polys.cc:154
static int _componentsExternal
Definition: p_polys.cc:144
static int * _components
Definition: p_polys.cc:142
static long * _componentsShifted
Definition: p_polys.cc:143
int p
Definition: cfModGcd.cc:4019

◆ p_Setm_TotalDegree()

void p_Setm_TotalDegree ( poly  p,
const ring  r 
)

Definition at line 539 of file p_polys.cc.

540 {
541  p_LmCheckPolyRing(p, r);
542  p->exp[r->pOrdIndex] = p_Totaldegree(p, r);
543 }
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1444
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:120
int p
Definition: cfModGcd.cc:4019

◆ p_Setm_WFirstTotalDegree()

void p_Setm_WFirstTotalDegree ( poly  p,
const ring  r 
)

Definition at line 546 of file p_polys.cc.

547 {
548  p_LmCheckPolyRing(p, r);
549  p->exp[r->pOrdIndex] = p_WFirstTotalDegree(p, r);
550 }
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:588
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:120
int p
Definition: cfModGcd.cc:4019

◆ p_SetModDeg()

void p_SetModDeg ( intvec w,
ring  r 
)

Definition at line 3624 of file p_polys.cc.

3625 {
3626  if (w!=NULL)
3627  {
3628  r->pModW = w;
3629  pOldFDeg = r->pFDeg;
3630  pOldLDeg = r->pLDeg;
3631  pOldLexOrder = r->pLexOrder;
3632  pSetDegProcs(r,pModDeg);
3633  r->pLexOrder = TRUE;
3634  }
3635  else
3636  {
3637  r->pModW = NULL;
3639  r->pLexOrder = pOldLexOrder;
3640  }
3641 }
static BOOLEAN pOldLexOrder
Definition: p_polys.cc:3613
static long pModDeg(poly p, ring r)
Definition: p_polys.cc:3615
#define TRUE
Definition: auxiliary.h:98
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3588
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3600
static pLDegProc pOldLDeg
Definition: p_polys.cc:3612
#define NULL
Definition: omList.c:10
static pFDegProc pOldFDeg
Definition: p_polys.cc:3611
const CanonicalForm & w
Definition: facAbsFact.cc:55

◆ p_Shift()

void p_Shift ( poly *  p,
int  i,
const ring  r 
)

shifts components of the vector p by i

Definition at line 4604 of file p_polys.cc.

4605 {
4606  poly qp1 = *p,qp2 = *p;/*working pointers*/
4607  int j = p_MaxComp(*p,r),k = p_MinComp(*p,r);
4608 
4609  if (j+i < 0) return ;
4610  BOOLEAN toPoly= ((j == -i) && (j == k));
4611  while (qp1 != NULL)
4612  {
4613  if (toPoly || (__p_GetComp(qp1,r)+i > 0))
4614  {
4615  p_AddComp(qp1,i,r);
4616  p_SetmComp(qp1,r);
4617  qp2 = qp1;
4618  pIter(qp1);
4619  }
4620  else
4621  {
4622  if (qp2 == *p)
4623  {
4624  pIter(*p);
4625  p_LmDelete(&qp2,r);
4626  qp2 = *p;
4627  qp1 = *p;
4628  }
4629  else
4630  {
4631  qp2->next = qp1->next;
4632  if (qp1!=NULL) p_LmDelete(&qp1,r);
4633  qp1 = qp2->next;
4634  }
4635  }
4636  }
4637 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
static unsigned long p_AddComp(poly p, unsigned long v, ring r)
Definition: p_polys.h:448
int j
Definition: facHensel.cc:105
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:38
int i
Definition: cfEzgcd.cc:125
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:314
#define p_SetmComp
Definition: p_polys.h:245
#define NULL
Definition: omList.c:10
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:293
return
Definition: cfGcdAlgExt.cc:218

◆ p_SimpleContent()

void p_SimpleContent ( poly  ph,
int  smax,
const ring  r 
)

Definition at line 2492 of file p_polys.cc.

2493 {
2494  if(TEST_OPT_CONTENTSB) return;
2495  if (ph==NULL) return;
2496  if (pNext(ph)==NULL)
2497  {
2498  p_SetCoeff(ph,n_Init(1,r->cf),r);
2499  return;
2500  }
2501  if ((pNext(pNext(ph))==NULL)||(!rField_is_Q(r)))
2502  {
2503  return;
2504  }
2505  number d=p_InitContent(ph,r);
2506  if (n_Size(d,r->cf)<=smax)
2507  {
2508  //if (TEST_OPT_PROT) PrintS("G");
2509  return;
2510  }
2511 
2512  poly p=ph;
2513  number h=d;
2514  if (smax==1) smax=2;
2515  while (p!=NULL)
2516  {
2517 #if 0
2518  d=n_Gcd(h,pGetCoeff(p),r->cf);
2519  n_Delete(&h,r->cf);
2520  h = d;
2521 #else
2522  STATISTIC(n_Gcd); nlInpGcd(h,pGetCoeff(p),r->cf);
2523 #endif
2524  if(n_Size(h,r->cf)<smax)
2525  {
2526  //if (TEST_OPT_PROT) PrintS("g");
2527  return;
2528  }
2529  pIter(p);
2530  }
2531  p = ph;
2532  if (!n_GreaterZero(pGetCoeff(p),r->cf)) h=n_InpNeg(h,r->cf);
2533  if(n_IsOne(h,r->cf)) return;
2534  //if (TEST_OPT_PROT) PrintS("c");
2535  while (p!=NULL)
2536  {
2537 #if 1
2538  d = n_ExactDiv(pGetCoeff(p),h,r->cf);
2539  p_SetCoeff(p,d,r);
2540 #else
2541  STATISTIC(n_ExactDiv); nlInpExactDiv(pGetCoeff(p),h,r->cf); // no such function... ?
2542 #endif
2543  pIter(p);
2544  }
2545  n_Delete(&h,r->cf);
2546 }
#define STATISTIC(f)
Definition: numstats.h:16
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
Definition: coeffs.h:686
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#define TEST_OPT_CONTENTSB
Definition: options.h:125
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
void nlInpGcd(number &a, number b, const coeffs r)
Definition: longrat.cc:2777
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
#define pIter(p)
Definition: monomials.h:38
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)
Definition: coeffs.h:557
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:497
number p_InitContent(poly ph, const ring r)
Definition: p_polys.cc:2549
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
static FORCE_INLINE number n_ExactDiv(number a, number b, const coeffs r)
assume that there is a canonical subring in cf and we know that division is possible for these a and ...
Definition: coeffs.h:622
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition: coeffs.h:494
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
static FORCE_INLINE int n_Size(number n, const coeffs r)
return a non-negative measure for the complexity of n; return 0 only when n represents zero; (used fo...
Definition: coeffs.h:570

◆ p_Size()

int p_Size ( poly  p,
const ring  r 
)

Definition at line 3191 of file p_polys.cc.

3192 {
3193  int count = 0;
3194  if (r->cf->has_simple_Alloc)
3195  return pLength(p);
3196  while ( p != NULL )
3197  {
3198  count+= n_Size( pGetCoeff( p ), r->cf );
3199  pIter( p );
3200  }
3201  return count;
3202 }
int status int void size_t count
Definition: si_signals.h:59
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define pIter(p)
Definition: monomials.h:38
static unsigned pLength(poly a)
Definition: p_polys.h:193
#define NULL
Definition: omList.c:10
int p
Definition: cfModGcd.cc:4019
static FORCE_INLINE int n_Size(number n, const coeffs r)
return a non-negative measure for the complexity of n; return 0 only when n represents zero; (used fo...
Definition: coeffs.h:570

◆ p_Split()

void p_Split ( poly  p,
poly *  h 
)

Definition at line 1312 of file p_polys.cc.

1313 {
1314  *h=pNext(p);
1315  pNext(p)=NULL;
1316 }
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972

◆ p_SplitAndReversePoly()

static void p_SplitAndReversePoly ( poly  p,
int  n,
poly *  non_zero,
poly *  zero,
const ring  r 
)
static

Definition at line 3736 of file p_polys.cc.

3737 {
3738  if (p == NULL)
3739  {
3740  *non_zero = NULL;
3741  *zero = NULL;
3742  return;
3743  }
3744  spolyrec sz;
3745  poly z, n_z, next;
3746  z = &sz;
3747  n_z = NULL;
3748 
3749  while(p != NULL)
3750  {
3751  next = pNext(p);
3752  if (p_GetExp(p, n,r) == 0)
3753  {
3754  pNext(z) = p;
3755  pIter(z);
3756  }
3757  else
3758  {
3759  pNext(p) = n_z;
3760  n_z = p;
3761  }
3762  p = next;
3763  }
3764  pNext(z) = NULL;
3765  *zero = pNext(&sz);
3766  *non_zero = n_z;
3767 }
#define pIter(p)
Definition: monomials.h:38
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
ListNode * next
Definition: janet.h:31

◆ p_Sub()

poly p_Sub ( poly  p1,
poly  p2,
const ring  r 
)

Definition at line 1937 of file p_polys.cc.

1938 {
1939  return p_Add_q(p1, p_Neg(p2,r),r);
1940 }
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1044
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893

◆ p_Subst()

poly p_Subst ( poly  p,
int  n,
poly  e,
const ring  r 
)

Definition at line 3865 of file p_polys.cc.

3866 {
3867  if (e == NULL) return p_Subst0(p, n,r);
3868 
3869  if (p_IsConstant(e,r))
3870  {
3871  if (n_IsOne(pGetCoeff(e),r->cf)) return p_Subst1(p,n,r);
3872  else return p_Subst2(p, n, pGetCoeff(e),r);
3873  }
3874 
3875 #ifdef HAVE_PLURAL
3876  if (rIsPluralRing(r))
3877  {
3878  return nc_pSubst(p,n,e,r);
3879  }
3880 #endif
3881 
3882  int exponent,i;
3883  poly h, res, m;
3884  int *me,*ee;
3885  number nu,nu1;
3886 
3887  me=(int *)omAlloc((rVar(r)+1)*sizeof(int));
3888  ee=(int *)omAlloc((rVar(r)+1)*sizeof(int));
3889  if (e!=NULL) p_GetExpV(e,ee,r);
3890  res=NULL;
3891  h=p;
3892  while (h!=NULL)
3893  {
3894  if ((e!=NULL) || (p_GetExp(h,n,r)==0))
3895  {
3896  m=p_Head(h,r);
3897  p_GetExpV(m,me,r);
3898  exponent=me[n];
3899  me[n]=0;
3900  for(i=rVar(r);i>0;i--)
3901  me[i]+=exponent*ee[i];
3902  p_SetExpV(m,me,r);
3903  if (e!=NULL)
3904  {
3905  n_Power(pGetCoeff(e),exponent,&nu,r->cf);
3906  nu1=n_Mult(pGetCoeff(m),nu,r->cf);
3907  n_Delete(&nu,r->cf);
3908  p_SetCoeff(m,nu1,r);
3909  }
3910  res=p_Add_q(res,m,r);
3911  }
3912  p_LmDelete(&h,r);
3913  }
3914  omFreeSize((ADDRESS)me,(rVar(r)+1)*sizeof(int));
3915  omFreeSize((ADDRESS)ee,(rVar(r)+1)*sizeof(int));
3916  return res;
3917 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1457
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static poly p_Subst1(poly p, int n, const ring r)
Definition: p_polys.cc:3772
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
void * ADDRESS
Definition: auxiliary.h:133
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define omAlloc(size)
Definition: omAllocDecl.h:210
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1472
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:826
CanonicalForm res
Definition: facAbsFact.cc:64
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1929
static poly p_Subst0(poly p, int n, const ring r)
Definition: p_polys.cc:3840
int m
Definition: cfEzgcd.cc:121
int i
Definition: cfEzgcd.cc:125
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
Definition: coeffs.h:632
#define NULL
Definition: omList.c:10
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
static poly p_Subst2(poly p, int n, number e, const ring r)
Definition: p_polys.cc:3799
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
poly nc_pSubst(poly p, int n, poly e, const ring r)
substitute the n-th variable by e in p destroy p e is not a constant
Definition: old.gring.cc:3229
int p
Definition: cfModGcd.cc:4019
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893
static Poly * h
Definition: janet.cc:972

◆ p_Subst0()

static poly p_Subst0 ( poly  p,
int  n,
const ring  r 
)
static

Definition at line 3840 of file p_polys.cc.

3841 {
3842  spolyrec res;
3843  poly h = &res;
3844  pNext(h) = p;
3845 
3846  while (pNext(h)!=NULL)
3847  {
3848  if (p_GetExp(pNext(h),n,r)!=0)
3849  {
3850  p_LmDelete(&pNext(h),r);
3851  }
3852  else
3853  {
3854  pIter(h);
3855  }
3856  }
3857  p_Test(pNext(&res),r);
3858  return pNext(&res);
3859 }
#define pIter(p)
Definition: monomials.h:38
CanonicalForm res
Definition: facAbsFact.cc:64
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define p_Test(p, r)
Definition: p_polys.h:164
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972

◆ p_Subst1()

static poly p_Subst1 ( poly  p,
int  n,
const ring  r 
)
static

Definition at line 3772 of file p_polys.cc.

3773 {
3774  poly qq=NULL, result = NULL;
3775  poly zero=NULL, non_zero=NULL;
3776 
3777  // reverse, so that add is likely to be linear
3778  p_SplitAndReversePoly(p, n, &non_zero, &zero,r);
3779 
3780  while (non_zero != NULL)
3781  {
3782  assume(p_GetExp(non_zero, n,r) != 0);
3783  qq = non_zero;
3784  pIter(non_zero);
3785  qq->next = NULL;
3786  p_SetExp(qq,n,0,r);
3787  p_Setm(qq,r);
3788  result = p_Add_q(result,qq,r);
3789  }
3790  p = p_Add_q(result, zero,r);
3791  p_Test(p,r);
3792  return p;
3793 }
#define pIter(p)
Definition: monomials.h:38
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define assume(x)
Definition: mod2.h:390
#define p_Test(p, r)
Definition: p_polys.h:164
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
Definition: p_polys.h:489
#define NULL
Definition: omList.c:10
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
int p
Definition: cfModGcd.cc:4019
static void p_SplitAndReversePoly(poly p, int n, poly *non_zero, poly *zero, const ring r)
Definition: p_polys.cc:3736
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893
return result
Definition: facAbsBiFact.cc:76

◆ p_Subst2()

static poly p_Subst2 ( poly  p,
int  n,
number  e,
const ring  r 
)
static

Definition at line 3799 of file p_polys.cc.

3800 {
3801  assume( ! n_IsZero(e,r->cf) );
3802  poly qq,result = NULL;
3803  number nn, nm;
3804  poly zero, non_zero;
3805 
3806  // reverse, so that add is likely to be linear
3807  p_SplitAndReversePoly(p, n, &non_zero, &zero,r);
3808 
3809  while (non_zero != NULL)
3810  {
3811  assume(p_GetExp(non_zero, n, r) != 0);
3812  qq = non_zero;
3813  pIter(non_zero);
3814  qq->next = NULL;
3815  n_Power(e, p_GetExp(qq, n, r), &nn,r->cf);
3816  nm = n_Mult(nn, pGetCoeff(qq),r->cf);
3817 #ifdef HAVE_RINGS
3818  if (n_IsZero(nm,r->cf))
3819  {
3820  p_LmFree(&qq,r);
3821  n_Delete(&nm,r->cf);
3822  }
3823  else
3824 #endif
3825  {
3826  p_SetCoeff(qq, nm,r);
3827  p_SetExp(qq, n, 0,r);
3828  p_Setm(qq,r);
3829  result = p_Add_q(result,qq,r);
3830  }
3831  n_Delete(&nn,r->cf);
3832  }
3833  p = p_Add_q(result, zero,r);
3834  p_Test(p,r);
3835  return p;
3836 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
static void p_LmFree(poly p, ring)
Definition: p_polys.h:684
#define pIter(p)
Definition: monomials.h:38
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
#define p_Test(p, r)
Definition: p_polys.h:164
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
Definition: p_polys.h:489
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
Definition: coeffs.h:632
#define NULL
Definition: omList.c:10
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
int p
Definition: cfModGcd.cc:4019
static void p_SplitAndReversePoly(poly p, int n, poly *non_zero, poly *zero, const ring r)
Definition: p_polys.cc:3736
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893
return result
Definition: facAbsBiFact.cc:76

◆ p_TakeOutComp() [1/2]

poly p_TakeOutComp ( poly *  p,
int  k,
const ring  r 
)

Definition at line 3385 of file p_polys.cc.

3386 {
3387  poly q = *p,qq=NULL,result = NULL;
3388 
3389  if (q==NULL) return NULL;
3390  BOOLEAN use_setmcomp=rOrd_SetCompRequiresSetm(r);
3391  if (__p_GetComp(q,r)==k)
3392  {
3393  result = q;
3394  do
3395  {
3396  p_SetComp(q,0,r);
3397  if (use_setmcomp) p_SetmComp(q,r);
3398  qq = q;
3399  pIter(q);
3400  }
3401  while ((q!=NULL) && (__p_GetComp(q,r)==k));
3402  *p = q;
3403  pNext(qq) = NULL;
3404  }
3405  if (q==NULL) return result;
3406  if (__p_GetComp(q,r) > k)
3407  {
3408  p_SubComp(q,1,r);
3409  if (use_setmcomp) p_SetmComp(q,r);
3410  }
3411  poly pNext_q;
3412  while ((pNext_q=pNext(q))!=NULL)
3413  {
3414  if (__p_GetComp(pNext_q,r)==k)
3415  {
3416  if (result==NULL)
3417  {
3418  result = pNext_q;
3419  qq = result;
3420  }
3421  else
3422  {
3423  pNext(qq) = pNext_q;
3424  pIter(qq);
3425  }
3426  pNext(q) = pNext(pNext_q);
3427  pNext(qq) =NULL;
3428  p_SetComp(qq,0,r);
3429  if (use_setmcomp) p_SetmComp(qq,r);
3430  }
3431  else
3432  {
3433  /*pIter(q);*/ q=pNext_q;
3434  if (__p_GetComp(q,r) > k)
3435  {
3436  p_SubComp(q,1,r);
3437  if (use_setmcomp) p_SetmComp(q,r);
3438  }
3439  }
3440  }
3441  return result;
3442 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:38
BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
return TRUE if p_SetComp requires p_Setm
Definition: ring.cc:1877
static unsigned long p_SubComp(poly p, unsigned long v, ring r)
Definition: p_polys.h:454
#define p_SetmComp
Definition: p_polys.h:245
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85
return result
Definition: facAbsBiFact.cc:76

◆ p_TakeOutComp() [2/2]

void p_TakeOutComp ( poly *  r_p,
long  comp,
poly *  r_q,
int *  lq,
const ring  r 
)

Definition at line 3446 of file p_polys.cc.

3447 {
3448  spolyrec pp, qq;
3449  poly p, q, p_prev;
3450  int l = 0;
3451 
3452 #ifndef SING_NDEBUG
3453  int lp = pLength(*r_p);
3454 #endif
3455 
3456  pNext(&pp) = *r_p;
3457  p = *r_p;
3458  p_prev = &pp;
3459  q = &qq;
3460 
3461  while(p != NULL)
3462  {
3463  while (__p_GetComp(p,r) == comp)
3464  {
3465  pNext(q) = p;
3466  pIter(q);
3467  p_SetComp(p, 0,r);
3468  p_SetmComp(p,r);
3469  pIter(p);
3470  l++;
3471  if (p == NULL)
3472  {
3473  pNext(p_prev) = NULL;
3474  goto Finish;
3475  }
3476  }
3477  pNext(p_prev) = p;
3478  p_prev = p;
3479  pIter(p);
3480  }
3481 
3482  Finish:
3483  pNext(q) = NULL;
3484  *r_p = pNext(&pp);
3485  *r_q = pNext(&qq);
3486  *lq = l;
3487 #ifndef SING_NDEBUG
3488  assume(pLength(*r_p) + pLength(*r_q) == lp);
3489 #endif
3490  p_Test(*r_p,r);
3491  p_Test(*r_q,r);
3492 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
#define pIter(p)
Definition: monomials.h:38
#define assume(x)
Definition: mod2.h:390
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
static unsigned pLength(poly a)
Definition: p_polys.h:193
#define p_Test(p, r)
Definition: p_polys.h:164
#define p_SetmComp
Definition: p_polys.h:245
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
Definition: lq.h:39
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ p_TakeOutComp1()

poly p_TakeOutComp1 ( poly *  p,
int  k,
const ring  r 
)

Definition at line 3334 of file p_polys.cc.

3335 {
3336  poly q = *p;
3337 
3338  if (q==NULL) return NULL;
3339 
3340  poly qq=NULL,result = NULL;
3341 
3342  if (__p_GetComp(q,r)==k)
3343  {
3344  result = q; /* *p */
3345  while ((q!=NULL) && (__p_GetComp(q,r)==k))
3346  {
3347  p_SetComp(q,0,r);
3348  p_SetmComp(q,r);
3349  qq = q;
3350  pIter(q);
3351  }
3352  *p = q;
3353  pNext(qq) = NULL;
3354  }
3355  if (q==NULL) return result;
3356 // if (pGetComp(q) > k) pGetComp(q)--;
3357  while (pNext(q)!=NULL)
3358  {
3359  if (__p_GetComp(pNext(q),r)==k)
3360  {
3361  if (result==NULL)
3362  {
3363  result = pNext(q);
3364  qq = result;
3365  }
3366  else
3367  {
3368  pNext(qq) = pNext(q);
3369  pIter(qq);
3370  }
3371  pNext(q) = pNext(pNext(q));
3372  pNext(qq) =NULL;
3373  p_SetComp(qq,0,r);
3374  p_SetmComp(qq,r);
3375  }
3376  else
3377  {
3378  pIter(q);
3379 // if (pGetComp(q) > k) pGetComp(q)--;
3380  }
3381  }
3382  return result;
3383 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:38
#define p_SetmComp
Definition: p_polys.h:245
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
return result
Definition: facAbsBiFact.cc:76

◆ p_TwoMonPower()

static poly p_TwoMonPower ( poly  p,
int  exp,
const ring  r 
)
static

Definition at line 2053 of file p_polys.cc.

2054 {
2055  int eh, e;
2056  long al;
2057  poly *a;
2058  poly tail, b, res, h;
2059  number x;
2060  number *bin = pnBin(exp,r);
2061 
2062  tail = pNext(p);
2063  if (bin == NULL)
2064  {
2065  p_MonPower(p,exp,r);
2066  p_MonPower(tail,exp,r);
2067  p_Test(p,r);
2068  return p;
2069  }
2070  eh = exp >> 1;
2071  al = (exp + 1) * sizeof(poly);
2072  a = (poly *)omAlloc(al);
2073  a[1] = p;
2074  for (e=1; e<exp; e++)
2075  {
2076  a[e+1] = p_MonMultC(a[e],p,r);
2077  }
2078  res = a[exp];
2079  b = p_Head(tail,r);
2080  for (e=exp-1; e>eh; e--)
2081  {
2082  h = a[e];
2083  x = n_Mult(bin[exp-e],pGetCoeff(h),r->cf);
2084  p_SetCoeff(h,x,r);
2085  p_MonMult(h,b,r);
2086  res = pNext(res) = h;
2087  p_MonMult(b,tail,r);
2088  }
2089  for (e=eh; e!=0; e--)
2090  {
2091  h = a[e];
2092  x = n_Mult(bin[e],pGetCoeff(h),r->cf);
2093  p_SetCoeff(h,x,r);
2094  p_MonMult(h,b,r);
2095  res = pNext(res) = h;
2096  p_MonMult(b,tail,r);
2097  }
2098  p_LmDelete(&tail,r);
2099  pNext(res) = b;
2100  pNext(b) = NULL;
2101  res = a[exp];
2102  omFreeSize((ADDRESS)a, al);
2103  pnFreeBin(bin, exp, r->cf);
2104 // tail=res;
2105 // while((tail!=NULL)&&(pNext(tail)!=NULL))
2106 // {
2107 // if(nIsZero(pGetCoeff(pNext(tail))))
2108 // {
2109 // pLmDelete(&pNext(tail));
2110 // }
2111 // else
2112 // pIter(tail);
2113 // }
2114  p_Test(res,r);
2115  return res;
2116 }
static poly p_MonPower(poly p, int exp, const ring r)
Definition: p_polys.cc:1947
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:358
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static void p_MonMult(poly p, poly q, const ring r)
Definition: p_polys.cc:1971
void * ADDRESS
Definition: auxiliary.h:133
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define omAlloc(size)
Definition: omAllocDecl.h:210
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
CanonicalForm b
Definition: cfModGcd.cc:4044
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:826
CanonicalForm res
Definition: facAbsFact.cc:64
static poly p_MonMultC(poly p, poly q, const ring rr)
Definition: p_polys.cc:1991
static number * pnBin(int exp, const ring r)
Definition: p_polys.cc:2005
#define p_Test(p, r)
Definition: p_polys.h:164
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
#define pNext(p)
Definition: monomials.h:37
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
static void pnFreeBin(number *bin, int exp, const coeffs r)
Definition: p_polys.cc:2036

◆ p_Var()

int p_Var ( poly  m,
const ring  r 
)

Definition at line 4554 of file p_polys.cc.

4555 {
4556  if (m==NULL) return 0;
4557  if (pNext(m)!=NULL) return 0;
4558  int i,e=0;
4559  for (i=rVar(r); i>0; i--)
4560  {
4561  int exp=p_GetExp(m,i,r);
4562  if (exp==1)
4563  {
4564  if (e==0) e=i;
4565  else return 0;
4566  }
4567  else if (exp!=0)
4568  {
4569  return 0;
4570  }
4571  }
4572  return e;
4573 }
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:358
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
int m
Definition: cfEzgcd.cc:121
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37

◆ p_Vec2Array()

void p_Vec2Array ( poly  v,
poly *  p,
int  len,
const ring  r 
)

vector to already allocated array (len>=p_MaxComp(v,r))

julia: vector to already allocated array (len=p_MaxComp(v,r))

Definition at line 3543 of file p_polys.cc.

3544 {
3545  poly h;
3546  int k;
3547 
3548  for(int i=len-1;i>=0;i--) p[i]=NULL;
3549  while (v!=NULL)
3550  {
3551  h=p_Head(v,r);
3552  k=__p_GetComp(h,r);
3553  if (k>len) { Werror("wrong rank:%d, should be %d",len,k); }
3554  else
3555  {
3556  p_SetComp(h,0,r);
3557  p_Setm(h,r);
3558  pNext(h)=p[k-1];p[k-1]=h;
3559  }
3560  pIter(v);
3561  }
3562  for(int i=len-1;i>=0;i--)
3563  {
3564  if (p[i]!=NULL) p[i]=pReverse(p[i]);
3565  }
3566 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:38
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:826
int i
Definition: cfEzgcd.cc:125
static poly pReverse(poly p)
Definition: p_polys.h:336
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
void Werror(const char *fmt,...)
Definition: reporter.cc:189

◆ p_Vec2Poly()

poly p_Vec2Poly ( poly  v,
int  k,
const ring  r 
)

Definition at line 3522 of file p_polys.cc.

3523 {
3524  poly h;
3525  poly res=NULL;
3526 
3527  while (v!=NULL)
3528  {
3529  if (__p_GetComp(v,r)==k)
3530  {
3531  h=p_Head(v,r);
3532  p_SetComp(h,0,r);
3533  pNext(h)=res;res=h;
3534  }
3535  pIter(v);
3536  }
3537  if (res!=NULL) res=pReverse(res);
3538  return res;
3539 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:38
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:826
CanonicalForm res
Definition: facAbsFact.cc:64
static poly pReverse(poly p)
Definition: p_polys.h:336
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
static Poly * h
Definition: janet.cc:972

◆ p_Vec2Polys()

void p_Vec2Polys ( poly  v,
poly **  p,
int *  len,
const ring  r 
)

Definition at line 3573 of file p_polys.cc.

3574 {
3575  poly h;
3576  int k;
3577 
3578  *len=p_MaxComp(v,r);
3579  if (*len==0) *len=1;
3580  *p=(poly*)omAlloc0((*len)*sizeof(poly));
3581  p_Vec2Array(v,*p,*len,r);
3582 }
int k
Definition: cfEzgcd.cc:92
void p_Vec2Array(poly v, poly *p, int len, const ring r)
vector to already allocated array (len>=p_MaxComp(v,r))
Definition: p_polys.cc:3543
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
#define omAlloc0(size)
Definition: omAllocDecl.h:211
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:293

◆ p_VectorHasUnit()

void p_VectorHasUnit ( poly  p,
int *  k,
int *  len,
const ring  r 
)

Definition at line 3302 of file p_polys.cc.

3303 {
3304  poly q=p,qq;
3305  int i,j=0;
3306 
3307  *len = 0;
3308  while (q!=NULL)
3309  {
3310  if (p_LmIsConstantComp(q,r))
3311  {
3312  i = __p_GetComp(q,r);
3313  qq = p;
3314  while ((qq != q) && (__p_GetComp(qq,r) != i)) pIter(qq);
3315  if (qq == q)
3316  {
3317  j = 0;
3318  while (qq!=NULL)
3319  {
3320  if (__p_GetComp(qq,r)==i) j++;
3321  pIter(qq);
3322  }
3323  if ((*len == 0) || (j<*len))
3324  {
3325  *len = j;
3326  *k = i;
3327  }
3328  }
3329  }
3330  pIter(q);
3331  }
3332 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
int j
Definition: facHensel.cc:105
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:963
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:38
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
int p
Definition: cfModGcd.cc:4019

◆ p_VectorHasUnitB()

BOOLEAN p_VectorHasUnitB ( poly  p,
int *  k,
const ring  r 
)

Definition at line 3279 of file p_polys.cc.

3280 {
3281  poly q=p,qq;
3282  int i;
3283 
3284  while (q!=NULL)
3285  {
3286  if (p_LmIsConstantComp(q,r))
3287  {
3288  i = __p_GetComp(q,r);
3289  qq = p;
3290  while ((qq != q) && (__p_GetComp(qq,r) != i)) pIter(qq);
3291  if (qq == q)
3292  {
3293  *k = i;
3294  return TRUE;
3295  }
3296  }
3297  pIter(q);
3298  }
3299  return FALSE;
3300 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:963
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:38
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
int p
Definition: cfModGcd.cc:4019

◆ p_WDegree()

long p_WDegree ( poly  p,
const ring  r 
)

Definition at line 706 of file p_polys.cc.

707 {
708  if (r->firstwv==NULL) return p_Totaldegree(p, r);
709  p_LmCheckPolyRing(p, r);
710  int i;
711  long j =0;
712 
713  for(i=1;i<=r->firstBlockEnds;i++)
714  j+=p_GetExp(p, i, r)*r->firstwv[i-1];
715 
716  for (;i<=rVar(r);i++)
717  j+=p_GetExp(p,i, r)*p_Weight(i, r);
718 
719  return j;
720 }
int j
Definition: facHensel.cc:105
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1444
int p_Weight(int i, const ring r)
Definition: p_polys.cc:697
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:120
int p
Definition: cfModGcd.cc:4019

◆ p_Weight()

int p_Weight ( int  i,
const ring  r 
)

Definition at line 697 of file p_polys.cc.

698 {
699  if ((r->firstwv==NULL) || (i>r->firstBlockEnds))
700  {
701  return 1;
702  }
703  return r->firstwv[i-1];
704 }
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10

◆ p_WFirstTotalDegree()

long p_WFirstTotalDegree ( poly  p,
const ring  r 
)

Definition at line 588 of file p_polys.cc.

589 {
590  int i;
591  long sum = 0;
592 
593  for (i=1; i<= r->firstBlockEnds; i++)
594  {
595  sum += p_GetExp(p, i, r)*r->firstwv[i-1];
596  }
597  return sum;
598 }
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
int i
Definition: cfEzgcd.cc:125
int p
Definition: cfModGcd.cc:4019

◆ p_WTotaldegree()

long p_WTotaldegree ( poly  p,
const ring  r 
)

Definition at line 605 of file p_polys.cc.

606 {
607  p_LmCheckPolyRing(p, r);
608  int i, k;
609  long j =0;
610 
611  // iterate through each block:
612  for (i=0;r->order[i]!=0;i++)
613  {
614  int b0=r->block0[i];
615  int b1=r->block1[i];
616  switch(r->order[i])
617  {
618  case ringorder_M:
619  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
620  { // in jedem block:
621  j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/]*r->OrdSgn;
622  }
623  break;
624  case ringorder_am:
625  b1=si_min(b1,r->N);
626  /* no break, continue as ringorder_a*/
627  case ringorder_a:
628  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
629  { // only one line
630  j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/];
631  }
632  return j*r->OrdSgn;
633  case ringorder_wp:
634  case ringorder_ws:
635  case ringorder_Wp:
636  case ringorder_Ws:
637  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
638  { // in jedem block:
639  j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/];
640  }
641  break;
642  case ringorder_lp:
643  case ringorder_ls:
644  case ringorder_rs:
645  case ringorder_dp:
646  case ringorder_ds:
647  case ringorder_Dp:
648  case ringorder_Ds:
649  case ringorder_rp:
650  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
651  {
652  j+= p_GetExp(p,k,r);
653  }
654  break;
655  case ringorder_a64:
656  {
657  int64* w=(int64*)r->wvhdl[i];
658  for (k=0;k<=(b1 /*r->block1[i]*/ - b0 /*r->block0[i]*/);k++)
659  {
660  //there should be added a line which checks if w[k]>2^31
661  j+= p_GetExp(p,k+1, r)*(long)w[k];
662  }
663  //break;
664  return j;
665  }
666  case ringorder_c: /* nothing to do*/
667  case ringorder_C: /* nothing to do*/
668  case ringorder_S: /* nothing to do*/
669  case ringorder_s: /* nothing to do*/
670  case ringorder_IS: /* nothing to do */
671  case ringorder_unspec: /* to make clang happy, does not occur*/
672  case ringorder_no: /* to make clang happy, does not occur*/
673  case ringorder_L: /* to make clang happy, does not occur*/
674  case ringorder_aa: /* ignored by p_WTotaldegree*/
675  break;
676  /* no default: all orderings covered */
677  }
678  }
679  return j;
680 }
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:92
int j
Definition: facHensel.cc:105
for int64 weights
Definition: ring.h:72
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
opposite of ls
Definition: ring.h:93
long int64
Definition: auxiliary.h:66
int k
Definition: cfEzgcd.cc:92
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
for(int i=0;i<=n;i++) degsf[i]
Definition: cfEzgcd.cc:65
int i
Definition: cfEzgcd.cc:125
Induced (Schreyer) ordering.
Definition: ring.h:94
S?
Definition: ring.h:76
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:120
const CanonicalForm & w
Definition: facAbsFact.cc:55
int p
Definition: cfModGcd.cc:4019
s?
Definition: ring.h:77

◆ pEnlargeSet()

void pEnlargeSet ( poly **  p,
int  l,
int  increment 
)

Definition at line 3647 of file p_polys.cc.

3648 {
3649  poly* h;
3650 
3651  if (*p==NULL)
3652  {
3653  if (increment==0) return;
3654  h=(poly*)omAlloc0(increment*sizeof(poly));
3655  }
3656  else
3657  {
3658  h=(poly*)omReallocSize((poly*)*p,l*sizeof(poly),(l+increment)*sizeof(poly));
3659  if (increment>0)
3660  {
3661  memset(&(h[l]),0,increment*sizeof(poly));
3662  }
3663  }
3664  *p=h;
3665 }
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define NULL
Definition: omList.c:10
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:93

◆ pLDeg0()

long pLDeg0 ( poly  p,
int *  l,
const ring  r 
)

Definition at line 731 of file p_polys.cc.

732 {
733  p_CheckPolyRing(p, r);
734  long k= p_GetComp(p, r);
735  int ll=1;
736 
737  if (k > 0)
738  {
739  while ((pNext(p)!=NULL) && (__p_GetComp(pNext(p), r)==k))
740  {
741  pIter(p);
742  ll++;
743  }
744  }
745  else
746  {
747  while (pNext(p)!=NULL)
748  {
749  pIter(p);
750  ll++;
751  }
752  }
753  *l=ll;
754  return r->pFDeg(p, r);
755 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
#define p_GetComp(p, r)
Definition: monomials.h:65
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:38
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg0c()

long pLDeg0c ( poly  p,
int *  l,
const ring  r 
)

Definition at line 762 of file p_polys.cc.

763 {
764  assume(p!=NULL);
765  p_Test(p,r);
766  p_CheckPolyRing(p, r);
767  long o;
768  int ll=1;
769 
770  if (! rIsSyzIndexRing(r))
771  {
772  while (pNext(p) != NULL)
773  {
774  pIter(p);
775  ll++;
776  }
777  o = r->pFDeg(p, r);
778  }
779  else
780  {
781  int curr_limit = rGetCurrSyzLimit(r);
782  poly pp = p;
783  while ((p=pNext(p))!=NULL)
784  {
785  if (__p_GetComp(p, r)<=curr_limit/*syzComp*/)
786  ll++;
787  else break;
788  pp = p;
789  }
790  p_Test(pp,r);
791  o = r->pFDeg(pp, r);
792  }
793  *l=ll;
794  return o;
795 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:710
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:713
#define pIter(p)
Definition: monomials.h:38
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
#define assume(x)
Definition: mod2.h:390
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
#define p_Test(p, r)
Definition: p_polys.h:164
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1()

long pLDeg1 ( poly  p,
int *  l,
const ring  r 
)

Definition at line 833 of file p_polys.cc.

834 {
835  p_CheckPolyRing(p, r);
836  long k= p_GetComp(p, r);
837  int ll=1;
838  long t,max;
839 
840  max=r->pFDeg(p, r);
841  if (k > 0)
842  {
843  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
844  {
845  t=r->pFDeg(p, r);
846  if (t>max) max=t;
847  ll++;
848  }
849  }
850  else
851  {
852  while ((p=pNext(p))!=NULL)
853  {
854  t=r->pFDeg(p, r);
855  if (t>max) max=t;
856  ll++;
857  }
858  }
859  *l=ll;
860  return max;
861 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
#define p_GetComp(p, r)
Definition: monomials.h:65
int k
Definition: cfEzgcd.cc:92
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
static int max(int a, int b)
Definition: fast_mult.cc:264
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1_Deg()

long pLDeg1_Deg ( poly  p,
int *  l,
const ring  r 
)

Definition at line 902 of file p_polys.cc.

903 {
904  assume(r->pFDeg == p_Deg);
905  p_CheckPolyRing(p, r);
906  long k= p_GetComp(p, r);
907  int ll=1;
908  long t,max;
909 
910  max=p_GetOrder(p, r);
911  if (k > 0)
912  {
913  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
914  {
915  t=p_GetOrder(p, r);
916  if (t>max) max=t;
917  ll++;
918  }
919  }
920  else
921  {
922  while ((p=pNext(p))!=NULL)
923  {
924  t=p_GetOrder(p, r);
925  if (t>max) max=t;
926  ll++;
927  }
928  }
929  *l=ll;
930  return max;
931 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
#define p_GetComp(p, r)
Definition: monomials.h:65
int k
Definition: cfEzgcd.cc:92
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:579
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:390
static long p_GetOrder(poly p, ring r)
Definition: p_polys.h:422
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1_Totaldegree()

long pLDeg1_Totaldegree ( poly  p,
int *  l,
const ring  r 
)

Definition at line 967 of file p_polys.cc.

968 {
969  p_CheckPolyRing(p, r);
970  long k= p_GetComp(p, r);
971  int ll=1;
972  long t,max;
973 
974  max=p_Totaldegree(p, r);
975  if (k > 0)
976  {
977  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
978  {
979  t=p_Totaldegree(p, r);
980  if (t>max) max=t;
981  ll++;
982  }
983  }
984  else
985  {
986  while ((p=pNext(p))!=NULL)
987  {
988  t=p_Totaldegree(p, r);
989  if (t>max) max=t;
990  ll++;
991  }
992  }
993  *l=ll;
994  return max;
995 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
#define p_GetComp(p, r)
Definition: monomials.h:65
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1444
int k
Definition: cfEzgcd.cc:92
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
static int max(int a, int b)
Definition: fast_mult.cc:264
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1_WFirstTotalDegree()

long pLDeg1_WFirstTotalDegree ( poly  p,
int *  l,
const ring  r 
)

Definition at line 1030 of file p_polys.cc.

1031 {
1032  p_CheckPolyRing(p, r);
1033  long k= p_GetComp(p, r);
1034  int ll=1;
1035  long t,max;
1036 
1038  if (k > 0)
1039  {
1040  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
1041  {
1042  t=p_WFirstTotalDegree(p, r);
1043  if (t>max) max=t;
1044  ll++;
1045  }
1046  }
1047  else
1048  {
1049  while ((p=pNext(p))!=NULL)
1050  {
1051  t=p_WFirstTotalDegree(p, r);
1052  if (t>max) max=t;
1053  ll++;
1054  }
1055  }
1056  *l=ll;
1057  return max;
1058 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
#define p_GetComp(p, r)
Definition: monomials.h:65
int k
Definition: cfEzgcd.cc:92
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
static int max(int a, int b)
Definition: fast_mult.cc:264
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:588
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1c()

long pLDeg1c ( poly  p,
int *  l,
const ring  r 
)

Definition at line 869 of file p_polys.cc.

870 {
871  p_CheckPolyRing(p, r);
872  int ll=1;
873  long t,max;
874 
875  max=r->pFDeg(p, r);
876  if (rIsSyzIndexRing(r))
877  {
878  long limit = rGetCurrSyzLimit(r);
879  while ((p=pNext(p))!=NULL)
880  {
881  if (__p_GetComp(p, r)<=limit)
882  {
883  if ((t=r->pFDeg(p, r))>max) max=t;
884  ll++;
885  }
886  else break;
887  }
888  }
889  else
890  {
891  while ((p=pNext(p))!=NULL)
892  {
893  if ((t=r->pFDeg(p, r))>max) max=t;
894  ll++;
895  }
896  }
897  *l=ll;
898  return max;
899 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:710
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:713
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
static int max(int a, int b)
Definition: fast_mult.cc:264
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1c_Deg()

long pLDeg1c_Deg ( poly  p,
int *  l,
const ring  r 
)

Definition at line 933 of file p_polys.cc.

934 {
935  assume(r->pFDeg == p_Deg);
936  p_CheckPolyRing(p, r);
937  int ll=1;
938  long t,max;
939 
940  max=p_GetOrder(p, r);
941  if (rIsSyzIndexRing(r))
942  {
943  long limit = rGetCurrSyzLimit(r);
944  while ((p=pNext(p))!=NULL)
945  {
946  if (__p_GetComp(p, r)<=limit)
947  {
948  if ((t=p_GetOrder(p, r))>max) max=t;
949  ll++;
950  }
951  else break;
952  }
953  }
954  else
955  {
956  while ((p=pNext(p))!=NULL)
957  {
958  if ((t=p_GetOrder(p, r))>max) max=t;
959  ll++;
960  }
961  }
962  *l=ll;
963  return max;
964 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:710
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:713
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:579
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:390
static long p_GetOrder(poly p, ring r)
Definition: p_polys.h:422
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1c_Totaldegree()

long pLDeg1c_Totaldegree ( poly  p,
int *  l,
const ring  r 
)

Definition at line 997 of file p_polys.cc.

998 {
999  p_CheckPolyRing(p, r);
1000  int ll=1;
1001  long t,max;
1002 
1003  max=p_Totaldegree(p, r);
1004  if (rIsSyzIndexRing(r))
1005  {
1006  long limit = rGetCurrSyzLimit(r);
1007  while ((p=pNext(p))!=NULL)
1008  {
1009  if (__p_GetComp(p, r)<=limit)
1010  {
1011  if ((t=p_Totaldegree(p, r))>max) max=t;
1012  ll++;
1013  }
1014  else break;
1015  }
1016  }
1017  else
1018  {
1019  while ((p=pNext(p))!=NULL)
1020  {
1021  if ((t=p_Totaldegree(p, r))>max) max=t;
1022  ll++;
1023  }
1024  }
1025  *l=ll;
1026  return max;
1027 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:710
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:713
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1444
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
static int max(int a, int b)
Definition: fast_mult.cc:264
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1c_WFirstTotalDegree()

long pLDeg1c_WFirstTotalDegree ( poly  p,
int *  l,
const ring  r 
)

Definition at line 1060 of file p_polys.cc.

1061 {
1062  p_CheckPolyRing(p, r);
1063  int ll=1;
1064  long t,max;
1065 
1067  if (rIsSyzIndexRing(r))
1068  {
1069  long limit = rGetCurrSyzLimit(r);
1070  while ((p=pNext(p))!=NULL)
1071  {
1072  if (__p_GetComp(p, r)<=limit)
1073  {
1074  if ((t=p_Totaldegree(p, r))>max) max=t;
1075  ll++;
1076  }
1077  else break;
1078  }
1079  }
1080  else
1081  {
1082  while ((p=pNext(p))!=NULL)
1083  {
1084  if ((t=p_Totaldegree(p, r))>max) max=t;
1085  ll++;
1086  }
1087  }
1088  *l=ll;
1089  return max;
1090 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:710
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:713
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1444
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
static int max(int a, int b)
Definition: fast_mult.cc:264
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:588
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDegb()

long pLDegb ( poly  p,
int *  l,
const ring  r 
)

Definition at line 803 of file p_polys.cc.

804 {
805  p_CheckPolyRing(p, r);
806  long k= p_GetComp(p, r);
807  long o = r->pFDeg(p, r);
808  int ll=1;
809 
810  if (k != 0)
811  {
812  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
813  {
814  ll++;
815  }
816  }
817  else
818  {
819  while ((p=pNext(p)) !=NULL)
820  {
821  ll++;
822  }
823  }
824  *l=ll;
825  return o;
826 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
#define p_GetComp(p, r)
Definition: monomials.h:65
int k
Definition: cfEzgcd.cc:92
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pModDeg()

static long pModDeg ( poly  p,
ring  r 
)
static

Definition at line 3615 of file p_polys.cc.

3616 {
3617  long d=pOldFDeg(p, r);
3618  int c=__p_GetComp(p, r);
3619  if ((c>0) && ((r->pModW)->range(c-1))) d+= (*(r->pModW))[c-1];
3620  return d;
3621  //return pOldFDeg(p, r)+(*pModW)[p_GetComp(p, r)-1];
3622 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
static pFDegProc pOldFDeg
Definition: p_polys.cc:3611
int p
Definition: cfModGcd.cc:4019

◆ pnBin()

static number* pnBin ( int  exp,
const ring  r 
)
static

Definition at line 2005 of file p_polys.cc.

2006 {
2007  int e, i, h;
2008  number x, y, *bin=NULL;
2009 
2010  x = n_Init(exp,r->cf);
2011  if (n_IsZero(x,r->cf))
2012  {
2013  n_Delete(&x,r->cf);
2014  return bin;
2015  }
2016  h = (exp >> 1) + 1;
2017  bin = (number *)omAlloc0(h*sizeof(number));
2018  bin[1] = x;
2019  if (exp < 4)
2020  return bin;
2021  i = exp - 1;
2022  for (e=2; e<h; e++)
2023  {
2024  x = n_Init(i,r->cf);
2025  i--;
2026  y = n_Mult(x,bin[e-1],r->cf);
2027  n_Delete(&x,r->cf);
2028  x = n_Init(e,r->cf);
2029  bin[e] = n_ExactDiv(y,x,r->cf);
2030  n_Delete(&x,r->cf);
2031  n_Delete(&y,r->cf);
2032  }
2033  return bin;
2034 }
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:358
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
int i
Definition: cfEzgcd.cc:125
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
static FORCE_INLINE number n_ExactDiv(number a, number b, const coeffs r)
assume that there is a canonical subring in cf and we know that division is possible for these a and ...
Definition: coeffs.h:622
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static Poly * h
Definition: janet.cc:972
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ pnFreeBin()

static void pnFreeBin ( number *  bin,
int  exp,
const coeffs  r 
)
static

Definition at line 2036 of file p_polys.cc.

2037 {
2038  int e, h = (exp >> 1) + 1;
2039 
2040  if (bin[1] != NULL)
2041  {
2042  for (e=1; e<h; e++)
2043  n_Delete(&(bin[e]),r);
2044  }
2045  omFreeSize((ADDRESS)bin, h*sizeof(number));
2046 }
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:358
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:133
#define NULL
Definition: omList.c:10
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static Poly * h
Definition: janet.cc:972

◆ pp_Jet()

poly pp_Jet ( poly  p,
int  m,
const ring  R 
)

Definition at line 4256 of file p_polys.cc.

4257 {
4258  poly r=NULL;
4259  poly t=NULL;
4260 
4261  while (p!=NULL)
4262  {
4263  if (p_Totaldegree(p,R)<=m)
4264  {
4265  if (r==NULL)
4266  r=p_Head(p,R);
4267  else
4268  if (t==NULL)
4269  {
4270  pNext(r)=p_Head(p,R);
4271  t=pNext(r);
4272  }
4273  else
4274  {
4275  pNext(t)=p_Head(p,R);
4276  pIter(t);
4277  }
4278  }
4279  pIter(p);
4280  }
4281  return r;
4282 }
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1444
#define pIter(p)
Definition: monomials.h:38
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:826
int m
Definition: cfEzgcd.cc:121
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019

◆ pp_JetW()

poly pp_JetW ( poly  p,
int  m,
short *  w,
const ring  R 
)

Definition at line 4301 of file p_polys.cc.

4302 {
4303  poly r=NULL;
4304  poly t=NULL;
4305  while (p!=NULL)
4306  {
4307  if (totaldegreeWecart_IV(p,R,w)<=m)
4308  {
4309  if (r==NULL)
4310  r=p_Head(p,R);
4311  else
4312  if (t==NULL)
4313  {
4314  pNext(r)=p_Head(p,R);
4315  t=pNext(r);
4316  }
4317  else
4318  {
4319  pNext(t)=p_Head(p,R);
4320  pIter(t);
4321  }
4322  }
4323  pIter(p);
4324  }
4325  return r;
4326 }
long totaldegreeWecart_IV(poly p, ring r, const short *w)
Definition: weight.cc:237
#define pIter(p)
Definition: monomials.h:38
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:826
int m
Definition: cfEzgcd.cc:121
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019

◆ pRestoreDegProcs()

void pRestoreDegProcs ( ring  r,
pFDegProc  old_FDeg,
pLDegProc  old_lDeg 
)

Definition at line 3600 of file p_polys.cc.

3601 {
3602  assume(old_FDeg != NULL && old_lDeg != NULL);
3603  r->pFDeg = old_FDeg;
3604  r->pLDeg = old_lDeg;
3605 }
#define assume(x)
Definition: mod2.h:390
#define NULL
Definition: omList.c:10

◆ pSetDegProcs()

void pSetDegProcs ( ring  r,
pFDegProc  new_FDeg,
pLDegProc  new_lDeg 
)

Definition at line 3588 of file p_polys.cc.

3589 {
3590  assume(new_FDeg != NULL);
3591  r->pFDeg = new_FDeg;
3592 
3593  if (new_lDeg == NULL)
3594  new_lDeg = r->pLDegOrig;
3595 
3596  r->pLDeg = new_lDeg;
3597 }
#define assume(x)
Definition: mod2.h:390
#define NULL
Definition: omList.c:10

Variable Documentation

◆ _components

int* _components = NULL
static

Definition at line 142 of file p_polys.cc.

◆ _componentsExternal

int _componentsExternal = 0
static

Definition at line 144 of file p_polys.cc.

◆ _componentsShifted

long* _componentsShifted = NULL
static

Definition at line 143 of file p_polys.cc.

◆ pOldFDeg

pFDegProc pOldFDeg
static

Definition at line 3611 of file p_polys.cc.

◆ pOldLDeg

pLDegProc pOldLDeg
static

Definition at line 3612 of file p_polys.cc.

◆ pOldLexOrder

BOOLEAN pOldLexOrder
static

Definition at line 3613 of file p_polys.cc.

◆ pSetm_error

BOOLEAN pSetm_error =0

Definition at line 146 of file p_polys.cc.