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