Functions | Variables
NTLconvert.h File Reference

Conversion to and from NTL. More...

#include "cf_defs.h"
#include "canonicalform.h"
#include "cf_iter.h"
#include "fac_sqrfree.h"
#include "cf_algorithm.h"
#include <NTL/config.h>
#include <NTL/ZZXFactoring.h>
#include <NTL/ZZ_pXFactoring.h>
#include <NTL/lzz_pXFactoring.h>
#include <NTL/GF2XFactoring.h>
#include <NTL/ZZ_pEXFactoring.h>
#include <NTL/lzz_pEXFactoring.h>
#include <NTL/GF2EXFactoring.h>
#include <NTL/mat_ZZ.h>
#include <NTL/mat_lzz_p.h>
#include <NTL/mat_lzz_pE.h>
#include "int_int.h"
#include "cf_assert.h"

Go to the source code of this file.

Functions

ZZ_pX convertFacCF2NTLZZpX (const CanonicalForm &f)
 NAME: convertFacCF2NTLZZpX. More...
 
zz_pX convertFacCF2NTLzzpX (const CanonicalForm &f)
 
GF2X convertFacCF2NTLGF2X (const CanonicalForm &f)
 NAME: convertFacCF2NTLGF2X. More...
 
CanonicalForm convertNTLZZpX2CF (const ZZ_pX &poly, const Variable &x)
 NAME: convertNTLZZpX2CF. More...
 
CanonicalForm convertNTLzzpX2CF (const zz_pX &poly, const Variable &x)
 
CanonicalForm convertNTLGF2X2CF (const GF2X &poly, const Variable &x)
 NAME: convertNTLGF2X2CF. More...
 
CanonicalForm convertNTLZZX2CF (const ZZX &polynom, const Variable &x)
 
CFFList convertNTLvec_pair_ZZpX_long2FacCFFList (const vec_pair_ZZ_pX_long &e, const ZZ_p &multi, const Variable &x)
 NAME: convertNTLvec_pair_ZZpX_long2FacCFFList. More...
 
CFFList convertNTLvec_pair_zzpX_long2FacCFFList (const vec_pair_zz_pX_long &e, const zz_p multi, const Variable &x)
 
CFFList convertNTLvec_pair_GF2X_long2FacCFFList (const vec_pair_GF2X_long &e, const GF2 multi, const Variable &x)
 NAME: convertNTLvec_pair_GF2X_long2FacCFFList. More...
 
CanonicalForm convertZZ2CF (const ZZ &coefficient)
 NAME: convertZZ2CF. More...
 
ZZ convertFacCF2NTLZZ (const CanonicalForm &f)
 NAME: convertFacCF2NTLZZX. More...
 
ZZX convertFacCF2NTLZZX (const CanonicalForm &f)
 
CFFList convertNTLvec_pair_ZZX_long2FacCFFList (const vec_pair_ZZX_long &e, const ZZ &multi, const Variable &x)
 NAME: convertNTLvec_pair_ZZX_long2FacCFFList. More...
 
CanonicalForm convertNTLZZpE2CF (const ZZ_pE &coefficient, const Variable &x)
 NAME: convertNTLZZpX2CF. More...
 
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. More...
 
CanonicalForm convertNTLGF2E2CF (const GF2E &coefficient, const Variable &x)
 NAME: convertNTLGF2E2CF. More...
 
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. More...
 
GF2EX convertFacCF2NTLGF2EX (const CanonicalForm &f, const GF2X &mipo)
 CanonicalForm in Z_2(a)[X] to NTL GF2EX. More...
 
ZZ_pEX convertFacCF2NTLZZ_pEX (const CanonicalForm &f, const ZZ_pX &mipo)
 CanonicalForm in Z_p(a)[X] to NTL ZZ_pEX. More...
 
zz_pEX convertFacCF2NTLzz_pEX (const CanonicalForm &f, const zz_pX &mipo)
 
CanonicalForm convertNTLzzpE2CF (const zz_pE &f, const Variable &x)
 
CFFList convertNTLvec_pair_zzpEX_long2FacCFFList (const vec_pair_zz_pEX_long &e, const zz_pE &multi, const Variable &x, const Variable &alpha)
 
CanonicalForm convertNTLzz_pEX2CF (const zz_pEX &f, const Variable &x, const Variable &alpha)
 
CanonicalForm convertNTLZZ_pEX2CF (const ZZ_pEX &f, const Variable &x, const Variable &alpha)
 
mat_ZZ * convertFacCFMatrix2NTLmat_ZZ (const CFMatrix &m)
 
CFMatrixconvertNTLmat_ZZ2FacCFMatrix (const mat_ZZ &m)
 
mat_zz_p * convertFacCFMatrix2NTLmat_zz_p (const CFMatrix &m)
 
CFMatrixconvertNTLmat_zz_p2FacCFMatrix (const mat_zz_p &m)
 
mat_zz_pE * convertFacCFMatrix2NTLmat_zz_pE (const CFMatrix &m)
 
CFMatrixconvertNTLmat_zz_pE2FacCFMatrix (const mat_zz_pE &m, const Variable &alpha)
 

Variables

long fac_NTL_char
 

Detailed Description

Conversion to and from NTL.

Definition in file NTLconvert.h.

Function Documentation

◆ convertFacCF2NTLGF2EX()

GF2EX convertFacCF2NTLGF2EX ( const CanonicalForm f,
const GF2X &  mipo 
)

CanonicalForm in Z_2(a)[X] to NTL GF2EX.

Definition at line 1009 of file NTLconvert.cc.

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 }
GF2X convertFacCF2NTLGF2X(const CanonicalForm &f)
NAME: convertFacCF2NTLGF2X.
Definition: NTLconvert.cc:180
factory&#39;s main class
Definition: canonicalform.h:75
int k
Definition: cfEzgcd.cc:93
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:123
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44
CanonicalForm mipo
Definition: facAlgExt.cc:57
return result
Definition: facAbsBiFact.cc:76

◆ convertFacCF2NTLGF2X()

GF2X convertFacCF2NTLGF2X ( const CanonicalForm f)

NAME: convertFacCF2NTLGF2X.

DESCRIPTION: Conversion routine for Factory-type canonicalform into GF2X of NTL, i.e. polynomials over F_2. As precondition for correct execution, the characteristic must equal two. This is a special case of the more general conversion routine for canonicalform to ZZpX. It is included because NTL provides additional support and faster algorithms over F_2, moreover the conversion code can be optimized, because certain steps are either completely obsolent (like normalizing the polynomial) or they can be made significantly faster (like building up the NTL-polynomial).

INPUT: A canonicalform f OUTPUT: The converted NTL-polynomial over F_2 of type GF2X

Definition at line 180 of file NTLconvert.cc.

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 }
int k
Definition: cfEzgcd.cc:93
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:123
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44

◆ convertFacCF2NTLZZ()

ZZ convertFacCF2NTLZZ ( const CanonicalForm f)

NAME: convertFacCF2NTLZZX.

DESCRIPTION: Routine for conversion of canonicalforms in Factory to polynomials of type ZZX of NTL. To guarantee the correct execution of the algorithm the characteristic has to equal zero.

INPUT: The canonicalform that has to be converted OUTPUT: The converted NTL-polynom of type ZZX

Definition at line 667 of file NTLconvert.cc.

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 }
CFList conv(const CFFList &L)
convert a CFFList to a CFList by dropping the multiplicity
Definition: facBivar.cc:124
#define Free(A, L)
Definition: NTLconvert.cc:39
FILE * f
Definition: checklibs.c:9
#define Alloc(L)
Definition: NTLconvert.cc:38
int l
Definition: cfEzgcd.cc:94

◆ convertFacCF2NTLZZ_pEX()

ZZ_pEX convertFacCF2NTLZZ_pEX ( const CanonicalForm f,
const ZZ_pX &  mipo 
)

CanonicalForm in Z_p(a)[X] to NTL ZZ_pEX.

Definition at line 1039 of file NTLconvert.cc.

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 }
factory&#39;s main class
Definition: canonicalform.h:75
int k
Definition: cfEzgcd.cc:93
ZZ_pX convertFacCF2NTLZZpX(const CanonicalForm &f)
NAME: convertFacCF2NTLZZpX.
Definition: NTLconvert.cc:62
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:123
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44
CanonicalForm mipo
Definition: facAlgExt.cc:57
return result
Definition: facAbsBiFact.cc:76

◆ convertFacCF2NTLzz_pEX()

zz_pEX convertFacCF2NTLzz_pEX ( const CanonicalForm f,
const zz_pX &  mipo 
)

Definition at line 1066 of file NTLconvert.cc.

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 }
factory&#39;s main class
Definition: canonicalform.h:75
int k
Definition: cfEzgcd.cc:93
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:123
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44
zz_pX convertFacCF2NTLzzpX(const CanonicalForm &f)
Definition: NTLconvert.cc:103
CanonicalForm mipo
Definition: facAlgExt.cc:57
return result
Definition: facAbsBiFact.cc:76

◆ convertFacCF2NTLZZpX()

ZZ_pX convertFacCF2NTLZZpX ( const CanonicalForm f)

NAME: convertFacCF2NTLZZpX.

DESCRIPTION: Conversion routine for Factory-type canonicalform into ZZpX of NTL, i.e. polynomials over F_p. As a precondition for correct execution, the characteristic has to a a prime number.

INPUT: A canonicalform f OUTPUT: The converted NTL-polynomial over F_p of type ZZpX

Definition at line 62 of file NTLconvert.cc.

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 }
ZZ convertFacCF2NTLZZ(const CanonicalForm &f)
NAME: convertFacCF2NTLZZX.
Definition: NTLconvert.cc:667
int k
Definition: cfEzgcd.cc:93
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:123
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44

◆ convertFacCF2NTLzzpX()

zz_pX convertFacCF2NTLzzpX ( const CanonicalForm f)

Definition at line 103 of file NTLconvert.cc.

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 }
long intval() const
conversion functions
bool isImm() const
factory&#39;s main class
Definition: canonicalform.h:75
int k
Definition: cfEzgcd.cc:93
int getCharacteristic()
Definition: cf_char.cc:51
CanonicalForm mapinto() const
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:123
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44

◆ convertFacCF2NTLZZX()

ZZX convertFacCF2NTLZZX ( const CanonicalForm f)

Definition at line 688 of file NTLconvert.cc.

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 }
ZZ convertFacCF2NTLZZ(const CanonicalForm &f)
NAME: convertFacCF2NTLZZX.
Definition: NTLconvert.cc:667
int k
Definition: cfEzgcd.cc:93
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:123
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44

◆ convertFacCFMatrix2NTLmat_ZZ()

mat_ZZ* convertFacCFMatrix2NTLmat_ZZ ( const CFMatrix m)

Definition at line 1140 of file NTLconvert.cc.

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 }
ZZ convertFacCF2NTLZZ(const CanonicalForm &f)
NAME: convertFacCF2NTLZZX.
Definition: NTLconvert.cc:667
poly res
Definition: myNF.cc:322
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123

◆ convertFacCFMatrix2NTLmat_zz_p()

mat_zz_p* convertFacCFMatrix2NTLmat_zz_p ( const CFMatrix m)

Definition at line 1169 of file NTLconvert.cc.

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 }
poly res
Definition: myNF.cc:322
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123

◆ convertFacCFMatrix2NTLmat_zz_pE()

mat_zz_pE* convertFacCFMatrix2NTLmat_zz_pE ( const CFMatrix m)

Definition at line 1198 of file NTLconvert.cc.

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 }
poly res
Definition: myNF.cc:322
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
zz_pX convertFacCF2NTLzzpX(const CanonicalForm &f)
Definition: NTLconvert.cc:103

◆ convertNTLGF2E2CF()

CanonicalForm convertNTLGF2E2CF ( const GF2E &  coefficient,
const Variable x 
)

NAME: convertNTLGF2E2CF.

DESCRIPTION: Routine for conversion of elements of extensions of GF2, having type GF2E, of NTL to their corresponding values of type canonicalform in Factory. To guarantee the correct execution of the algorithm, the characteristic must equal two and Factory has to compute in an extension of F_2. As usual this is an optimized special case of the more general conversion routine from ZZpE to Factory.

INPUT: The coefficient of type GF2E and the variable x indicating the main variable of the computed canonicalform OUTPUT: The converted value of coefficient as type canonicalform

Definition at line 930 of file NTLconvert.cc.

931 {
932  return convertNTLGF2X2CF(rep(coefficient),x);
933 }
Variable x
Definition: cfModGcd.cc:4023
CanonicalForm convertNTLGF2X2CF(const GF2X &poly, const Variable &x)
NAME: convertNTLGF2X2CF.
Definition: NTLconvert.cc:318

◆ convertNTLGF2X2CF()

CanonicalForm convertNTLGF2X2CF ( const GF2X &  poly,
const Variable x 
)

NAME: convertNTLGF2X2CF.

DESCRIPTION: Conversion routine for NTL-Type GF2X to Factory-Type canonicalform, the routine is again an optimized special case of the more general conversion to ZZpX. Additionally a variable x is needed as a parameter indicating the main variable of the computed canonicalform. To guarantee the correct execution of the algorithm the characteristic has a be an arbitrary prime number.

INPUT: A canonicalform f, a variable x OUTPUT: The converted Factory-polynomial of type canonicalform, built by the main variable x

Definition at line 318 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
factory&#39;s main class
Definition: canonicalform.h:75
CanonicalForm mapinto() const
int j
Definition: myNF.cc:70
Variable x
Definition: cfModGcd.cc:4023
polyrec * poly
Definition: hilb.h:10

◆ convertNTLmat_ZZ2FacCFMatrix()

CFMatrix* convertNTLmat_ZZ2FacCFMatrix ( const mat_ZZ &  m)

Definition at line 1155 of file NTLconvert.cc.

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 }
Matrix< CanonicalForm > CFMatrix
poly res
Definition: myNF.cc:322
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
CanonicalForm convertZZ2CF(const ZZ &a)
NAME: convertZZ2CF.
Definition: NTLconvert.cc:492

◆ convertNTLmat_zz_p2FacCFMatrix()

CFMatrix* convertNTLmat_zz_p2FacCFMatrix ( const mat_zz_p &  m)

Definition at line 1185 of file NTLconvert.cc.

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 }
Matrix< CanonicalForm > CFMatrix
factory&#39;s main class
Definition: canonicalform.h:75
poly res
Definition: myNF.cc:322
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123

◆ convertNTLmat_zz_pE2FacCFMatrix()

CFMatrix* convertNTLmat_zz_pE2FacCFMatrix ( const mat_zz_pE &  m,
const Variable alpha 
)

Definition at line 1214 of file NTLconvert.cc.

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 }
Matrix< CanonicalForm > CFMatrix
CanonicalForm convertNTLzzpE2CF(const zz_pE &coefficient, const Variable &x)
Definition: NTLconvert.cc:797
Variable alpha
Definition: facAbsBiFact.cc:52
poly res
Definition: myNF.cc:322
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123

◆ 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.

DESCRIPTION: Routine for converting a vector of polynomials from GF2EX to a CFFList of Factory. This routine will be used after a successful factorization of NTL to convert the result back to Factory. This is a special, but optimized case of the more general conversion from ZZpE to canonicalform. Additionally a variable x and the computed multiplicity, as a type GF2E of NTL, is needed as parameters indicating the main variable of the computed canonicalform and the multiplicity of the original polynomial. To guarantee the correct execution of the algorithm the characteristic has to equal two and computations have to be done in an extention of F_2.

INPUT: A vector of polynomials over GF2E of type vec_pair_GF2EX_long and a variable x and a multiplicity of type GF2E OUTPUT: The converted list of polynomials of type CFFList, all polynomials have x as their main variable

Definition at line 957 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
factory&#39;s main class
Definition: canonicalform.h:75
Variable alpha
Definition: facAbsBiFact.cc:52
CanonicalForm convertNTLGF2E2CF(const GF2E &coefficient, const Variable &x)
NAME: convertNTLGF2E2CF.
Definition: NTLconvert.cc:930
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
static BOOLEAN IsOne(number a, const coeffs r)
Definition: flintcf_Q.cc:359
Factor< CanonicalForm > CFFactor
Variable x
Definition: cfModGcd.cc:4023
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
return result
Definition: facAbsBiFact.cc:76

◆ convertNTLvec_pair_GF2X_long2FacCFFList()

CFFList convertNTLvec_pair_GF2X_long2FacCFFList ( const vec_pair_GF2X_long &  e,
GF2  ,
const Variable x 
)

NAME: convertNTLvec_pair_GF2X_long2FacCFFList.

DESCRIPTION: Routine for converting a vector of polynomials of type GF2X from NTL to a list CFFList of Factory. This routine will be used after a successful factorization of NTL to convert the result back to Factory. As usual this is simply a special case of the more general conversion routine but again speeded up by leaving out unnecessary steps. Additionally a variable x and the computed multiplicity, as type GF2 of NTL, are needed as parameters indicating the main variable of the computed canonicalform and the multiplicity of the original polynomial. To guarantee the correct execution of the algorithm the characteristic has a be an arbitrary prime number.

INPUT: A vector of polynomials over GF2 of type vec_pair_GF2X_long and a variable x and a multiplicity of type GF2 OUTPUT: The converted list of polynomials of type CFFList, all polynomials have x as their main variable

Definition at line 442 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
factory&#39;s main class
Definition: canonicalform.h:75
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
Factor< CanonicalForm > CFFactor
Variable x
Definition: cfModGcd.cc:4023
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
return result
Definition: facAbsBiFact.cc:76

◆ 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.

DESCRIPTION: Routine for converting a vector of polynomials from ZZpEX to a CFFList of Factory. This routine will be used after a successful factorization of NTL to convert the result back to Factory. Additionally a variable x and the computed multiplicity, as a type ZZpE of NTL, is needed as parameters indicating the main variable of the computed canonicalform and the multiplicity of the original polynomial. To guarantee the correct execution of the algorithm the characteristic has a be an arbitrary prime number p and computations have to be done in an extention of F_p.

INPUT: A vector of polynomials over ZZpE of type vec_pair_ZZ_pEX_long and a variable x and a multiplicity of type ZZpE OUTPUT: The converted list of polynomials of type CFFList, all polynomials have x as their main variable

Definition at line 823 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
factory&#39;s main class
Definition: canonicalform.h:75
Variable alpha
Definition: facAbsBiFact.cc:52
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
static BOOLEAN IsOne(number a, const coeffs r)
Definition: flintcf_Q.cc:359
Factor< CanonicalForm > CFFactor
Variable x
Definition: cfModGcd.cc:4023
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 )
return result
Definition: facAbsBiFact.cc:76

◆ 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 at line 868 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
CanonicalForm convertNTLzzpE2CF(const zz_pE &coefficient, const Variable &x)
Definition: NTLconvert.cc:797
factory&#39;s main class
Definition: canonicalform.h:75
Variable alpha
Definition: facAbsBiFact.cc:52
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
static BOOLEAN IsOne(number a, const coeffs r)
Definition: flintcf_Q.cc:359
Factor< CanonicalForm > CFFactor
Variable x
Definition: cfModGcd.cc:4023
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
return result
Definition: facAbsBiFact.cc:76

◆ 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.

DESCRIPTION: Routine for converting a vector of polynomials from ZZpX to a CFFList of Factory. This routine will be used after a successful factorization of NTL to convert the result back to Factory.

Additionally a variable x and the computed multiplicity, as a type ZZp of NTL, is needed as parameters indicating the main variable of the computed canonicalform and the multiplicity of the original polynomial. To guarantee the correct execution of the algorithm the characteristic has a be an arbitrary prime number.

INPUT: A vector of polynomials over ZZp of type vec_pair_ZZ_pX_long and a variable x and a multiplicity of type ZZp OUTPUT: The converted list of polynomials of type CFFList, all polynomials have x as their main variable

Definition at line 370 of file NTLconvert.cc.

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 }
const poly a
Definition: syzextra.cc:212
CanonicalForm convertNTLZZpX2CF(const ZZ_pX &poly, const Variable &x)
NAME: convertNTLZZpX2CF.
Definition: NTLconvert.cc:246
factory&#39;s main class
Definition: canonicalform.h:75
int i
Definition: cfEzgcd.cc:123
static BOOLEAN IsOne(number a, const coeffs r)
Definition: flintcf_Q.cc:359
Factor< CanonicalForm > CFFactor
Variable x
Definition: cfModGcd.cc:4023
const poly b
Definition: syzextra.cc:213
return result
Definition: facAbsBiFact.cc:76

◆ convertNTLvec_pair_zzpX_long2FacCFFList()

CFFList convertNTLvec_pair_zzpX_long2FacCFFList ( const vec_pair_zz_pX_long &  e,
const zz_p  multi,
const Variable x 
)

Definition at line 395 of file NTLconvert.cc.

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 }
const poly a
Definition: syzextra.cc:212
factory&#39;s main class
Definition: canonicalform.h:75
CanonicalForm convertNTLzzpX2CF(const zz_pX &poly, const Variable &x)
Definition: NTLconvert.cc:251
int i
Definition: cfEzgcd.cc:123
static BOOLEAN IsOne(number a, const coeffs r)
Definition: flintcf_Q.cc:359
Factor< CanonicalForm > CFFactor
Variable x
Definition: cfModGcd.cc:4023
const poly b
Definition: syzextra.cc:213
return result
Definition: facAbsBiFact.cc:76

◆ 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.

DESCRIPTION: Routine for converting a vector of polynomials from ZZ to a list CFFList of Factory. This routine will be used after a successful factorization of NTL to convert the result back to Factory. Additionally a variable x and the computed multiplicity, as a type ZZ of NTL, is needed as parameters indicating the main variable of the computed canonicalform and the multiplicity of the original polynomial. To guarantee the correct execution of the algorithm the characteristic has to equal zero.

INPUT: A vector of polynomials over ZZ of type vec_pair_ZZX_long and a variable x and a multiplicity of type ZZ OUTPUT: The converted list of polynomials of type CFFList, all have x as their main variable

Definition at line 750 of file NTLconvert.cc.

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 }
factory&#39;s main class
Definition: canonicalform.h:75
int i
Definition: cfEzgcd.cc:123
Factor< CanonicalForm > CFFactor
Variable x
Definition: cfModGcd.cc:4023
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
CanonicalForm convertZZ2CF(const ZZ &a)
NAME: convertZZ2CF.
Definition: NTLconvert.cc:492
CanonicalForm convertNTLZZX2CF(const ZZX &polynom, const Variable &x)
Definition: NTLconvert.cc:281
return result
Definition: facAbsBiFact.cc:76

◆ convertNTLzz_pEX2CF()

CanonicalForm convertNTLzz_pEX2CF ( const zz_pEX &  f,
const Variable x,
const Variable alpha 
)

Definition at line 1094 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
CanonicalForm convertNTLzzpE2CF(const zz_pE &coefficient, const Variable &x)
Definition: NTLconvert.cc:797
factory&#39;s main class
Definition: canonicalform.h:75
Variable alpha
Definition: facAbsBiFact.cc:52
CanonicalForm mapinto() const
int j
Definition: myNF.cc:70
FILE * f
Definition: checklibs.c:9
Variable x
Definition: cfModGcd.cc:4023

◆ convertNTLZZ_pEX2CF()

CanonicalForm convertNTLZZ_pEX2CF ( const ZZ_pEX &  f,
const Variable x,
const Variable alpha 
)

Definition at line 1117 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
factory&#39;s main class
Definition: canonicalform.h:75
Variable alpha
Definition: facAbsBiFact.cc:52
CanonicalForm mapinto() const
int j
Definition: myNF.cc:70
FILE * f
Definition: checklibs.c:9
Variable x
Definition: cfModGcd.cc:4023
CanonicalForm convertNTLZZpE2CF(const ZZ_pE &coefficient, const Variable &x)
NAME: convertNTLZZpX2CF.
Definition: NTLconvert.cc:793

◆ convertNTLZZpE2CF()

CanonicalForm convertNTLZZpE2CF ( const ZZ_pE &  coefficient,
const Variable x 
)

NAME: convertNTLZZpX2CF.

DESCRIPTION: Routine for conversion of elements of arbitrary extensions of ZZp, having type ZZpE, of NTL to their corresponding values of type canonicalform in Factory. To guarantee the correct execution of the algorithm the characteristic has to be an arbitrary prime number and Factory has to compute in an extension of F_p.

INPUT: The coefficient of type ZZpE and the variable x indicating the main// variable of the computed canonicalform OUTPUT: The converted value of coefficient as type canonicalform

Definition at line 793 of file NTLconvert.cc.

794 {
795  return convertNTLZZpX2CF(rep(coefficient),x);
796 }
CanonicalForm convertNTLZZpX2CF(const ZZ_pX &poly, const Variable &x)
NAME: convertNTLZZpX2CF.
Definition: NTLconvert.cc:246
Variable x
Definition: cfModGcd.cc:4023

◆ convertNTLzzpE2CF()

CanonicalForm convertNTLzzpE2CF ( const zz_pE &  f,
const Variable x 
)

Definition at line 797 of file NTLconvert.cc.

798 {
799  return convertNTLzzpX2CF(rep(coefficient),x);
800 }
CanonicalForm convertNTLzzpX2CF(const zz_pX &poly, const Variable &x)
Definition: NTLconvert.cc:251
Variable x
Definition: cfModGcd.cc:4023

◆ convertNTLZZpX2CF()

CanonicalForm convertNTLZZpX2CF ( const ZZ_pX &  poly,
const Variable x 
)

NAME: convertNTLZZpX2CF.

DESCRIPTION: Conversion routine for NTL-Type ZZpX to Factory-Type canonicalform. Additionally a variable x is needed as a parameter indicating the main variable of the computed canonicalform. To guarantee the correct execution of the algorithm, the characteristic has a be an arbitrary prime number.

INPUT: A canonicalform f, a variable x OUTPUT: The converted Factory-polynomial of type canonicalform, built by the main variable x

Definition at line 246 of file NTLconvert.cc.

247 {
248  return convertNTLZZX2CF (to_ZZX (poly), x);
249 }
Variable x
Definition: cfModGcd.cc:4023
polyrec * poly
Definition: hilb.h:10
CanonicalForm convertNTLZZX2CF(const ZZX &polynom, const Variable &x)
Definition: NTLconvert.cc:281

◆ convertNTLzzpX2CF()

CanonicalForm convertNTLzzpX2CF ( const zz_pX &  poly,
const Variable x 
)

Definition at line 251 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
factory&#39;s main class
Definition: canonicalform.h:75
CanonicalForm mapinto() const
int j
Definition: myNF.cc:70
Variable x
Definition: cfModGcd.cc:4023
polyrec * poly
Definition: hilb.h:10

◆ convertNTLZZX2CF()

CanonicalForm convertNTLZZX2CF ( const ZZX &  polynom,
const Variable x 
)

Definition at line 281 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
factory&#39;s main class
Definition: canonicalform.h:75
int j
Definition: myNF.cc:70
Variable x
Definition: cfModGcd.cc:4023
static BOOLEAN IsZero(number a, const coeffs r)
Definition: flintcf_Q.cc:355
CanonicalForm convertZZ2CF(const ZZ &a)
NAME: convertZZ2CF.
Definition: NTLconvert.cc:492

◆ convertZZ2CF()

CanonicalForm convertZZ2CF ( const ZZ &  a)

NAME: convertZZ2CF.

DESCRIPTION: Routine for conversion of integers represented in NTL as Type ZZ to integers in Factory represented as canonicalform. To guarantee the correct execution of the algorithm the characteristic has to equal zero.

INPUT: The value coefficient of type ZZ that has to be converted OUTPUT: The converted Factory-integer of type canonicalform

Definition at line 492 of file NTLconvert.cc.

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  {
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 }
const long MINIMMEDIATE
Definition: imm.h:50
const poly a
Definition: syzextra.cc:212
static unsigned char * cf_stringtemp
Definition: NTLconvert.cc:477
factory&#39;s main class
Definition: canonicalform.h:75
static unsigned long cf_stringtemp_l
Definition: NTLconvert.cc:478
int j
Definition: myNF.cc:70
#define Free(A, L)
Definition: NTLconvert.cc:39
#define Alloc(L)
Definition: NTLconvert.cc:38
const long MAXIMMEDIATE
Definition: imm.h:51
return result
Definition: facAbsBiFact.cc:76

Variable Documentation

◆ fac_NTL_char

long fac_NTL_char

Definition at line 44 of file NTLconvert.cc.