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 186 of file polys0.cc.

187 {
188  StringSetS("");
190  return StringEndS();
191 }
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:136
void p_String0 ( poly  p,
ring  lmRing,
ring  tailRing 
)

print p according to ShortOut in lmRing & tailRing

Definition at line 136 of file polys0.cc.

137 {
138  if (p == NULL)
139  {
140  StringAppendS("0");
141  return;
142  }
144  if ((n_GetChar(lmRing->cf) == 0)
145  && (nCoeff_is_transExt(lmRing->cf)))
146  p_Normalize(p,lmRing); /* Manual/absfact.tst */
147  if ((p_GetComp(p, lmRing) == 0) || (!lmRing->VectorOut))
148  {
149  writemon(p,0, lmRing);
150  p = pNext(p);
151  while (p!=NULL)
152  {
153  assume((p->coef==NULL)||(!n_IsZero(p->coef,tailRing->cf)));
154  if ((p->coef==NULL)||n_GreaterZero(p->coef,tailRing->cf))
155  StringAppendS("+");
156  writemon(p,0, tailRing);
157  p = pNext(p);
158  }
159  return;
160  }
161 
162  long k = 1;
163  StringAppendS("[");
164  loop
165  {
166  while (k < p_GetComp(p,lmRing))
167  {
168  StringAppendS("0,");
169  k++;
170  }
171  writemon(p,k,lmRing);
172  pIter(p);
173  while ((p!=NULL) && (k == p_GetComp(p, tailRing)))
174  {
175  if (n_GreaterZero(p->coef,tailRing->cf)) StringAppendS("+");
176  writemon(p,k,tailRing);
177  pIter(p);
178  }
179  if (p == NULL) break;
180  StringAppendS(",");
181  k++;
182  }
183  StringAppendS("]");
184 }
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
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:445
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 nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:919
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:465
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3621
#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 &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:495
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 116 of file polys0.cc.

117 {
118  // NOTE: the following (non-thread-safe!) UGLYNESS
119  // (changing naRing->ShortOut for a while) is due to Hans!
120  // Just think of other ring using the VERY SAME naRing and possible
121  // side-effects...
122  // but this is not a problem: i/o is not thread-safe anyway.
123  const BOOLEAN bLMShortOut = rShortOut(lmRing);
124  const BOOLEAN bTAILShortOut = rShortOut(tailRing);
125 
126  lmRing->ShortOut = FALSE;
127  tailRing->ShortOut = FALSE;
128 
130 
131  lmRing->ShortOut = bLMShortOut;
132  tailRing->ShortOut = bTAILShortOut;
133 }
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:529
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:136
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 97 of file polys0.cc.

98 {
99  // NOTE: the following (non-thread-safe!) UGLYNESS
100  // (changing naRing->ShortOut for a while) is due to Hans!
101  // Just think of other ring using the VERY SAME naRing and possible
102  // side-effects...
103  const BOOLEAN bLMShortOut = rShortOut(lmRing);
104  const BOOLEAN bTAILShortOut = rShortOut(tailRing);
105 
106  lmRing->ShortOut = rCanShortOut(lmRing);
107  tailRing->ShortOut = rCanShortOut(tailRing);
108 
110 
111  lmRing->ShortOut = bLMShortOut;
112  tailRing->ShortOut = bTAILShortOut;
113 }
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:529
static BOOLEAN rCanShortOut(const ring r)
Definition: ring.h:534
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:136
int BOOLEAN
Definition: auxiliary.h:131
void p_Write ( poly  p,
ring  lmRing,
ring  tailRing 
)

Definition at line 206 of file polys0.cc.

207 {
209  PrintLn();
210 }
void PrintLn()
Definition: reporter.cc:327
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:196
void p_Write0 ( poly  p,
ring  lmRing,
ring  tailRing 
)

Definition at line 196 of file polys0.cc.

197 {
198  char *s=p_String(p, lmRing, tailRing);
199  PrintS(s);
200  omFree(s);
201 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
char * p_String(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:186
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 237 of file polys0.cc.

238 {
239  poly r;
240 
241  if (p==NULL) PrintS("NULL");
242  else if (pNext(p)==NULL) p_Write0(p, lmRing);
243  else
244  {
245  r = pNext(pNext(p));
246  pNext(pNext(p)) = NULL;
247  p_Write0(p, tailRing);
248  if (r!=NULL)
249  {
250  PrintS("+...");
251  pNext(pNext(p)) = r;
252  }
253  }
254 }
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:196
void PrintS(const char *s)
Definition: reporter.cc:294
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
void p_wrp0 ( poly  p,
ring  ri 
)

Definition at line 218 of file polys0.cc.

219 {
220  poly r;
221 
222  if (p==NULL) PrintS("NULL");
223  else if (pNext(p)==NULL) p_Write0(p, ri);
224  else
225  {
226  r = pNext(p);
227  pNext(p) = NULL;
228  p_Write0(p, ri);
229  if (r!=NULL)
230  {
231  PrintS("+...");
232  pNext(p) = r;
233  }
234  }
235 }
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:196
void PrintS(const char *s)
Definition: reporter.cc:294
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
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 (((p_GetComp(p,r) == ko)
33  &&(p_LmIsConstantComp(p, r)))
34  || ((!n_IsOne(pGetCoeff(p),C))
35  && (!n_IsMOne(pGetCoeff(p),C))
36  )
37  )
38  {
39  if( bNotShortOut )
41  else
43 
44  wroteCoef=(bNotShortOut)
45  || (rParameter(r)!=NULL)
47  writeGen=TRUE;
48  }
49  else if (n_IsMOne(pGetCoeff(p),C))
50  {
51  if (n_GreaterZero(pGetCoeff(p),C))
52  {
53  if( bNotShortOut )
55  else
57 
58  wroteCoef=(bNotShortOut)
59  || (rParameter(r)!=NULL)
61  writeGen=TRUE;
62  }
63  else
64  StringAppendS("-");
65  }
66 
67  int i;
68  for (i=0; i<rVar(r); i++)
69  {
70  {
71  long ee = p_GetExp(p,i+1,r);
72  if (ee!=0L)
73  {
74  if (wroteCoef)
75  StringAppendS("*");
76  //else
77  wroteCoef=(bNotShortOut);
78  writeGen=TRUE;
80  if (ee != 1L)
81  {
82  if (bNotShortOut) StringAppendS("^");
83  StringAppend("%ld", ee);
84  }
85  }
86  }
87  }
88  //StringAppend("{%d}",p->Order);
89  if (p_GetComp(p, r) != (long)ko)
90  {
91  if (writeGen) StringAppendS("*");
92  StringAppend("gen(%d)", p_GetComp(p, r));
93  }
94 }
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 &#39;n&#39; represents the one element.
Definition: coeffs.h:469
static BOOLEAN rField_is_R(const ring r)
Definition: ring.h:467
#define p_GetComp(p, r)
Definition: monomials.h:72
static BOOLEAN rShortOut(const ring r)
Definition: ring.h:529
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
#define TRUE
Definition: auxiliary.h:144
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:573
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:525
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:494
#define NULL
Definition: omList.c:10
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:491
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the additive inverse of the one element, i.e. -1.
Definition: coeffs.h:473
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:495
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:589
static FORCE_INLINE void n_WriteLong(number &n, const coeffs r)
write to the output buffer of the currently used reporter
Definition: coeffs.h:584