Functions
polys0.cc File Reference
#include <misc/auxiliary.h>
#include <coeffs/numbers.h>
#include <polys/monomials/ring.h>
#include <polys/monomials/p_polys.h>

Go to the source code of this file.

Functions

static void writemon (poly p, int ko, const ring r)
 
void p_String0Short (const poly p, ring lmRing, ring tailRing)
 if possible print p in a short way... More...
 
void p_String0Long (const poly p, ring lmRing, ring tailRing)
 print p in a long way... More...
 
void p_String0 (poly p, ring lmRing, ring tailRing)
 print p according to ShortOut in lmRing & tailRing More...
 
char * p_String (poly p, ring lmRing, ring tailRing)
 
void p_Write0 (poly p, ring lmRing, ring tailRing)
 
void p_Write (poly p, ring lmRing, ring tailRing)
 
void p_wrp0 (poly p, ring ri)
 
void p_wrp (poly p, ring lmRing, ring tailRing)
 

Function Documentation

char* p_String ( poly  p,
ring  lmRing,
ring  tailRing 
)

Definition at line 184 of file polys0.cc.

185 {
186  StringSetS("");
188  return StringEndS();
189 }
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
char * StringEndS()
Definition: reporter.cc:151
void StringSetS(const char *st)
Definition: reporter.cc:128
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:138
void p_String0 ( poly  p,
ring  lmRing,
ring  tailRing 
)

print p according to ShortOut in lmRing & tailRing

Definition at line 138 of file polys0.cc.

139 {
140  if (p == NULL)
141  {
142  StringAppendS("0");
143  return;
144  }
145  if ((p_GetComp(p, lmRing) == 0) || (!lmRing->VectorOut))
146  {
147  writemon(p,0, lmRing);
148  p = pNext(p);
149  while (p!=NULL)
150  {
151  assume((p->coef==NULL)||(!n_IsZero(p->coef,tailRing->cf)));
152  if ((p->coef==NULL)||n_GreaterZero(p->coef,tailRing->cf))
153  StringAppendS("+");
154  writemon(p,0, tailRing);
155  p = pNext(p);
156  }
157  return;
158  }
159 
160  long k = 1;
161  StringAppendS("[");
162  loop
163  {
164  while (k < p_GetComp(p,lmRing))
165  {
166  StringAppendS("0,");
167  k++;
168  }
169  writemon(p,k,lmRing);
170  pIter(p);
171  while ((p!=NULL) && (k == p_GetComp(p, tailRing)))
172  {
173  if (n_GreaterZero(p->coef,tailRing->cf)) StringAppendS("+");
174  writemon(p,k,tailRing);
175  pIter(p);
176  }
177  if (p == NULL) break;
178  StringAppendS(",");
179  k++;
180  }
181  StringAppendS("]");
182 }
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
#define assume(x)
Definition: mod2.h:405
void StringAppendS(const char *st)
Definition: reporter.cc:107
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:43
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), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:494
static void writemon(poly p, int ko, const ring r)
Definition: polys0.cc:23
void p_String0Long ( const poly  p,
ring  lmRing,
ring  tailRing 
)

print p in a long way...

print p in a long way

Definition at line 119 of file polys0.cc.

120 {
121  // NOTE: the following (non-thread-safe!) UGLYNESS
122  // (changing naRing->ShortOut for a while) is due to Hans!
123  // Just think of other ring using the VERY SAME naRing and possible
124  // side-effects...
125  const BOOLEAN bLMShortOut = rShortOut(lmRing);
126  const BOOLEAN bTAILShortOut = rShortOut(tailRing);
127 
128  lmRing->ShortOut = FALSE;
129  tailRing->ShortOut = FALSE;
130 
132 
133  lmRing->ShortOut = bLMShortOut;
134  tailRing->ShortOut = bTAILShortOut;
135 }
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static BOOLEAN rShortOut(const ring r)
Definition: ring.h:520
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:138
int BOOLEAN
Definition: auxiliary.h:131
void p_String0Short ( const poly  p,
ring  lmRing,
ring  tailRing 
)

if possible print p in a short way...

print p in a short way, if possible

Definition at line 100 of file polys0.cc.

101 {
102  // NOTE: the following (non-thread-safe!) UGLYNESS
103  // (changing naRing->ShortOut for a while) is due to Hans!
104  // Just think of other ring using the VERY SAME naRing and possible
105  // side-effects...
106  const BOOLEAN bLMShortOut = rShortOut(lmRing);
107  const BOOLEAN bTAILShortOut = rShortOut(tailRing);
108 
109  lmRing->ShortOut = rCanShortOut(lmRing);
110  tailRing->ShortOut = rCanShortOut(tailRing);
111 
113 
114  lmRing->ShortOut = bLMShortOut;
115  tailRing->ShortOut = bTAILShortOut;
116 }
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static BOOLEAN rShortOut(const ring r)
Definition: ring.h:520
static BOOLEAN rCanShortOut(const ring r)
Definition: ring.h:525
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:138
int BOOLEAN
Definition: auxiliary.h:131
void p_Write ( poly  p,
ring  lmRing,
ring  tailRing 
)

Definition at line 204 of file polys0.cc.

205 {
207  PrintLn();
208 }
void PrintLn()
Definition: reporter.cc:322
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:194
void p_Write0 ( poly  p,
ring  lmRing,
ring  tailRing 
)

Definition at line 194 of file polys0.cc.

195 {
196  char *s=p_String(p, lmRing, tailRing);
197  PrintS(s);
198  omFree(s);
199 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
char * p_String(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:184
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
#define omFree(addr)
Definition: omAllocDecl.h:261
void PrintS(const char *s)
Definition: reporter.cc:294
void p_wrp ( poly  p,
ring  lmRing,
ring  tailRing 
)

Definition at line 235 of file polys0.cc.

236 {
237  poly r;
238 
239  if (p==NULL) PrintS("NULL");
240  else if (pNext(p)==NULL) p_Write0(p, lmRing);
241  else
242  {
243  r = pNext(pNext(p));
244  pNext(pNext(p)) = NULL;
246  if (r!=NULL)
247  {
248  PrintS("+...");
249  pNext(pNext(p)) = r;
250  }
251  }
252 }
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
const ring r
Definition: syzextra.cc:208
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:194
polyrec * poly
Definition: hilb.h:10
void PrintS(const char *s)
Definition: reporter.cc:294
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
void p_wrp0 ( poly  p,
ring  ri 
)

Definition at line 216 of file polys0.cc.

217 {
218  poly r;
219 
220  if (p==NULL) PrintS("NULL");
221  else if (pNext(p)==NULL) p_Write0(p, ri);
222  else
223  {
224  r = pNext(p);
225  pNext(p) = NULL;
226  p_Write0(p, ri);
227  if (r!=NULL)
228  {
229  PrintS("+...");
230  pNext(p) = r;
231  }
232  }
233 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:194
polyrec * poly
Definition: hilb.h:10
void PrintS(const char *s)
Definition: reporter.cc:294
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static void writemon ( poly  p,
int  ko,
const ring  r 
)
static

Definition at line 23 of file polys0.cc.

24 {
25  assume(r != NULL);
26  const coeffs C = r->cf;
27  assume(C != NULL);
28 
29  BOOLEAN wroteCoef=FALSE,writeGen=FALSE;
30  const BOOLEAN bNotShortOut = (rShortOut(r) == FALSE);
31 
32  if (pGetCoeff(p)!=NULL)
34 
35  if (((p_GetComp(p,r) == (short)ko)
36  &&(p_LmIsConstantComp(p, r)))
37  || ((!n_IsOne(pGetCoeff(p),C))
38  && (!n_IsMOne(pGetCoeff(p),C))
39  )
40  )
41  {
42  if( bNotShortOut )
44  else
46 
47  wroteCoef=(bNotShortOut)
48  || (rParameter(r)!=NULL)
50  writeGen=TRUE;
51  }
52  else if (n_IsMOne(pGetCoeff(p),C))
53  {
54  if (n_GreaterZero(pGetCoeff(p),C))
55  {
56  if( bNotShortOut )
58  else
60 
61  wroteCoef=(bNotShortOut)
62  || (rParameter(r)!=NULL)
64  writeGen=TRUE;
65  }
66  else
67  StringAppendS("-");
68  }
69 
70  int i;
71  for (i=0; i<rVar(r); i++)
72  {
73  {
74  long ee = p_GetExp(p,i+1,r);
75  if (ee!=0L)
76  {
77  if (wroteCoef)
78  StringAppendS("*");
79  //else
80  wroteCoef=(bNotShortOut);
81  writeGen=TRUE;
83  if (ee != 1L)
84  {
85  if (bNotShortOut) StringAppendS("^");
86  StringAppend("%ld", ee);
87  }
88  }
89  }
90  }
91  //StringAppend("{%d}",p->Order);
92  if (p_GetComp(p, r) != (long)ko)
93  {
94  if (writeGen) StringAppendS("*");
95  StringAppend("gen(%d)", p_GetComp(p, r));
96  }
97 }
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:937
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
static BOOLEAN rField_is_R(const ring r)
Definition: ring.h:458
#define p_GetComp(p, r)
Definition: monomials.h:72
static BOOLEAN rShortOut(const ring r)
Definition: ring.h:520
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
#define TRUE
Definition: auxiliary.h:144
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:577
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:564
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
#define assume(x)
Definition: mod2.h:405
The main handler for Singular numbers which are suitable for Singular polynomials.
void StringAppendS(const char *st)
Definition: reporter.cc:107
#define StringAppend
Definition: emacs.cc:82
int i
Definition: cfEzgcd.cc:123
static char * rRingVar(short i, const ring r)
Definition: ring.h:516
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:485
#define NULL
Definition: omList.c:10
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:482
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
Definition: coeffs.h:472
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), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:494
int BOOLEAN
Definition: auxiliary.h:131
static FORCE_INLINE void n_WriteShort(number &n, const coeffs r)
write to the output buffer of the currently used reporter in a shortest possible way, e.g. in K(a): a2 instead of a^2
Definition: coeffs.h:587
static FORCE_INLINE void n_WriteLong(number &n, const coeffs r)
write to the output buffer of the currently used reporter
Definition: coeffs.h:582