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