flintcf_Zn.cc
Go to the documentation of this file.
1 /****************************************
2 * Computer Algebra System SINGULAR *
3 ****************************************/
4 /*
5 * ABSTRACT: flint: nmod_poly_t
6 */
7 #include <ctype.h> /* isdigit*/
8 
9 #include <misc/auxiliary.h>
10 
11 #ifdef HAVE_FLINT
12 
13 #include <flint/flint.h>
14 #include <flint/nmod_poly.h>
15 #include <factory/factory.h>
16 
17 #include <omalloc/omalloc.h>
18 #include <coeffs/coeffs.h>
19 
20 #include <coeffs/numbers.h>
21 #include <coeffs/longrat.h>
22 #include <coeffs/modulop.h>
23 #include <coeffs/flintcf_Zn.h>
24 
25 typedef nmod_poly_struct *nmod_poly_ptr;
26 
27 /*2
28 * extracts a long integer from s, returns the rest
29 */
30 static const char* Eati(const char *s, int *i)
31 {
32 
33  if (((*s) >= '0') && ((*s) <= '9'))
34  {
35  unsigned long ii=0L;
36  do
37  {
38  ii *= 10;
39  ii += *s++ - '0';
40  }
41  while (((*s) >= '0') && ((*s) <= '9'));
42  *i=(int)ii;
43  }
44  else (*i) = 1;
45  return s;
46 }
47 
48 
49 
50 static char CoeffName_flint_Zn[20];
51 static void CoeffWrite(const coeffs r, BOOLEAN details)
52 {
53  Print("// coefficients: flint:Z/%d[%s]\n",r->ch,r->pParameterNames[0]);
54 }
55 static BOOLEAN CoeffIsEqual(const coeffs r, n_coeffType n, void * parameter)
56 {
57  flintZn_struct *pp=(flintZn_struct*)parameter;
58  return (r->type==n) &&(r->ch==pp->ch)
59  &&(r->pParameterNames!=NULL)
60  &&(strcmp(r->pParameterNames[0],pp->name)==0);
61 }
62 static void KillChar(coeffs r)
63 {
64  // not yet
65 }
66 static void SetChar(const coeffs r)
67 {
68  // dummy
69 }
70 static number Mult(number a, number b, const coeffs c)
71 {
72  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(*res));
73  nmod_poly_init(res,c->ch);
74  nmod_poly_mul(res,(nmod_poly_ptr)a,(nmod_poly_ptr)b);
75  return (number)res;
76 }
77 static number Sub(number a, number b, const coeffs c)
78 {
79  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
80  nmod_poly_init(res,c->ch);
81  nmod_poly_sub(res,(nmod_poly_ptr)a,(nmod_poly_ptr)b);
82  return (number)res;
83 }
84 static number Add(number a, number b, const coeffs c)
85 {
86  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
87  nmod_poly_init(res,c->ch);
88  nmod_poly_add(res,(nmod_poly_ptr)a,(nmod_poly_ptr)b);
89  return (number)res;
90 }
91 static number Div(number a, number b, const coeffs c)
92 {
93  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
94  nmod_poly_init(res,c->ch);
95  if(nmod_poly_is_zero((nmod_poly_ptr)b))
96  {
98  }
99  else
100  {
101  nmod_poly_div(res,(nmod_poly_ptr)a,(nmod_poly_ptr)b);
102  nmod_poly_t mod;
103  nmod_poly_init(mod,c->ch);
104  nmod_poly_rem(mod,(nmod_poly_ptr)a,(nmod_poly_ptr)b);
105  if (!nmod_poly_is_zero((nmod_poly_ptr)mod))
106  {
107  WerrorS("cannot divide");
108  }
109  nmod_poly_clear(mod);
110  }
111  return (number)res;
112 }
113 static number ExactDiv(number a, number b, const coeffs c)
114 {
115  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
116  nmod_poly_init(res,c->ch);
117  if(nmod_poly_is_zero((nmod_poly_ptr)b))
118  {
119  WerrorS(nDivBy0);
120  }
121  else
122  nmod_poly_div(res,(nmod_poly_ptr)a,(nmod_poly_ptr)b);
123  return (number)res;
124 }
125 static number IntMod(number a, number b, const coeffs c)
126 {
127  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
128  nmod_poly_init(res,c->ch);
129  nmod_poly_rem(res,(nmod_poly_ptr)a,(nmod_poly_ptr)b);
130  return (number)res;
131 }
132 static number Init (long i, const coeffs r)
133 {
134  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
135  nmod_poly_init(res,r->ch);
136  i= i%r->ch;
137  if (i<0) i+=r->ch;
138  nmod_poly_set_coeff_ui(res,0,i);
139  return (number)res;
140 }
141 static number InitMPZ (mpz_t i, const coeffs r)
142 {
143  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
144  nmod_poly_init(res,r->ch);
145  mpz_t tmp;
146  mpz_init(tmp);
147  slong ii=mpz_mod_ui(tmp,i,r->ch);
148  mpz_clear(tmp);
149  nmod_poly_set_coeff_ui(res,0,ii);
150  return (number)res;
151 }
152 static int Size (number n, const coeffs r)
153 {
154  return nmod_poly_degree((nmod_poly_ptr)n);
155 }
156 static long Int (number &n, const coeffs r)
157 {
158  if (nmod_poly_degree((nmod_poly_ptr)n)==0)
159  {
160  slong m;
161  m=nmod_poly_get_coeff_ui((nmod_poly_ptr)n,0);
162  return (long)m;
163  }
164  return 0;
165 }
166 static void MPZ(mpz_t result, number &n, const coeffs r)
167 {
168  mpz_init(result);
169  if (nmod_poly_degree((nmod_poly_ptr)n)==0)
170  {
171  slong m;
172  m=nmod_poly_get_coeff_ui((nmod_poly_ptr)n,0);
173  mpz_set_ui(result,m);
174  }
175 }
176 static number Neg(number a, const coeffs r)
177 {
178  nmod_poly_neg((nmod_poly_ptr)a,(nmod_poly_ptr)a);
179  return a;
180 }
181 static number Invers(number a, const coeffs r)
182 {
183  if(nmod_poly_is_zero((nmod_poly_ptr)a))
184  {
185  WerrorS(nDivBy0);
186  return NULL;
187  }
188  if (nmod_poly_degree((nmod_poly_ptr)a)==0)
189  {
190  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
191  nmod_poly_init(res,r->ch);
192  slong c=nmod_poly_get_coeff_ui((nmod_poly_ptr)a,0);
193  extern number nvInvers (number c, const coeffs r);
194  c=(slong)nvInvers((number)c,r);
195  nmod_poly_set_coeff_ui((nmod_poly_ptr)a,0,c);
196  return (number)res;
197  }
198  else
199  {
200  WerrorS("not invertable");
201  return NULL;
202  }
203 }
204 static number Copy(number a, const coeffs r)
205 {
206  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
207  nmod_poly_init(res,r->ch);
208  nmod_poly_set(res,(nmod_poly_ptr)a);
209  return (number)res;
210 }
211 //static number RePart(number a, const coeffs r)
212 //{
213 //}
214 //static number ImPart(number a, const coeffs r)
215 //{
216 //}
217 static BOOLEAN IsOne (number a, const coeffs r);
218 static BOOLEAN IsZero (number a, const coeffs r);
219 //static void WriteLong(number &a, const coeffs r)
220 //{
221 //}
222 static void WriteShort(number a, const coeffs r)
223 {
224  //nmod_poly_print_pretty((nmod_poly_ptr)a,r->pParameterNames[0]);
225  if (IsOne(a,r)) StringAppendS("1");
226  else if (IsZero(a,r)) StringAppendS("0");
227  else
228  {
229  StringAppendS("(");
230  BOOLEAN need_plus=FALSE;
231  for(int i=nmod_poly_length((nmod_poly_ptr)a);i>=0;i--)
232  {
233  slong m=nmod_poly_get_coeff_ui((nmod_poly_ptr)a,i);
234  if (m!=0)
235  {
236  if (need_plus) StringAppendS("+");
237  need_plus=TRUE;
238  if (i>0)
239  {
240  if (m!=1) StringAppend("%d*",(int)m);
241  if (i>1)
242  StringAppend("%s^%d",r->pParameterNames[0],i);
243  else if (i==1)
244  StringAppend("%s",r->pParameterNames[0]);
245  }
246  else StringAppend("%d",(int)m);
247  }
248  }
249  StringAppendS(")");
250  }
251 }
252 static const char* Read(const char * st, number * a, const coeffs r)
253 {
254 // we only read "monomials" (i.e. [-][digits][parameter]),
255 // everythings else (+,*,^,()) is left to the singular interpreter
256  const char *s=st;
257  *a=(number)omAlloc(sizeof(nmod_poly_t));
258  nmod_poly_init((nmod_poly_ptr)(*a),r->ch);
259  BOOLEAN neg=FALSE;
260  if (*s=='-') { neg=TRUE; s++;}
261  if (isdigit(*s))
262  {
263  int z;
264  s=Eati((char *)s, &z);
265  nmod_poly_set_coeff_ui((nmod_poly_ptr)(*a),0,z);
266  }
267  else if(strncmp(s,r->pParameterNames[0],strlen(r->pParameterNames[0]))==0)
268  {
269  nmod_poly_set_coeff_ui((nmod_poly_ptr)(*a),1,1);
270  s+=strlen(r->pParameterNames[0]);
271  if(isdigit(*s))
272  {
273  int i=1;
274  s=Eati(s,&i);
275  if (i!=1)
276  {
277  nmod_poly_set_coeff_ui((nmod_poly_ptr)(*a),1,0);
278  nmod_poly_set_coeff_ui((nmod_poly_ptr)(*a),i,1);
279  }
280  }
281  }
282  if (neg)
283  nmod_poly_neg((nmod_poly_ptr)(*a),(nmod_poly_ptr)(*a));
284  return s;
285 }
286 static void Normalize(number &a, const coeffs r)
287 {
288 }
289 static BOOLEAN Greater (number a, number b, const coeffs r)
290 {
291  if (nmod_poly_length((nmod_poly_ptr)a)>nmod_poly_length((nmod_poly_ptr)b))
292  return TRUE;
293  else if (nmod_poly_length((nmod_poly_ptr)a)<nmod_poly_length((nmod_poly_ptr)b))
294  return FALSE;
295  for(int i=nmod_poly_length((nmod_poly_ptr)a);i>=0;i--)
296  {
297  slong ac=nmod_poly_get_coeff_ui((nmod_poly_ptr)a,i);
298  slong bc=nmod_poly_get_coeff_ui((nmod_poly_ptr)b,i);
299  if (ac>bc) return TRUE;
300  else if (ac<bc) return FALSE;
301  }
302  return FALSE;
303 }
304 static BOOLEAN Equal (number a, number b, const coeffs r)
305 {
306  return (nmod_poly_equal((nmod_poly_ptr)a,(nmod_poly_ptr)b));
307 }
308 static BOOLEAN IsZero (number a, const coeffs r)
309 {
310  return nmod_poly_is_zero((nmod_poly_ptr)a);
311 }
312 static BOOLEAN IsOne (number a, const coeffs r)
313 {
314  return nmod_poly_is_one((nmod_poly_ptr)a);
315 }
316 static BOOLEAN IsMOne (number k, const coeffs r)
317 {
318  if (nmod_poly_length((nmod_poly_ptr)k)>0) return FALSE;
319  slong m=nmod_poly_get_coeff_ui((nmod_poly_ptr)k,0);
320  return (m+1==r->ch);
321 }
322 static BOOLEAN GreaterZero (number k, const coeffs r)
323 {
324  // does it have a leading sign?
325  // no: 0 and 1 do not have, everything else is in (...)
326  return TRUE;
327 }
328 static void Power(number a, int i, number * result, const coeffs r)
329 {
330  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
331  nmod_poly_init(res,r->ch);
332  *result=(number)res;
333  nmod_poly_pow((nmod_poly_ptr)(*result),(nmod_poly_ptr)a,i);
334 }
335 static number Gcd(number a, number b, const coeffs r)
336 {
337  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
338  nmod_poly_init(res,r->ch);
339  nmod_poly_gcd(res,(nmod_poly_ptr)a,(nmod_poly_ptr)b);
340  return (number)res;
341 }
342 static number ExtGcd(number a, number b, number *s, number *t,const coeffs r)
343 {
344  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
345  nmod_poly_init(res,r->ch);
346  nmod_poly_init((nmod_poly_ptr)*s,r->ch);
347  nmod_poly_init((nmod_poly_ptr)*t,r->ch);
348  nmod_poly_xgcd(res,(nmod_poly_ptr)*s,(nmod_poly_ptr)*t,(nmod_poly_ptr)a,(nmod_poly_ptr)b);
349  return (number)res;
350 }
351 static number Lcm(number a, number b, const coeffs r)
352 {
353  WerrorS("not yet: Lcm");
354 }
355 static void Delete(number * a, const coeffs r)
356 {
357  if ((*a)!=NULL)
358  {
360  omFree(*a);
361  *a=NULL;
362  }
363 }
364 static nMapFunc SetMap(const coeffs src, const coeffs dst)
365 {
366  WerrorS("not yet: SetMap");
367  return NULL;
368 }
369 //static void InpMult(number &a, number b, const coeffs r)
370 //{
371 //}
372 //static void InpAdd(number &a, number b, const coeffs r)
373 //{
374 //}
375 static number Init_bigint(number i, const coeffs dummy, const coeffs dst)
376 {
377  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
378  nmod_poly_init(res,dst->ch);
379  long ii;
380  if (SR_HDL(i) & SR_INT)
381  {
382  ii=SR_TO_INT(i) % dst->ch;
383  }
384  else
385  {
386  mpz_t tmp;
387  mpz_init(tmp);
388  ii=mpz_mod_ui(tmp,i->z,dst->ch);
389  mpz_clear(tmp);
390  }
391  if (ii<0) ii+=dst->ch;
392  nmod_poly_set_coeff_ui(res,0,ii);
393  return (number)res;
394 }
395 static number Farey(number p, number n, const coeffs)
396 {
397  WerrorS("not yet: Farey");
398 }
399 static number ChineseRemainder(number *x, number *q,int rl, BOOLEAN sym,CFArray &inv_cache,const coeffs)
400 {
401  WerrorS("not yet: ChineseRemainder");
402 }
403 static int ParDeg(number x,const coeffs r)
404 {
405  return nmod_poly_degree((nmod_poly_ptr)x);
406 }
407 static number Parameter(const int i, const coeffs r)
408 {
409  nmod_poly_ptr res=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
410  nmod_poly_init(res,r->ch);
411  nmod_poly_set_coeff_ui(res,1,1);
412  return (number)res;
413 }
414 // cfClearContent
415 // cfClearDenominators
416 static number ConvFactoryNSingN( const CanonicalForm n, const coeffs r)
417 {
418 }
419 static CanonicalForm ConvSingNFactoryN( number n, BOOLEAN setChar, const coeffs r )
420 {
421  WerrorS("not yet: ConvSingNFactoryN");
422 }
423 static char * CoeffName(const coeffs r)
424 {
425  sprintf(CoeffName_flint_Zn,"flint:Z/%d[%s]",r->ch,r->pParameterNames[0]);
426  return (char*)CoeffName_flint_Zn;
427 }
428 static char* CoeffString(const coeffs r)
429 {
430  char *buf=(char*)omAlloc(12+10 /*ch*/+strlen(r->pParameterNames[0]));
431  sprintf(buf,"flintZ(%d,\"%s\")",r->ch,r->pParameterNames[0]);
432  return buf;
433 }
434 static void WriteFd(number a, FILE *f, const coeffs)
435 {
436  // format: len a_len .. a_0
438  int l=nmod_poly_length(aa);
439  fprintf(f,"%d ",l);
440  for(int i=l; i>=0; i--)
441  {
442  ulong ul=nmod_poly_get_coeff_ui(aa,i);
443  fprintf(f,"%lu ", ul);
444  }
445 }
446 static number ReadFd(s_buff f, const coeffs r)
447 {
448  // format: len a_len .. a_0
449  nmod_poly_ptr aa=(nmod_poly_ptr)omAlloc(sizeof(nmod_poly_t));
450  nmod_poly_init(aa,r->ch);
451  int l=s_readint(f);
452  unsigned long ul;
453  for (int i=l;i>=0;i--)
454  {
455  unsigned long ul=s_readlong(f);
456  nmod_poly_set_coeff_ui(aa,i,ul);
457  }
458  return (number)aa;
459 }
460 #ifdef LDEBUG
461 static BOOLEAN DBTest(number a, const char *f, const int l, const coeffs r)
462 {
463  return TRUE;
464 }
465 #endif
466 BOOLEAN flintZn_InitChar(coeffs cf, void * infoStruct)
467 {
468  flintZn_struct *pp=(flintZn_struct*)infoStruct;
469  cf->ch=pp->ch;
470 
471  cf->cfCoeffString = CoeffString;
472  cf->cfCoeffName = CoeffName;
473  cf->cfCoeffWrite = CoeffWrite;
474  cf->nCoeffIsEqual = CoeffIsEqual;
475  cf->cfKillChar = KillChar;
476  cf->cfSetChar = SetChar;
477  cf->cfMult = Mult;
478  cf->cfSub = Sub;
479  cf->cfAdd = Add;
480  cf->cfDiv = Div;
481  cf->cfExactDiv = ExactDiv; // ???
482  cf->cfInit =Init;
483  cf->cfInitMPZ =InitMPZ;
484  cf->cfSize = Size;
485  cf->cfInt = Int;
486  cf->cfMPZ = MPZ;
487  cf->cfInpNeg = Neg;
488  cf->cfInvers = Invers;
489  cf->cfCopy = Copy;
490  cf->cfRePart = Copy;
491  // default: cf->cfImPart = ndReturn0;
492  cf->cfWriteLong = WriteShort; //WriteLong;
493  cf->cfWriteShort = WriteShort;
494  cf->cfRead = Read;
495  cf->cfNormalize = Normalize;
496 
497  //cf->cfDivComp=
498  //cf->cfIsUnit=
499  //cf->cfGetUnit=
500  //cf->cfDivBy=
501 
502  cf->cfGreater=Greater;
503  cf->cfEqual =Equal;
504  cf->cfIsZero =IsZero;
505  cf->cfIsOne =IsOne;
506  cf->cfIsMOne =IsMOne;
507  cf->cfGreaterZero=GreaterZero;
508 
509  cf->cfPower = Power;
510  //default: cf->cfGetDenom = GetDenom;
511  //default: cf->cfGetNumerator = GetNumerator;
512  cf->cfGcd = Gcd;
513  cf->cfExtGcd = ExtGcd;
514  cf->cfLcm = Lcm;
515  cf->cfDelete = Delete;
516  cf->cfSetMap = SetMap;
517  // default: cf->cfInpMult
518  // default: cf->cfInpAdd
519  cf->cfFarey =Farey;
520  cf->cfChineseRemainder=ChineseRemainder;
521  cf->cfParDeg = ParDeg;
522  cf->cfParameter = Parameter;
523  // cf->cfClearContent = ClearContent;
524  // cf->cfClearDenominators = ClearDenominators;
525  cf->convFactoryNSingN=ConvFactoryNSingN;
526  cf->convSingNFactoryN=ConvSingNFactoryN;
527  cf->cfWriteFd = WriteFd;
528  cf->cfReadFd = ReadFd;
529 #ifdef LDEBUG
530  cf->cfDBTest = DBTest;
531 #endif
532 
533  cf->iNumberOfParameters = 1;
534  char **pn=(char**)omAlloc0(sizeof(char*));
535  pn[0]=(char*)omStrDup(pp->name);
536  cf->pParameterNames = (const char **)pn;
537  cf->has_simple_Inverse= FALSE;
538  cf->has_simple_Alloc= FALSE;
539  cf->is_field=FALSE;
540 
541  return FALSE;
542 }
543 #endif
static void WriteShort(number a, const coeffs r)
Definition: flintcf_Zn.cc:222
static number Mult(number a, number b, const coeffs c)
Definition: flintcf_Zn.cc:70
nmod_poly_init(FLINTmipo, getCharacteristic())
const CanonicalForm int s
Definition: facAbsFact.cc:55
static void KillChar(coeffs r)
Definition: flintcf_Zn.cc:62
const poly a
Definition: syzextra.cc:212
static number Sub(number a, number b, const coeffs c)
Definition: flintcf_Zn.cc:77
#define Print
Definition: emacs.cc:83
static const char * Read(const char *st, number *a, const coeffs r)
Definition: flintcf_Zn.cc:252
static BOOLEAN DBTest(number a, const char *f, const int l, const coeffs r)
Definition: flintcf_Zn.cc:461
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
static number Init(long i, const coeffs r)
Definition: flintcf_Zn.cc:132
static void Delete(number *a, const coeffs r)
Definition: flintcf_Zn.cc:355
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
number nvInvers(number c, const coeffs r)
Definition: modulop.cc:897
f
Definition: cfModGcd.cc:4022
static number Lcm(number a, number b, const coeffs r)
Definition: flintcf_Zn.cc:351
static number Farey(number p, number n, const coeffs)
Definition: flintcf_Zn.cc:395
static number ExtGcd(number a, number b, number *s, number *t, const coeffs r)
Definition: flintcf_Zn.cc:342
factory&#39;s main class
Definition: canonicalform.h:75
#define TRUE
Definition: auxiliary.h:98
nmod_poly_clear(FLINTmipo)
static long Int(number &n, const coeffs r)
Definition: flintcf_Zn.cc:156
static BOOLEAN IsOne(number a, const coeffs r)
Definition: flintcf_Zn.cc:312
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:93
static BOOLEAN CoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition: flintcf_Zn.cc:55
static number InitMPZ(mpz_t i, const coeffs r)
Definition: flintcf_Zn.cc:141
#define omAlloc(size)
Definition: omAllocDecl.h:210
static const char * Eati(const char *s, int *i)
Definition: flintcf_Zn.cc:30
static number IntMod(number a, number b, const coeffs c)
Definition: flintcf_Zn.cc:125
static number Init_bigint(number i, const coeffs dummy, const coeffs dst)
Definition: flintcf_Zn.cc:375
poly pp
Definition: myNF.cc:296
poly res
Definition: myNF.cc:322
nmod_poly_struct * nmod_poly_ptr
Definition: flintcf_Zn.cc:25
static number ReadFd(s_buff f, const coeffs r)
Definition: flintcf_Zn.cc:446
const ring r
Definition: syzextra.cc:208
Coefficient rings, fields and other domains suitable for Singular polynomials.
static BOOLEAN Greater(number a, number b, const coeffs r)
Definition: flintcf_Zn.cc:289
int s_readint(s_buff F)
Definition: s_buff.cc:110
static char CoeffName_flint_Zn[20]
Definition: flintcf_Zn.cc:50
#define omFree(addr)
Definition: omAllocDecl.h:261
static int Size(number n, const coeffs r)
Definition: flintcf_Zn.cc:152
static void Normalize(number &a, const coeffs r)
Definition: flintcf_Zn.cc:286
The main handler for Singular numbers which are suitable for Singular polynomials.
int status int void * buf
Definition: si_signals.h:59
void StringAppendS(const char *st)
Definition: reporter.cc:107
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
static int ParDeg(number x, const coeffs r)
Definition: flintcf_Zn.cc:403
static void Power(number a, int i, number *result, const coeffs r)
Definition: flintcf_Zn.cc:328
All the auxiliary stuff.
int m
Definition: cfEzgcd.cc:119
const char *const nDivBy0
Definition: numbers.h:83
static void WriteFd(number a, FILE *f, const coeffs)
Definition: flintcf_Zn.cc:434
#define StringAppend
Definition: emacs.cc:82
int i
Definition: cfEzgcd.cc:123
static number ChineseRemainder(number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs)
Definition: flintcf_Zn.cc:399
static void CoeffWrite(const coeffs r, BOOLEAN details)
Definition: flintcf_Zn.cc:51
static BOOLEAN GreaterZero(number k, const coeffs r)
Definition: flintcf_Zn.cc:322
#define SR_TO_INT(SR)
Definition: longrat.h:70
static number Neg(number a, const coeffs r)
Definition: flintcf_Zn.cc:176
BOOLEAN flintZn_InitChar(coeffs cf, void *infoStruct)
Definition: flintcf_Zn.cc:466
static number Parameter(const int i, const coeffs r)
Definition: flintcf_Zn.cc:407
n_coeffType
Definition: coeffs.h:27
CanonicalForm cf
Definition: cfModGcd.cc:4024
static number ConvFactoryNSingN(const CanonicalForm n, const coeffs r)
Definition: flintcf_Zn.cc:416
static BOOLEAN IsZero(number a, const coeffs r)
Definition: flintcf_Zn.cc:308
#define NULL
Definition: omList.c:10
#define SR_INT
Definition: longrat.h:68
static char * CoeffName(const coeffs r)
Definition: flintcf_Zn.cc:423
Variable x
Definition: cfModGcd.cc:4023
static char * CoeffString(const coeffs r)
Definition: flintcf_Zn.cc:428
long s_readlong(s_buff F)
Definition: s_buff.cc:138
static BOOLEAN IsMOne(number k, const coeffs r)
Definition: flintcf_Zn.cc:316
static number Add(number a, number b, const coeffs c)
Definition: flintcf_Zn.cc:84
static void MPZ(mpz_t result, number &n, const coeffs r)
Definition: flintcf_Zn.cc:166
static number Div(number a, number b, const coeffs c)
Definition: flintcf_Zn.cc:91
#define SR_HDL(A)
Definition: tgb.cc:35
#define slong
static number Invers(number a, const coeffs r)
Definition: flintcf_Zn.cc:181
int BOOLEAN
Definition: auxiliary.h:85
static number Gcd(number a, number b, const coeffs r)
Definition: flintcf_Zn.cc:335
const poly b
Definition: syzextra.cc:213
static CanonicalForm ConvSingNFactoryN(number n, BOOLEAN setChar, const coeffs r)
Definition: flintcf_Zn.cc:419
static void SetChar(const coeffs r)
Definition: flintcf_Zn.cc:66
static number ExactDiv(number a, number b, const coeffs c)
Definition: flintcf_Zn.cc:113
static nMapFunc SetMap(const coeffs src, const coeffs dst)
Definition: flintcf_Zn.cc:364
#define omAlloc0(size)
Definition: omAllocDecl.h:211
static number Copy(number a, const coeffs r)
Definition: flintcf_Zn.cc:204
int l
Definition: cfEzgcd.cc:94
return result
Definition: facAbsBiFact.cc:76
static BOOLEAN Equal(number a, number b, const coeffs r)
Definition: flintcf_Zn.cc:304
#define omStrDup(s)
Definition: omAllocDecl.h:263