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