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