NTLconvert.cc
Go to the documentation of this file.
1 
2 #include "config.h"
3 
4 
5 #include "cf_assert.h"
6 
7 #include "cf_defs.h"
8 #include "canonicalform.h"
9 #include "cf_iter.h"
10 #include "fac_sqrfree.h"
11 #include "cf_algorithm.h"
12 
13 #include <factory/cf_gmp.h>
14 
15 #ifdef HAVE_NTL
16 #ifndef NOSTREAMIO
17 #ifdef HAVE_CSTDIO
18 #include <cstdio>
19 #else
20 #include <stdio.h>
21 #endif
22 #endif
23 #include <string.h>
24 #include <NTL/ZZXFactoring.h>
25 #include <NTL/ZZ_pXFactoring.h>
26 #include <NTL/lzz_pXFactoring.h>
27 #include <NTL/GF2XFactoring.h>
28 #include <NTL/ZZ_pEXFactoring.h>
29 #include <NTL/lzz_pEXFactoring.h>
30 #include <NTL/GF2EXFactoring.h>
31 #include <NTL/tools.h>
32 #include <NTL/mat_ZZ.h>
33 #include <NTL/version.h>
34 #include "int_int.h"
35 #include <limits.h>
36 #include "NTLconvert.h"
37 
38 #define Alloc(L) malloc(L)
39 #define Free(A,L) free(A)
40 
41 void out_cf(const char *s1,const CanonicalForm &f,const char *s2);
42 
43 
44 long fac_NTL_char = -1; // the current characterstic for NTL calls
45  // -1: undefined
46 #ifdef NTL_CLIENT // in <NTL/tools.h>: using of name space NTL
47 NTL_CLIENT
48 #endif
49 
50 ////////////////////////////////////////////////////////////////////////////////
51 /// NAME: convertFacCF2NTLZZpX
52 ///
53 /// DESCRIPTION:
54 /// Conversion routine for Factory-type canonicalform into ZZpX of NTL,
55 /// i.e. polynomials over F_p. As a precondition for correct execution,
56 /// the characteristic has to a a prime number.
57 ///
58 /// INPUT: A canonicalform f
59 /// OUTPUT: The converted NTL-polynomial over F_p of type ZZpX
60 ////////////////////////////////////////////////////////////////////////////////
61 
63 {
64  ZZ_pX ntl_poly;
65 
66  CFIterator i;
67  i=f;
68 
69  int NTLcurrentExp=i.exp();
70  int largestExp=i.exp();
71  int k;
72 
73  // we now build up the NTL-polynomial
74  ntl_poly.SetMaxLength(largestExp+1);
75 
76  for (;i.hasTerms();i++)
77  {
78  for (k=NTLcurrentExp;k>i.exp();k--)
79  {
80  SetCoeff(ntl_poly,k,0);
81  }
82  NTLcurrentExp=i.exp();
83 
84  SetCoeff(ntl_poly,NTLcurrentExp,to_ZZ_p (convertFacCF2NTLZZ (i.coeff())));
85  NTLcurrentExp--;
86  }
87 
88  //Set the remaining coefficients of ntl_poly to zero.
89  // This is necessary, because NTL internally
90  // also stores powers with zero coefficient,
91  // whereas factory stores tuples of degree and coefficient
92  //leaving out tuples if the coefficient equals zero
93  for (k=NTLcurrentExp;k>=0;k--)
94  {
95  SetCoeff(ntl_poly,k,0);
96  }
97 
98  //normalize the polynomial and return it
99  ntl_poly.normalize();
100 
101  return ntl_poly;
102 }
104 {
105  zz_pX ntl_poly;
106 
107  CFIterator i;
108  i=f;
109 
110  int NTLcurrentExp=i.exp();
111  int largestExp=i.exp();
112  int k;
113 
114  // we now build up the NTL-polynomial
115  ntl_poly.SetMaxLength(largestExp+1);
116 
117  for (;i.hasTerms();i++)
118  {
119  for (k=NTLcurrentExp;k>i.exp();k--)
120  {
121  SetCoeff(ntl_poly,k,0);
122  }
123  NTLcurrentExp=i.exp();
124 
125  CanonicalForm c=i.coeff();
126  if (!c.isImm()) c=c.mapinto(); //c%= getCharacteristic();
127  if (!c.isImm())
128  { //This case will never happen if the characteristic is in fact a prime
129  // number, since all coefficients are represented as immediates
130  #ifndef NOSTREAMIO
131  cout<<"convertFacCF2NTLzz_pX: coefficient not immediate! : "<<f<<"\n";
132  #else
133  //NTL_SNS
134  printf("convertFacCF2NTLzz_pX: coefficient not immediate!, char=%d\n",
136  #endif
137  NTL_SNS exit(1);
138  }
139  else
140  {
141  SetCoeff(ntl_poly,NTLcurrentExp,c.intval());
142  }
143  NTLcurrentExp--;
144  }
145 
146  //Set the remaining coefficients of ntl_poly to zero.
147  // This is necessary, because NTL internally
148  // also stores powers with zero coefficient,
149  // whereas factory stores tuples of degree and coefficient
150  //leaving out tuples if the coefficient equals zero
151  for (k=NTLcurrentExp;k>=0;k--)
152  {
153  SetCoeff(ntl_poly,k,0);
154  }
155 
156  //normalize the polynomial and return it
157  ntl_poly.normalize();
158 
159  return ntl_poly;
160 }
161 
162 ////////////////////////////////////////////////////////////////////////////////
163 /// NAME: convertFacCF2NTLGF2X
164 ///
165 /// DESCRIPTION:
166 /// Conversion routine for Factory-type canonicalform into GF2X of NTL,
167 /// i.e. polynomials over F_2. As precondition for correct execution,
168 /// the characteristic must equal two.
169 /// This is a special case of the more general conversion routine for
170 /// canonicalform to ZZpX. It is included because NTL provides additional
171 /// support and faster algorithms over F_2, moreover the conversion code
172 /// can be optimized, because certain steps are either completely obsolent
173 /// (like normalizing the polynomial) or they can be made significantly
174 /// faster (like building up the NTL-polynomial).
175 ///
176 /// INPUT: A canonicalform f
177 /// OUTPUT: The converted NTL-polynomial over F_2 of type GF2X
178 ////////////////////////////////////////////////////////////////////////////////
179 
181 {
182  //printf("convertFacCF2NTLGF2X\n");
183  GF2X ntl_poly;
184 
185  CFIterator i;
186  i=f;
187 
188  int NTLcurrentExp=i.exp();
189  int largestExp=i.exp();
190  int k;
191 
192  //building the NTL-polynomial
193  ntl_poly.SetMaxLength(largestExp+1);
194 
195  for (;i.hasTerms();i++)
196  {
197 
198  for (k=NTLcurrentExp;k>i.exp();k--)
199  {
200  SetCoeff(ntl_poly,k,0);
201  }
202  NTLcurrentExp=i.exp();
203 
204  if (!i.coeff().isImm()) i.coeff()=i.coeff().mapinto();
205  if (!i.coeff().isImm())
206  {
207  #ifndef NOSTREAMIO
208  cout<<"convertFacCF2NTLGF2X: coefficient not immediate! : " << f << "\n";
209  #else
210  //NTL_SNS
211  printf("convertFacCF2NTLGF2X: coefficient not immediate!");
212  #endif
213  NTL_SNS exit(1);
214  }
215  else
216  {
217  SetCoeff(ntl_poly,NTLcurrentExp,i.coeff().intval());
218  }
219  NTLcurrentExp--;
220  }
221  for (k=NTLcurrentExp;k>=0;k--)
222  {
223  SetCoeff(ntl_poly,k,0);
224  }
225  //normalization is not necessary of F_2
226 
227  return ntl_poly;
228 }
229 
230 
231 ////////////////////////////////////////////////////////////////////////////////
232 /// NAME: convertNTLZZpX2CF
233 ///
234 /// DESCRIPTION:
235 /// Conversion routine for NTL-Type ZZpX to Factory-Type canonicalform.
236 /// Additionally a variable x is needed as a parameter indicating the
237 /// main variable of the computed canonicalform. To guarantee the correct
238 /// execution of the algorithm, the characteristic has a be an arbitrary
239 /// prime number.
240 ///
241 /// INPUT: A canonicalform f, a variable x
242 /// OUTPUT: The converted Factory-polynomial of type canonicalform,
243 /// built by the main variable x
244 ////////////////////////////////////////////////////////////////////////////////
245 
247 {
248  return convertNTLZZX2CF (to_ZZX (poly), x);
249 }
250 
252 {
253  //printf("convertNTLzzpX2CF\n");
254  CanonicalForm bigone;
255 
256 
257  if (deg(poly)>0)
258  {
259  // poly is non-constant
260  bigone=0;
261  bigone.mapinto();
262  // Compute the canonicalform coefficient by coefficient,
263  // bigone summarizes the result.
264  for (int j=0;j<=deg(poly);j++)
265  {
266  if (coeff(poly,j)!=0)
267  {
268  bigone+=(power(x,j)*CanonicalForm(to_long(rep(coeff(poly,j)))));
269  }
270  }
271  }
272  else
273  {
274  // poly is immediate
275  bigone=CanonicalForm(to_long(rep(coeff(poly,0))));
276  bigone.mapinto();
277  }
278  return bigone;
279 }
280 
281 CanonicalForm convertNTLZZX2CF(const ZZX & polynom,const Variable & x)
282 {
283  //printf("convertNTLZZX2CF\n");
284  CanonicalForm bigone;
285 
286  // Go through the vector e and build up the CFFList
287  // As usual bigone summarizes the result
288  bigone=0;
289  ZZ coefficient;
290 
291  for (int j=0;j<=deg(polynom);j++)
292  {
293  coefficient=coeff(polynom,j);
294  if (!IsZero(coefficient))
295  {
296  bigone += (power(x,j)*convertZZ2CF(coefficient));
297  }
298  }
299  return bigone;
300 }
301 
302 ////////////////////////////////////////////////////////////////////////////////
303 /// NAME: convertNTLGF2X2CF
304 ///
305 /// DESCRIPTION:
306 /// Conversion routine for NTL-Type GF2X to Factory-Type canonicalform,
307 /// the routine is again an optimized special case of the more general
308 /// conversion to ZZpX. Additionally a variable x is needed as a
309 /// parameter indicating the main variable of the computed canonicalform.
310 /// To guarantee the correct execution of the algorithm the characteristic
311 /// has a be an arbitrary prime number.
312 ///
313 /// INPUT: A canonicalform f, a variable x
314 /// OUTPUT: The converted Factory-polynomial of type canonicalform,
315 /// built by the main variable x
316 ////////////////////////////////////////////////////////////////////////////////
317 
319 {
320  //printf("convertNTLGF2X2CF\n");
321  CanonicalForm bigone;
322 
323  if (deg(poly)>0)
324  {
325  // poly is non-constant
326  bigone=0;
327  bigone.mapinto();
328  // Compute the canonicalform coefficient by coefficient,
329  // bigone summarizes the result.
330  // In constrast to the more general conversion to ZZpX
331  // the only possible coefficients are zero
332  // and one yielding the following simplified loop
333  for (int j=0;j<=deg(poly);j++)
334  {
335  if (coeff(poly,j)!=0) bigone+=power(x,j);
336  // *CanonicalForm(to_long(rep(coeff(poly,j))))) is not necessary any more;
337  }
338  }
339  else
340  {
341  // poly is immediate
342  bigone=CanonicalForm(to_long(rep(coeff(poly,0))));
343  bigone.mapinto();
344  }
345 
346  return bigone;
347 }
348 
349 ////////////////////////////////////////////////////////////////////////////////
350 /// NAME: convertNTLvec_pair_ZZpX_long2FacCFFList
351 ///
352 /// DESCRIPTION:
353 /// Routine for converting a vector of polynomials from ZZpX to
354 /// a CFFList of Factory. This routine will be used after a successful
355 /// factorization of NTL to convert the result back to Factory.
356 ///
357 /// Additionally a variable x and the computed multiplicity, as a type ZZp
358 /// of NTL, is needed as parameters indicating the main variable of the
359 /// computed canonicalform and the multiplicity of the original polynomial.
360 /// To guarantee the correct execution of the algorithm the characteristic
361 /// has a be an arbitrary prime number.
362 ///
363 /// INPUT: A vector of polynomials over ZZp of type vec_pair_ZZ_pX_long and
364 /// a variable x and a multiplicity of type ZZp
365 /// OUTPUT: The converted list of polynomials of type CFFList, all polynomials
366 /// have x as their main variable
367 ////////////////////////////////////////////////////////////////////////////////
368 
370  (const vec_pair_ZZ_pX_long & e,const ZZ_p & multi,const Variable & x)
371 {
372  //printf("convertNTLvec_pair_ZZpX_long2FacCFFList\n");
373  CFFList result;
374  ZZ_pX polynom;
375  CanonicalForm bigone;
376 
377  // Maybe, e may additionally be sorted with respect to increasing degree of x
378  // but this is not
379  //important for the factorization, but nevertheless would take computing time,
380  // so it is omitted
381 
382 
383  // Go through the vector e and compute the CFFList
384  // again bigone summarizes the result
385  for (int i=e.length()-1;i>=0;i--)
386  {
387  result.append(CFFactor(convertNTLZZpX2CF(e[i].a,x),e[i].b));
388  }
389  // the multiplicity at pos 1
390  if (!IsOne(multi))
391  result.insert(CFFactor(CanonicalForm(to_long(rep(multi))),1));
392  return result;
393 }
395  (const vec_pair_zz_pX_long & e,const zz_p multi,const Variable & x)
396 {
397  //printf("convertNTLvec_pair_zzpX_long2FacCFFList\n");
398  CFFList result;
399  zz_pX polynom;
400  CanonicalForm bigone;
401 
402  // Maybe, e may additionally be sorted with respect to increasing degree of x
403  // but this is not
404  //important for the factorization, but nevertheless would take computing time,
405  // so it is omitted
406 
407 
408  // Go through the vector e and compute the CFFList
409  // again bigone summarizes the result
410  for (int i=e.length()-1;i>=0;i--)
411  {
412  result.append(CFFactor(convertNTLzzpX2CF(e[i].a,x),e[i].b));
413  }
414  // the multiplicity at pos 1
415  if (!IsOne(multi))
416  result.insert(CFFactor(CanonicalForm(to_long(rep(multi))),1));
417  return result;
418 }
419 
420 ////////////////////////////////////////////////////////////////////////////////
421 /// NAME: convertNTLvec_pair_GF2X_long2FacCFFList
422 ///
423 /// DESCRIPTION:
424 /// Routine for converting a vector of polynomials of type GF2X from
425 /// NTL to a list CFFList of Factory. This routine will be used after a
426 /// successful factorization of NTL to convert the result back to Factory.
427 /// As usual this is simply a special case of the more general conversion
428 /// routine but again speeded up by leaving out unnecessary steps.
429 /// Additionally a variable x and the computed multiplicity, as type
430 /// GF2 of NTL, are needed as parameters indicating the main variable of the
431 /// computed canonicalform and the multiplicity of the original polynomial.
432 /// To guarantee the correct execution of the algorithm the characteristic
433 /// has a be an arbitrary prime number.
434 ///
435 /// INPUT: A vector of polynomials over GF2 of type vec_pair_GF2X_long and
436 /// a variable x and a multiplicity of type GF2
437 /// OUTPUT: The converted list of polynomials of type CFFList, all
438 /// polynomials have x as their main variable
439 ////////////////////////////////////////////////////////////////////////////////
440 
442  (const vec_pair_GF2X_long& e, GF2 /*multi*/, const Variable & x)
443 {
444  //printf("convertNTLvec_pair_GF2X_long2FacCFFList\n");
445  CFFList result;
446  GF2X polynom;
447  long exponent;
448  CanonicalForm bigone;
449 
450  // Maybe, e may additionally be sorted with respect to increasing degree of x
451  // but this is not
452  //important for the factorization, but nevertheless would take computing time
453  // so it is omitted.
454 
455  //We do not have to worry about the multiplicity in GF2 since it equals one.
456 
457  // Go through the vector e and compute the CFFList
458  // bigone summarizes the result again
459  for (int i=e.length()-1;i>=0;i--)
460  {
461  bigone=0;
462 
463  polynom=e[i].a;
464  exponent=e[i].b;
465  for (int j=0;j<=deg(polynom);j++)
466  {
467  if (coeff(polynom,j)!=0)
468  bigone += (power(x,j)*CanonicalForm(to_long(rep(coeff(polynom,j)))));
469  }
470 
471  //append the converted polynomial to the CFFList
472  result.append(CFFactor(bigone,exponent));
473  }
474  return result;
475 }
476 
477 static unsigned char *cf_stringtemp;
478 static unsigned long cf_stringtemp_l=0L;
479 ////////////////////////////////////////////////////////////////////////////////
480 /// NAME: convertZZ2CF
481 ///
482 /// DESCRIPTION:
483 /// Routine for conversion of integers represented in NTL as Type ZZ to
484 /// integers in Factory represented as canonicalform.
485 /// To guarantee the correct execution of the algorithm the characteristic
486 /// has to equal zero.
487 ///
488 /// INPUT: The value coefficient of type ZZ that has to be converted
489 /// OUTPUT: The converted Factory-integer of type canonicalform
490 ////////////////////////////////////////////////////////////////////////////////
492 convertZZ2CF (const ZZ & a)
493 {
494  long coeff_long=to_long(a);
495 
497  if ( (NumBits(a)<((long)NTL_ZZ_NBITS))
498  && (coeff_long>((long)MINIMMEDIATE))
499  && (coeff_long<((long)MAXIMMEDIATE)))
500  {
501  return CanonicalForm(coeff_long);
502  }
503  else
504  {
505  const long * rep =
506 #if NTL_MAJOR_VERSION <= 6
507  static_cast<long *>( a.rep );
508 #elif NTL_MAJOR_VERSION <=9
509  static_cast<long *>( a.rep.rep ); // what about NTL7?
510 #else
511  (long*)( a.rep.rep );
512 #endif
513  long sizeofrep= rep[1];
514  bool lessZero= false;
515  if (sizeofrep < 0)
516  {
517  lessZero= true;
518  sizeofrep= -sizeofrep;
519  }
520  if (cf_stringtemp_l == 0)
521  {
522  cf_stringtemp_l= sizeofrep*sizeof(mp_limb_t)*2;
523  cf_stringtemp= (unsigned char*) Alloc (cf_stringtemp_l);
524  }
525  else if (cf_stringtemp_l < sizeofrep*sizeof(mp_limb_t)*2)
526  {
527  Free (cf_stringtemp, cf_stringtemp_l);
528  cf_stringtemp_l= sizeofrep*sizeof(mp_limb_t)*2;
529  cf_stringtemp= (unsigned char*) Alloc (cf_stringtemp_l);
530  }
531  int cc= mpn_get_str (cf_stringtemp, 16, (mp_limb_t *) ((rep) + 2), sizeofrep);
532 
533  char* cf_stringtemp2;
534  if (lessZero)
535  {
536  cf_stringtemp2= new char [cc + 2];
537  cf_stringtemp2[0]='-';
538  for (int j= 1; j <= cc; j++)
539  cf_stringtemp2[j]= IntValToChar ((int) cf_stringtemp [j-1]);
540  cf_stringtemp2[cc+1]='\0';
541  }
542  else
543  {
544  cf_stringtemp2= new char [cc + 1];
545  for (int j= 0; j < cc; j++)
546  cf_stringtemp2[j]= IntValToChar ((int) cf_stringtemp [j]);
547  cf_stringtemp2[cc]='\0';
548  }
549 
550  result= CanonicalForm (cf_stringtemp2, 16);
551  delete [] cf_stringtemp2;
552  }
553  return result;
554 }
555 
556 /*static char *cf_stringtemp;
557 static char *cf_stringtemp2;
558 static int cf_stringtemp_l=0;
559 CanonicalForm convertZZ2CF(const ZZ & coefficient)
560 {
561  long coeff_long;
562  //CanonicalForm tmp=0;
563  char dummy[2];
564  int minusremainder=0;
565  char numbers[]="0123456789abcdef";
566 
567  coeff_long=to_long(coefficient);
568 
569  //Test whether coefficient can be represented as an immediate integer in Factory
570  if ( (NumBits(coefficient)<((long)NTL_ZZ_NBITS))
571  && (coeff_long>((long)MINIMMEDIATE))
572  && (coeff_long<((long)MAXIMMEDIATE)))
573  {
574  // coefficient is immediate --> return the coefficient as canonicalform
575  return CanonicalForm(coeff_long);
576  }
577  else
578  {
579  // coefficient is not immediate (gmp-number)
580  if (cf_stringtemp_l==0)
581  {
582  cf_stringtemp=(char *)Alloc(1023);
583  cf_stringtemp2=(char *)Alloc(1023);
584  cf_stringtemp[0]='\0';
585  cf_stringtemp2[0]='\0';
586  cf_stringtemp_l=1023;
587  }
588 
589  // convert coefficient to char* (input for gmp)
590  dummy[1]='\0';
591 
592  if (coefficient<0)
593  {
594  // negate coefficient, but store the sign in minusremainder
595  minusremainder=1;
596  coefficient=-coefficient;
597  }
598 
599  int l=0;
600  while (coefficient>15)
601  {
602  ZZ quotient,remaind;
603  ZZ ten;ten=16;
604  DivRem(quotient,remaind,coefficient,ten);
605  dummy[0]=numbers[to_long(remaind)];
606  //tmp*=10; tmp+=to_long(remaind);
607 
608  l++;
609  if (l>=cf_stringtemp_l-2)
610  {
611  Free(cf_stringtemp2,cf_stringtemp_l);
612  char *p=(char *)Alloc(cf_stringtemp_l*2);
613  //NTL_SNS
614  memcpy(p,cf_stringtemp,cf_stringtemp_l);
615  Free(cf_stringtemp,cf_stringtemp_l);
616  cf_stringtemp_l*=2;
617  cf_stringtemp=p;
618  cf_stringtemp2=(char *)Alloc(cf_stringtemp_l);
619  }
620  cf_stringtemp[l-1]=dummy[0];
621  cf_stringtemp[l]='\0';
622  //strcat(stringtemp,dummy);
623 
624  coefficient=quotient;
625  }
626  //built up the string in dummy[0]
627  dummy[0]=numbers[to_long(coefficient)];
628  //NTL_SNS
629  l++;
630  cf_stringtemp[l-1]=dummy[0];
631  cf_stringtemp[l]='\0';
632  //tmp*=10; tmp+=to_long(coefficient);
633 
634  if (minusremainder==1)
635  {
636  //Check whether coefficient has been negative at the start of the procedure
637  cf_stringtemp2[0]='-';
638  //tmp*=(-1);
639  }
640 
641  //reverse the list to obtain the correct string
642  //NTL_SNS
643  for (int i=l-1;i>=0;i--) // l ist the position of \0
644  {
645  cf_stringtemp2[l-i-1+minusremainder]=cf_stringtemp[i];
646  }
647  cf_stringtemp2[l+minusremainder]='\0';
648  }
649 
650  //convert the string to canonicalform using the char*-Constructor
651  return CanonicalForm(cf_stringtemp2,16);
652  //return tmp;
653 }*/
654 
655 ////////////////////////////////////////////////////////////////////////////////
656 /// NAME: convertFacCF2NTLZZX
657 ///
658 /// DESCRIPTION:
659 /// Routine for conversion of canonicalforms in Factory to polynomials
660 /// of type ZZX of NTL. To guarantee the correct execution of the
661 /// algorithm the characteristic has to equal zero.
662 ///
663 /// INPUT: The canonicalform that has to be converted
664 /// OUTPUT: The converted NTL-polynom of type ZZX
665 ////////////////////////////////////////////////////////////////////////////////
666 
668 {
669  ZZ temp;
670  if (f.isImm()) temp=f.intval();
671  else
672  {
673  //Coefficient is a gmp-number
674  mpz_t gmp_val;
675  char* stringtemp;
676 
677  f.mpzval (gmp_val);
678  int l=mpz_sizeinbase(gmp_val,10)+2;
679  stringtemp=(char*)Alloc(l);
680  stringtemp=mpz_get_str(stringtemp,10,gmp_val);
681  mpz_clear(gmp_val);
682  conv(temp,stringtemp);
683  Free(stringtemp,l);
684  }
685  return temp;
686 }
687 
689 {
690  ZZX ntl_poly;
691 
692  CFIterator i;
693  i=f;
694 
695  int NTLcurrentExp=i.exp();
696  int largestExp=i.exp();
697  int k;
698 
699  //set the length of the NTL-polynomial
700  ntl_poly.SetMaxLength(largestExp+1);
701 
702  //Go through the coefficients of the canonicalform and build up the NTL-polynomial
703  for (;i.hasTerms();i++)
704  {
705  for (k=NTLcurrentExp;k>i.exp();k--)
706  {
707  SetCoeff(ntl_poly,k,0);
708  }
709  NTLcurrentExp=i.exp();
710 
711  //Coefficient is a gmp-number
712  ZZ temp=convertFacCF2NTLZZ(i.coeff());
713 
714  //set the computed coefficient
715  SetCoeff(ntl_poly,NTLcurrentExp,temp);
716 
717  NTLcurrentExp--;
718  }
719  for (k=NTLcurrentExp;k>=0;k--)
720  {
721  SetCoeff(ntl_poly,k,0);
722  }
723 
724  //normalize the polynomial
725  ntl_poly.normalize();
726 
727  return ntl_poly;
728 }
729 
730 ////////////////////////////////////////////////////////////////////////////////
731 /// NAME: convertNTLvec_pair_ZZX_long2FacCFFList
732 ///
733 /// DESCRIPTION:
734 /// Routine for converting a vector of polynomials from ZZ to a list
735 /// CFFList of Factory. This routine will be used after a successful
736 /// factorization of NTL to convert the result back to Factory.
737 /// Additionally a variable x and the computed multiplicity, as a type
738 /// ZZ of NTL, is needed as parameters indicating the main variable of the
739 /// computed canonicalform and the multiplicity of the original polynomial.
740 /// To guarantee the correct execution of the algorithm the characteristic
741 /// has to equal zero.
742 ///
743 /// INPUT: A vector of polynomials over ZZ of type vec_pair_ZZX_long and
744 /// a variable x and a multiplicity of type ZZ
745 /// OUTPUT: The converted list of polynomials of type CFFList, all
746 /// have x as their main variable
747 ////////////////////////////////////////////////////////////////////////////////
748 
749 CFFList
750 convertNTLvec_pair_ZZX_long2FacCFFList (const vec_pair_ZZX_long & e,const ZZ & multi,const Variable & x)
751 {
752  CFFList result;
753  ZZX polynom;
754  long exponent;
755  CanonicalForm bigone;
756 
757  // Go through the vector e and build up the CFFList
758  // As usual bigone summarizes the result
759  for (int i=e.length()-1;i>=0;i--)
760  {
761  ZZ coefficient;
762  polynom=e[i].a;
763  exponent=e[i].b;
764  bigone=convertNTLZZX2CF(polynom,x);
765  //append the converted polynomial to the list
766  result.append(CFFactor(bigone,exponent));
767  }
768  // the multiplicity at pos 1
769  //if (!IsOne(multi))
770  result.insert(CFFactor(convertZZ2CF(multi),1));
771 
772  //return the converted list
773  return result;
774 }
775 
776 
777 ////////////////////////////////////////////////////////////////////////////////
778 /// NAME: convertNTLZZpX2CF
779 ///
780 /// DESCRIPTION:
781 /// Routine for conversion of elements of arbitrary extensions of ZZp,
782 /// having type ZZpE, of NTL to their corresponding values of type
783 /// canonicalform in Factory.
784 /// To guarantee the correct execution of the algorithm the characteristic
785 /// has to be an arbitrary prime number and Factory has to compute in an
786 /// extension of F_p.
787 ///
788 /// INPUT: The coefficient of type ZZpE and the variable x indicating the main//
789 /// variable of the computed canonicalform
790 /// OUTPUT: The converted value of coefficient as type canonicalform
791 ////////////////////////////////////////////////////////////////////////////////
792 
793 CanonicalForm convertNTLZZpE2CF(const ZZ_pE & coefficient,const Variable & x)
794 {
795  return convertNTLZZpX2CF(rep(coefficient),x);
796 }
797 CanonicalForm convertNTLzzpE2CF(const zz_pE & coefficient,const Variable & x)
798 {
799  return convertNTLzzpX2CF(rep(coefficient),x);
800 }
801 
802 ////////////////////////////////////////////////////////////////////////////////
803 /// NAME: convertNTLvec_pair_ZZpEX_long2FacCFFList
804 ///
805 /// DESCRIPTION:
806 /// Routine for converting a vector of polynomials from ZZpEX to a CFFList
807 /// of Factory. This routine will be used after a successful factorization
808 /// of NTL to convert the result back to Factory.
809 /// Additionally a variable x and the computed multiplicity, as a type
810 /// ZZpE of NTL, is needed as parameters indicating the main variable of the
811 /// computed canonicalform and the multiplicity of the original polynomial.
812 /// To guarantee the correct execution of the algorithm the characteristic
813 /// has a be an arbitrary prime number p and computations have to be done
814 /// in an extention of F_p.
815 ///
816 /// INPUT: A vector of polynomials over ZZpE of type vec_pair_ZZ_pEX_long and
817 /// a variable x and a multiplicity of type ZZpE
818 /// OUTPUT: The converted list of polynomials of type CFFList, all polynomials
819 /// have x as their main variable
820 ////////////////////////////////////////////////////////////////////////////////
821 
822 CFFList
823 convertNTLvec_pair_ZZpEX_long2FacCFFList(const vec_pair_ZZ_pEX_long & e,const ZZ_pE & multi,const Variable & x,const Variable & alpha)
824 {
825  CFFList result;
826  ZZ_pEX polynom;
827  long exponent;
828  CanonicalForm bigone;
829 
830  // Maybe, e may additionally be sorted with respect to increasing degree of x, but this is not
831  //important for the factorization, but nevertheless would take computing time, so it is omitted
832 
833  // Go through the vector e and build up the CFFList
834  // As usual bigone summarizes the result during every loop
835  for (int i=e.length()-1;i>=0;i--)
836  {
837  bigone=0;
838 
839  polynom=e[i].a;
840  exponent=e[i].b;
841 
842  for (int j=0;j<=deg(polynom);j++)
843  {
844  if (IsOne(coeff(polynom,j)))
845  {
846  bigone+=power(x,j);
847  }
848  else
849  {
850  CanonicalForm coefficient=convertNTLZZpE2CF(coeff(polynom,j),alpha);
851  if (coeff(polynom,j)!=0)
852  {
853  bigone += (power(x,j)*coefficient);
854  }
855  }
856  }
857  //append the computed polynomials together with its exponent to the CFFList
858  result.append(CFFactor(bigone,exponent));
859  }
860  // Start by appending the multiplicity
861  if (!IsOne(multi))
862  result.insert(CFFactor(convertNTLZZpE2CF(multi,alpha),1));
863 
864  //return the computed CFFList
865  return result;
866 }
867 CFFList
868 convertNTLvec_pair_zzpEX_long2FacCFFList(const vec_pair_zz_pEX_long & e,const zz_pE & multi,const Variable & x,const Variable & alpha)
869 {
870  CFFList result;
871  zz_pEX polynom;
872  long exponent;
873  CanonicalForm bigone;
874 
875  // Maybe, e may additionally be sorted with respect to increasing degree of x, but this is not
876  //important for the factorization, but nevertheless would take computing time, so it is omitted
877 
878  // Go through the vector e and build up the CFFList
879  // As usual bigone summarizes the result during every loop
880  for (int i=e.length()-1;i>=0;i--)
881  {
882  bigone=0;
883 
884  polynom=e[i].a;
885  exponent=e[i].b;
886 
887  for (int j=0;j<=deg(polynom);j++)
888  {
889  if (IsOne(coeff(polynom,j)))
890  {
891  bigone+=power(x,j);
892  }
893  else
894  {
895  CanonicalForm coefficient=convertNTLzzpE2CF(coeff(polynom,j),alpha);
896  if (coeff(polynom,j)!=0)
897  {
898  bigone += (power(x,j)*coefficient);
899  }
900  }
901  }
902  //append the computed polynomials together with its exponent to the CFFList
903  result.append(CFFactor(bigone,exponent));
904  }
905  // Start by appending the multiplicity
906  if (!IsOne(multi))
907  result.insert(CFFactor(convertNTLzzpE2CF(multi,alpha),1));
908 
909  //return the computed CFFList
910  return result;
911 }
912 
913 ////////////////////////////////////////////////////////////////////////////////
914 /// NAME: convertNTLGF2E2CF
915 ///
916 /// DESCRIPTION:
917 /// Routine for conversion of elements of extensions of GF2, having type
918 /// GF2E, of NTL to their corresponding values of type canonicalform in
919 /// Factory.
920 /// To guarantee the correct execution of the algorithm, the characteristic
921 /// must equal two and Factory has to compute in an extension of F_2.
922 /// As usual this is an optimized special case of the more general conversion
923 /// routine from ZZpE to Factory.
924 ///
925 /// INPUT: The coefficient of type GF2E and the variable x indicating the
926 /// main variable of the computed canonicalform
927 /// OUTPUT: The converted value of coefficient as type canonicalform
928 ////////////////////////////////////////////////////////////////////////////////
929 
930 CanonicalForm convertNTLGF2E2CF(const GF2E & coefficient,const Variable & x)
931 {
932  return convertNTLGF2X2CF(rep(coefficient),x);
933 }
934 
935 ////////////////////////////////////////////////////////////////////////////////
936 /// NAME: convertNTLvec_pair_GF2EX_long2FacCFFList
937 ///
938 /// DESCRIPTION:
939 /// Routine for converting a vector of polynomials from GF2EX to a CFFList
940 /// of Factory. This routine will be used after a successful factorization
941 /// of NTL to convert the result back to Factory.
942 /// This is a special, but optimized case of the more general conversion
943 /// from ZZpE to canonicalform.
944 /// Additionally a variable x and the computed multiplicity, as a type GF2E
945 /// of NTL, is needed as parameters indicating the main variable of the
946 /// computed canonicalform and the multiplicity of the original polynomial.
947 /// To guarantee the correct execution of the algorithm the characteristic
948 /// has to equal two and computations have to be done in an extention of F_2.
949 ///
950 /// INPUT: A vector of polynomials over GF2E of type vec_pair_GF2EX_long and
951 /// a variable x and a multiplicity of type GF2E
952 /// OUTPUT: The converted list of polynomials of type CFFList, all polynomials
953 /// have x as their main variable
954 ////////////////////////////////////////////////////////////////////////////////
955 
957  (const vec_pair_GF2EX_long & e, const GF2E & multi, const Variable & x, const Variable & alpha)
958 {
959  CFFList result;
960  GF2EX polynom;
961  long exponent;
962  CanonicalForm bigone;
963 
964  // Maybe, e may additionally be sorted with respect to increasing degree of x, but this is not
965  //important for the factorization, but nevertheless would take computing time, so it is omitted
966 
967  // multiplicity is always one, so we do not have to worry about that
968 
969  // Go through the vector e and build up the CFFList
970  // As usual bigone summarizes the result during every loop
971  for (int i=e.length()-1;i>=0;i--)
972  {
973  bigone=0;
974 
975  polynom=e[i].a;
976  exponent=e[i].b;
977 
978  for (int j=0;j<=deg(polynom);j++)
979  {
980  if (IsOne(coeff(polynom,j)))
981  {
982  bigone+=power(x,j);
983  }
984  else
985  {
986  CanonicalForm coefficient=convertNTLGF2E2CF(coeff(polynom,j),alpha);
987  if (coeff(polynom,j)!=0)
988  {
989  bigone += (power(x,j)*coefficient);
990  }
991  }
992  }
993 
994  // append the computed polynomial together with its multiplicity
995  result.append(CFFactor(bigone,exponent));
996 
997  }
998 
999  if (!IsOne(multi))
1000  result.insert(CFFactor(convertNTLGF2E2CF(multi,alpha),1));
1001 
1002  // return the computed CFFList
1003  return result;
1004 }
1005 
1006 ////////////////////////////////////////////////////
1007 /// CanonicalForm in Z_2(a)[X] to NTL GF2EX
1008 ////////////////////////////////////////////////////
1009 GF2EX convertFacCF2NTLGF2EX(const CanonicalForm & f,const GF2X & mipo)
1010 {
1011  GF2E::init(mipo);
1012  GF2EX result;
1013  CFIterator i;
1014  i=f;
1015 
1016  int NTLcurrentExp=i.exp();
1017  int largestExp=i.exp();
1018  int k;
1019 
1020  result.SetMaxLength(largestExp+1);
1021  for(;i.hasTerms();i++)
1022  {
1023  for(k=NTLcurrentExp;k>i.exp();k--) SetCoeff(result,k,0);
1024  NTLcurrentExp=i.exp();
1025  CanonicalForm c=i.coeff();
1026  GF2X cc=convertFacCF2NTLGF2X(c);
1027  //ZZ_pE ccc;
1028  //conv(ccc,cc);
1029  SetCoeff(result,NTLcurrentExp,to_GF2E(cc));
1030  NTLcurrentExp--;
1031  }
1032  for(k=NTLcurrentExp;k>=0;k--) SetCoeff(result,k,0);
1033  result.normalize();
1034  return result;
1035 }
1036 ////////////////////////////////////////////////////
1037 /// CanonicalForm in Z_p(a)[X] to NTL ZZ_pEX
1038 ////////////////////////////////////////////////////
1039 ZZ_pEX convertFacCF2NTLZZ_pEX(const CanonicalForm & f, const ZZ_pX & mipo)
1040 {
1041  ZZ_pE::init(mipo);
1042  ZZ_pEX result;
1043  CFIterator i;
1044  i=f;
1045 
1046  int NTLcurrentExp=i.exp();
1047  int largestExp=i.exp();
1048  int k;
1049 
1050  result.SetMaxLength(largestExp+1);
1051  for(;i.hasTerms();i++)
1052  {
1053  for(k=NTLcurrentExp;k>i.exp();k--) SetCoeff(result,k,0);
1054  NTLcurrentExp=i.exp();
1055  CanonicalForm c=i.coeff();
1056  ZZ_pX cc=convertFacCF2NTLZZpX(c);
1057  //ZZ_pE ccc;
1058  //conv(ccc,cc);
1059  SetCoeff(result,NTLcurrentExp,to_ZZ_pE(cc));
1060  NTLcurrentExp--;
1061  }
1062  for(k=NTLcurrentExp;k>=0;k--) SetCoeff(result,k,0);
1063  result.normalize();
1064  return result;
1065 }
1066 zz_pEX convertFacCF2NTLzz_pEX(const CanonicalForm & f, const zz_pX & mipo)
1067 {
1068  zz_pE::init(mipo);
1069  zz_pEX result;
1070  CFIterator i;
1071  i=f;
1072 
1073  int NTLcurrentExp=i.exp();
1074  int largestExp=i.exp();
1075  int k;
1076 
1077  result.SetMaxLength(largestExp+1);
1078  for(;i.hasTerms();i++)
1079  {
1080  for(k=NTLcurrentExp;k>i.exp();k--) SetCoeff(result,k,0);
1081  NTLcurrentExp=i.exp();
1082  CanonicalForm c=i.coeff();
1083  zz_pX cc=convertFacCF2NTLzzpX(c);
1084  //ZZ_pE ccc;
1085  //conv(ccc,cc);
1086  SetCoeff(result,NTLcurrentExp,to_zz_pE(cc));
1087  NTLcurrentExp--;
1088  }
1089  for(k=NTLcurrentExp;k>=0;k--) SetCoeff(result,k,0);
1090  result.normalize();
1091  return result;
1092 }
1093 
1094 CanonicalForm convertNTLzz_pEX2CF (const zz_pEX& f, const Variable & x, const Variable & alpha)
1095 {
1096  CanonicalForm bigone;
1097  if (deg (f) > 0)
1098  {
1099  bigone= 0;
1100  bigone.mapinto();
1101  for (int j=0;j<deg(f)+1;j++)
1102  {
1103  if (coeff(f,j)!=0)
1104  {
1105  bigone+=(power(x,j)*convertNTLzzpE2CF(coeff(f,j),alpha));
1106  }
1107  }
1108  }
1109  else
1110  {
1111  bigone= convertNTLzzpE2CF(coeff(f,0),alpha);
1112  bigone.mapinto();
1113  }
1114  return bigone;
1115 }
1116 
1117 CanonicalForm convertNTLZZ_pEX2CF (const ZZ_pEX& f, const Variable & x, const Variable & alpha)
1118 {
1119  CanonicalForm bigone;
1120  if (deg (f) > 0)
1121  {
1122  bigone= 0;
1123  bigone.mapinto();
1124  for (int j=0;j<deg(f)+1;j++)
1125  {
1126  if (coeff(f,j)!=0)
1127  {
1128  bigone+=(power(x,j)*convertNTLZZpE2CF(coeff(f,j),alpha));
1129  }
1130  }
1131  }
1132  else
1133  {
1134  bigone= convertNTLZZpE2CF(coeff(f,0),alpha);
1135  bigone.mapinto();
1136  }
1137  return bigone;
1138 }
1139 //----------------------------------------------------------------------
1141 {
1142  mat_ZZ *res=new mat_ZZ;
1143  res->SetDims(m.rows(),m.columns());
1144 
1145  int i,j;
1146  for(i=m.rows();i>0;i--)
1147  {
1148  for(j=m.columns();j>0;j--)
1149  {
1150  (*res)(i,j)=convertFacCF2NTLZZ(m(i,j));
1151  }
1152  }
1153  return res;
1154 }
1156 {
1157  CFMatrix *res=new CFMatrix(m.NumRows(),m.NumCols());
1158  int i,j;
1159  for(i=res->rows();i>0;i--)
1160  {
1161  for(j=res->columns();j>0;j--)
1162  {
1163  (*res)(i,j)=convertZZ2CF(m(i,j));
1164  }
1165  }
1166  return res;
1167 }
1168 
1170 {
1171  mat_zz_p *res=new mat_zz_p;
1172  res->SetDims(m.rows(),m.columns());
1173 
1174  int i,j;
1175  for(i=m.rows();i>0;i--)
1176  {
1177  for(j=m.columns();j>0;j--)
1178  {
1179  if(!(m(i,j)).isImm()) printf("convertFacCFMatrix2NTLmat_zz_p: not imm.\n");
1180  (*res)(i,j)=(m(i,j)).intval();
1181  }
1182  }
1183  return res;
1184 }
1186 {
1187  CFMatrix *res=new CFMatrix(m.NumRows(),m.NumCols());
1188  int i,j;
1189  for(i=res->rows();i>0;i--)
1190  {
1191  for(j=res->columns();j>0;j--)
1192  {
1193  (*res)(i,j)=CanonicalForm(to_long(rep(m(i,j))));
1194  }
1195  }
1196  return res;
1197 }
1199 {
1200  mat_zz_pE *res=new mat_zz_pE;
1201  res->SetDims(m.rows(),m.columns());
1202 
1203  int i,j;
1204  for(i=m.rows();i>0;i--)
1205  {
1206  for(j=m.columns();j>0;j--)
1207  {
1208  zz_pX cc=convertFacCF2NTLzzpX(m(i,j));
1209  (*res)(i,j)=to_zz_pE(cc);
1210  }
1211  }
1212  return res;
1213 }
1214 CFMatrix* convertNTLmat_zz_pE2FacCFMatrix(const mat_zz_pE &m, const Variable & alpha)
1215 {
1216  CFMatrix *res=new CFMatrix(m.NumRows(),m.NumCols());
1217  int i,j;
1218  for(i=res->rows();i>0;i--)
1219  {
1220  for(j=res->columns();j>0;j--)
1221  {
1222  (*res)(i,j)=convertNTLzzpE2CF(m(i,j), alpha);
1223  }
1224  }
1225  return res;
1226 }
1227 #endif
GF2EX convertFacCF2NTLGF2EX(const CanonicalForm &f, const GF2X &mipo)
CanonicalForm in Z_2(a)[X] to NTL GF2EX.
Definition: NTLconvert.cc:1009
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
long intval() const
conversion functions
ZZ convertFacCF2NTLZZ(const CanonicalForm &f)
NAME: convertFacCF2NTLZZX.
Definition: NTLconvert.cc:667
CFFList convertNTLvec_pair_GF2EX_long2FacCFFList(const vec_pair_GF2EX_long &e, const GF2E &multi, const Variable &x, const Variable &alpha)
NAME: convertNTLvec_pair_GF2EX_long2FacCFFList.
Definition: NTLconvert.cc:957
Conversion to and from NTL.
const long MINIMMEDIATE
Definition: imm.h:50
CFFList convertNTLvec_pair_GF2X_long2FacCFFList(const vec_pair_GF2X_long &e, GF2, const Variable &x)
NAME: convertNTLvec_pair_GF2X_long2FacCFFList.
Definition: NTLconvert.cc:442
const poly a
Definition: syzextra.cc:212
CFFList convertNTLvec_pair_ZZpX_long2FacCFFList(const vec_pair_ZZ_pX_long &e, const ZZ_p &multi, const Variable &x)
NAME: convertNTLvec_pair_ZZpX_long2FacCFFList.
Definition: NTLconvert.cc:370
Matrix< CanonicalForm > CFMatrix
f
Definition: cfModGcd.cc:4022
factory&#39;s class for variables
Definition: factory.h:115
bool isImm() const
CF_NO_INLINE CanonicalForm coeff() const
get the current coefficient
CanonicalForm convertNTLzzpE2CF(const zz_pE &coefficient, const Variable &x)
Definition: NTLconvert.cc:797
CanonicalForm convertNTLZZpX2CF(const ZZ_pX &poly, const Variable &x)
NAME: convertNTLZZpX2CF.
Definition: NTLconvert.cc:246
GF2X convertFacCF2NTLGF2X(const CanonicalForm &f)
NAME: convertFacCF2NTLGF2X.
Definition: NTLconvert.cc:180
CFFList convertNTLvec_pair_zzpX_long2FacCFFList(const vec_pair_zz_pX_long &e, const zz_p multi, const Variable &x)
Definition: NTLconvert.cc:395
static unsigned char * cf_stringtemp
Definition: NTLconvert.cc:477
ZZ_pEX convertFacCF2NTLZZ_pEX(const CanonicalForm &f, const ZZ_pX &mipo)
CanonicalForm in Z_p(a)[X] to NTL ZZ_pEX.
Definition: NTLconvert.cc:1039
factory&#39;s main class
Definition: canonicalform.h:75
static unsigned long cf_stringtemp_l
Definition: NTLconvert.cc:478
assertions for Factory
CanonicalForm convertNTLzzpX2CF(const zz_pX &poly, const Variable &x)
Definition: NTLconvert.cc:251
ZZX convertFacCF2NTLZZX(const CanonicalForm &f)
Definition: NTLconvert.cc:688
int k
Definition: cfEzgcd.cc:93
Variable alpha
Definition: facAbsBiFact.cc:52
void insert(const T &)
Definition: ftmpl_list.cc:193
void mpzval(mpz_t val) const
CFMatrix * convertNTLmat_zz_p2FacCFMatrix(const mat_zz_p &m)
Definition: NTLconvert.cc:1185
int getCharacteristic()
Definition: cf_char.cc:51
CanonicalForm mapinto() const
CFFList convertNTLvec_pair_zzpEX_long2FacCFFList(const vec_pair_zz_pEX_long &e, const zz_pE &multi, const Variable &x, const Variable &alpha)
Definition: NTLconvert.cc:868
CFList conv(const CFFList &L)
convert a CFFList to a CFList by dropping the multiplicity
Definition: facBivar.cc:124
poly res
Definition: myNF.cc:322
CanonicalForm convertNTLGF2E2CF(const GF2E &coefficient, const Variable &x)
NAME: convertNTLGF2E2CF.
Definition: NTLconvert.cc:930
mat_zz_p * convertFacCFMatrix2NTLmat_zz_p(const CFMatrix &m)
Definition: NTLconvert.cc:1169
CanonicalForm convertNTLZZ_pEX2CF(const ZZ_pEX &f, const Variable &x, const Variable &alpha)
Definition: NTLconvert.cc:1117
ZZ_pX convertFacCF2NTLZZpX(const CanonicalForm &f)
NAME: convertFacCF2NTLZZpX.
Definition: NTLconvert.cc:62
int j
Definition: myNF.cc:70
long intval() const
Definition: int_int.cc:533
zz_pEX convertFacCF2NTLzz_pEX(const CanonicalForm &f, const zz_pX &mipo)
Definition: NTLconvert.cc:1066
#define Free(A, L)
Definition: NTLconvert.cc:39
virtual CanonicalForm coeff(int i)
CanonicalForm InternalCF::coeff ( int i )
Definition: int_cf.cc:120
int rows() const
Definition: ftmpl_matrix.h:45
int columns() const
Definition: ftmpl_matrix.h:46
int m
Definition: cfEzgcd.cc:119
Iterators for CanonicalForm&#39;s.
int i
Definition: cfEzgcd.cc:123
factory switches.
#define Alloc(L)
Definition: NTLconvert.cc:38
declarations of higher level algorithms.
CanonicalForm convertNTLzz_pEX2CF(const zz_pEX &f, const Variable &x, const Variable &alpha)
Definition: NTLconvert.cc:1094
mat_ZZ * convertFacCFMatrix2NTLmat_ZZ(const CFMatrix &m)
Definition: NTLconvert.cc:1140
static BOOLEAN IsOne(number a, const coeffs r)
Definition: flintcf_Q.cc:359
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44
const long MAXIMMEDIATE
Definition: imm.h:51
void out_cf(const char *s1, const CanonicalForm &f, const char *s2)
cf_algorithm.cc - simple mathematical algorithms.
Definition: cf_factor.cc:90
zz_pX convertFacCF2NTLzzpX(const CanonicalForm &f)
Definition: NTLconvert.cc:103
CanonicalForm mipo
Definition: facAlgExt.cc:57
CF_NO_INLINE int hasTerms() const
check if iterator has reached < the end of CanonicalForm
Factor< CanonicalForm > CFFactor
mat_zz_pE * convertFacCFMatrix2NTLmat_zz_pE(const CFMatrix &m)
Definition: NTLconvert.cc:1198
Variable x
Definition: cfModGcd.cc:4023
CFFList convertNTLvec_pair_ZZpEX_long2FacCFFList(const vec_pair_ZZ_pEX_long &e, const ZZ_pE &multi, const Variable &x, const Variable &alpha)
NAME: convertNTLvec_pair_ZZpEX_long2FacCFFList.
Definition: NTLconvert.cc:823
CFMatrix * convertNTLmat_ZZ2FacCFMatrix(const mat_ZZ &m)
Definition: NTLconvert.cc:1155
static BOOLEAN IsZero(number a, const coeffs r)
Definition: flintcf_Q.cc:355
CanonicalForm convertNTLZZpE2CF(const ZZ_pE &coefficient, const Variable &x)
NAME: convertNTLZZpX2CF.
Definition: NTLconvert.cc:793
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
void append(const T &)
Definition: ftmpl_list.cc:256
long fac_NTL_char
Definition: NTLconvert.cc:44
polyrec * poly
Definition: hilb.h:10
CF_NO_INLINE int exp() const
get the current exponent
CanonicalForm convertZZ2CF(const ZZ &a)
NAME: convertZZ2CF.
Definition: NTLconvert.cc:492
CFMatrix * convertNTLmat_zz_pE2FacCFMatrix(const mat_zz_pE &m, const Variable &alpha)
Definition: NTLconvert.cc:1214
const poly b
Definition: syzextra.cc:213
CFFList convertNTLvec_pair_ZZX_long2FacCFFList(const vec_pair_ZZX_long &e, const ZZ &multi, const Variable &x)
NAME: convertNTLvec_pair_ZZX_long2FacCFFList.
Definition: NTLconvert.cc:750
CanonicalForm convertNTLZZX2CF(const ZZX &polynom, const Variable &x)
Definition: NTLconvert.cc:281
int l
Definition: cfEzgcd.cc:94
return result
Definition: facAbsBiFact.cc:76
CanonicalForm convertNTLGF2X2CF(const GF2X &poly, const Variable &x)
NAME: convertNTLGF2X2CF.
Definition: NTLconvert.cc:318
squarefree part and factorization over Q, Q(a)
Header for factory&#39;s main class CanonicalForm.
Factory&#39;s internal integers.