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