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

EXTERN_VAR 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 1006 of file NTLconvert.cc.

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 }
CF_NO_INLINE CanonicalForm coeff() const
get the current coefficient
GF2X convertFacCF2NTLGF2X(const CanonicalForm &f)
NAME: convertFacCF2NTLGF2X.
Definition: NTLconvert.cc:177
factory&#39;s main class
Definition: canonicalform.h:77
int k
Definition: cfEzgcd.cc:92
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:125
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44
CanonicalForm mipo
Definition: facAlgExt.cc:57
CF_NO_INLINE int hasTerms() const
check if iterator has reached the end of CanonicalForm
CF_NO_INLINE int exp() const
get the current exponent
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 177 of file NTLconvert.cc.

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 }
long intval() const
conversion functions
bool isImm() const
CF_NO_INLINE CanonicalForm coeff() const
get the current coefficient
int k
Definition: cfEzgcd.cc:92
CanonicalForm mapinto() const
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:125
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44
CF_NO_INLINE int hasTerms() const
check if iterator has reached the end of CanonicalForm
CF_NO_INLINE int exp() const
get the current exponent

◆ 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 664 of file NTLconvert.cc.

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 }
long intval() const
conversion functions
bool isImm() const
void mpzval(mpz_t val) const
CFList conv(const CFFList &L)
convert a CFFList to a CFList by dropping the multiplicity
Definition: facBivar.cc:126
#define Free(A, L)
Definition: NTLconvert.cc:36
#define Alloc(L)
Definition: NTLconvert.cc:35
int l
Definition: cfEzgcd.cc:93

◆ 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 1036 of file NTLconvert.cc.

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 }
CF_NO_INLINE CanonicalForm coeff() const
get the current coefficient
factory&#39;s main class
Definition: canonicalform.h:77
int k
Definition: cfEzgcd.cc:92
ZZ_pX convertFacCF2NTLZZpX(const CanonicalForm &f)
NAME: convertFacCF2NTLZZpX.
Definition: NTLconvert.cc:59
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:125
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44
CanonicalForm mipo
Definition: facAlgExt.cc:57
CF_NO_INLINE int hasTerms() const
check if iterator has reached the end of CanonicalForm
CF_NO_INLINE int exp() const
get the current exponent
return result
Definition: facAbsBiFact.cc:76

◆ convertFacCF2NTLzz_pEX()

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

Definition at line 1063 of file NTLconvert.cc.

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 }
CF_NO_INLINE CanonicalForm coeff() const
get the current coefficient
factory&#39;s main class
Definition: canonicalform.h:77
int k
Definition: cfEzgcd.cc:92
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:125
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44
zz_pX convertFacCF2NTLzzpX(const CanonicalForm &f)
Definition: NTLconvert.cc:100
CanonicalForm mipo
Definition: facAlgExt.cc:57
CF_NO_INLINE int hasTerms() const
check if iterator has reached the end of CanonicalForm
CF_NO_INLINE int exp() const
get the current exponent
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 59 of file NTLconvert.cc.

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 }
ZZ convertFacCF2NTLZZ(const CanonicalForm &f)
NAME: convertFacCF2NTLZZX.
Definition: NTLconvert.cc:664
CF_NO_INLINE CanonicalForm coeff() const
get the current coefficient
int k
Definition: cfEzgcd.cc:92
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:125
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44
CF_NO_INLINE int hasTerms() const
check if iterator has reached the end of CanonicalForm
CF_NO_INLINE int exp() const
get the current exponent

◆ convertFacCF2NTLzzpX()

zz_pX convertFacCF2NTLzzpX ( const CanonicalForm f)

Definition at line 100 of file NTLconvert.cc.

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 }
long intval() const
conversion functions
bool isImm() const
CF_NO_INLINE CanonicalForm coeff() const
get the current coefficient
factory&#39;s main class
Definition: canonicalform.h:77
int k
Definition: cfEzgcd.cc:92
int getCharacteristic()
Definition: cf_char.cc:51
CanonicalForm mapinto() const
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:125
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44
CF_NO_INLINE int hasTerms() const
check if iterator has reached the end of CanonicalForm
CF_NO_INLINE int exp() const
get the current exponent

◆ convertFacCF2NTLZZX()

ZZX convertFacCF2NTLZZX ( const CanonicalForm f)

Definition at line 685 of file NTLconvert.cc.

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 }
ZZ convertFacCF2NTLZZ(const CanonicalForm &f)
NAME: convertFacCF2NTLZZX.
Definition: NTLconvert.cc:664
CF_NO_INLINE CanonicalForm coeff() const
get the current coefficient
int k
Definition: cfEzgcd.cc:92
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:125
class to iterate through CanonicalForm&#39;s
Definition: cf_iter.h:44
CF_NO_INLINE int hasTerms() const
check if iterator has reached the end of CanonicalForm
CF_NO_INLINE int exp() const
get the current exponent

◆ convertFacCFMatrix2NTLmat_ZZ()

mat_ZZ* convertFacCFMatrix2NTLmat_ZZ ( const CFMatrix m)

Definition at line 1137 of file NTLconvert.cc.

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 }
ZZ convertFacCF2NTLZZ(const CanonicalForm &f)
NAME: convertFacCF2NTLZZX.
Definition: NTLconvert.cc:664
int j
Definition: facHensel.cc:105
CanonicalForm res
Definition: facAbsFact.cc:64
int rows() const
Definition: ftmpl_matrix.h:43
int columns() const
Definition: ftmpl_matrix.h:44
int m
Definition: cfEzgcd.cc:121
int i
Definition: cfEzgcd.cc:125

◆ convertFacCFMatrix2NTLmat_zz_p()

mat_zz_p* convertFacCFMatrix2NTLmat_zz_p ( const CFMatrix m)

Definition at line 1166 of file NTLconvert.cc.

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 }
int j
Definition: facHensel.cc:105
CanonicalForm res
Definition: facAbsFact.cc:64
int rows() const
Definition: ftmpl_matrix.h:43
int columns() const
Definition: ftmpl_matrix.h:44
int m
Definition: cfEzgcd.cc:121
int i
Definition: cfEzgcd.cc:125

◆ convertFacCFMatrix2NTLmat_zz_pE()

mat_zz_pE* convertFacCFMatrix2NTLmat_zz_pE ( const CFMatrix m)

Definition at line 1195 of file NTLconvert.cc.

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 }
int j
Definition: facHensel.cc:105
CanonicalForm res
Definition: facAbsFact.cc:64
int rows() const
Definition: ftmpl_matrix.h:43
int columns() const
Definition: ftmpl_matrix.h:44
int m
Definition: cfEzgcd.cc:121
int i
Definition: cfEzgcd.cc:125
zz_pX convertFacCF2NTLzzpX(const CanonicalForm &f)
Definition: NTLconvert.cc:100

◆ 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 927 of file NTLconvert.cc.

928 {
929  return convertNTLGF2X2CF(rep(coefficient),x);
930 }
CanonicalForm convertNTLGF2X2CF(const GF2X &poly, const Variable &x)
NAME: convertNTLGF2X2CF.
Definition: NTLconvert.cc:315

◆ 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 315 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
int j
Definition: facHensel.cc:105
factory&#39;s main class
Definition: canonicalform.h:77
CanonicalForm mapinto() const

◆ convertNTLmat_ZZ2FacCFMatrix()

CFMatrix* convertNTLmat_ZZ2FacCFMatrix ( const mat_ZZ &  m)

Definition at line 1152 of file NTLconvert.cc.

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 }
int j
Definition: facHensel.cc:105
Matrix< CanonicalForm > CFMatrix
CanonicalForm res
Definition: facAbsFact.cc:64
int rows() const
Definition: ftmpl_matrix.h:43
int columns() const
Definition: ftmpl_matrix.h:44
int m
Definition: cfEzgcd.cc:121
int i
Definition: cfEzgcd.cc:125
CanonicalForm convertZZ2CF(const ZZ &a)
NAME: convertZZ2CF.
Definition: NTLconvert.cc:489

◆ convertNTLmat_zz_p2FacCFMatrix()

CFMatrix* convertNTLmat_zz_p2FacCFMatrix ( const mat_zz_p &  m)

Definition at line 1182 of file NTLconvert.cc.

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 }
int j
Definition: facHensel.cc:105
Matrix< CanonicalForm > CFMatrix
factory&#39;s main class
Definition: canonicalform.h:77
CanonicalForm res
Definition: facAbsFact.cc:64
int rows() const
Definition: ftmpl_matrix.h:43
int columns() const
Definition: ftmpl_matrix.h:44
int m
Definition: cfEzgcd.cc:121
int i
Definition: cfEzgcd.cc:125

◆ convertNTLmat_zz_pE2FacCFMatrix()

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

Definition at line 1211 of file NTLconvert.cc.

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 }
int j
Definition: facHensel.cc:105
Matrix< CanonicalForm > CFMatrix
CanonicalForm convertNTLzzpE2CF(const zz_pE &coefficient, const Variable &x)
Definition: NTLconvert.cc:794
Variable alpha
Definition: facAbsBiFact.cc:52
CanonicalForm res
Definition: facAbsFact.cc:64
int rows() const
Definition: ftmpl_matrix.h:43
int columns() const
Definition: ftmpl_matrix.h:44
int m
Definition: cfEzgcd.cc:121
int i
Definition: cfEzgcd.cc:125

◆ 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 954 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
int j
Definition: facHensel.cc:105
factory&#39;s main class
Definition: canonicalform.h:77
void insert(const T &)
Definition: ftmpl_list.cc:193
CanonicalForm convertNTLGF2E2CF(const GF2E &coefficient, const Variable &x)
NAME: convertNTLGF2E2CF.
Definition: NTLconvert.cc:927
int i
Definition: cfEzgcd.cc:125
static BOOLEAN IsOne(number a, const coeffs r)
Definition: flintcf_Q.cc:330
Factor< CanonicalForm > CFFactor
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
void append(const T &)
Definition: ftmpl_list.cc:256
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 439 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
int j
Definition: facHensel.cc:105
factory&#39;s main class
Definition: canonicalform.h:77
int i
Definition: cfEzgcd.cc:125
Factor< CanonicalForm > CFFactor
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
void append(const T &)
Definition: ftmpl_list.cc:256
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 820 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
int j
Definition: facHensel.cc:105
factory&#39;s main class
Definition: canonicalform.h:77
void insert(const T &)
Definition: ftmpl_list.cc:193
int i
Definition: cfEzgcd.cc:125
static BOOLEAN IsOne(number a, const coeffs r)
Definition: flintcf_Q.cc:330
Factor< CanonicalForm > CFFactor
CanonicalForm convertNTLZZpE2CF(const ZZ_pE &coefficient, const Variable &x)
NAME: convertNTLZZpX2CF.
Definition: NTLconvert.cc:790
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
void append(const T &)
Definition: ftmpl_list.cc:256
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 865 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
int j
Definition: facHensel.cc:105
CanonicalForm convertNTLzzpE2CF(const zz_pE &coefficient, const Variable &x)
Definition: NTLconvert.cc:794
factory&#39;s main class
Definition: canonicalform.h:77
void insert(const T &)
Definition: ftmpl_list.cc:193
int i
Definition: cfEzgcd.cc:125
static BOOLEAN IsOne(number a, const coeffs r)
Definition: flintcf_Q.cc:330
Factor< CanonicalForm > CFFactor
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
void append(const T &)
Definition: ftmpl_list.cc:256
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 367 of file NTLconvert.cc.

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 }
CanonicalForm convertNTLZZpX2CF(const ZZ_pX &poly, const Variable &x)
NAME: convertNTLZZpX2CF.
Definition: NTLconvert.cc:243
factory&#39;s main class
Definition: canonicalform.h:77
void insert(const T &)
Definition: ftmpl_list.cc:193
CanonicalForm b
Definition: cfModGcd.cc:4044
int i
Definition: cfEzgcd.cc:125
static BOOLEAN IsOne(number a, const coeffs r)
Definition: flintcf_Q.cc:330
Factor< CanonicalForm > CFFactor
void append(const T &)
Definition: ftmpl_list.cc:256
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 392 of file NTLconvert.cc.

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 }
factory&#39;s main class
Definition: canonicalform.h:77
CanonicalForm convertNTLzzpX2CF(const zz_pX &poly, const Variable &x)
Definition: NTLconvert.cc:248
void insert(const T &)
Definition: ftmpl_list.cc:193
CanonicalForm b
Definition: cfModGcd.cc:4044
int i
Definition: cfEzgcd.cc:125
static BOOLEAN IsOne(number a, const coeffs r)
Definition: flintcf_Q.cc:330
Factor< CanonicalForm > CFFactor
void append(const T &)
Definition: ftmpl_list.cc:256
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 747 of file NTLconvert.cc.

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 }
factory&#39;s main class
Definition: canonicalform.h:77
void insert(const T &)
Definition: ftmpl_list.cc:193
int i
Definition: cfEzgcd.cc:125
Factor< CanonicalForm > CFFactor
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
void append(const T &)
Definition: ftmpl_list.cc:256
CanonicalForm convertZZ2CF(const ZZ &a)
NAME: convertZZ2CF.
Definition: NTLconvert.cc:489
CanonicalForm convertNTLZZX2CF(const ZZX &polynom, const Variable &x)
Definition: NTLconvert.cc:278
return result
Definition: facAbsBiFact.cc:76

◆ convertNTLzz_pEX2CF()

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

Definition at line 1091 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
int j
Definition: facHensel.cc:105
CanonicalForm convertNTLzzpE2CF(const zz_pE &coefficient, const Variable &x)
Definition: NTLconvert.cc:794
factory&#39;s main class
Definition: canonicalform.h:77
CanonicalForm mapinto() const
FILE * f
Definition: checklibs.c:9

◆ convertNTLZZ_pEX2CF()

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

Definition at line 1114 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
int j
Definition: facHensel.cc:105
factory&#39;s main class
Definition: canonicalform.h:77
CanonicalForm mapinto() const
FILE * f
Definition: checklibs.c:9
CanonicalForm convertNTLZZpE2CF(const ZZ_pE &coefficient, const Variable &x)
NAME: convertNTLZZpX2CF.
Definition: NTLconvert.cc:790

◆ 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 790 of file NTLconvert.cc.

791 {
792  return convertNTLZZpX2CF(rep(coefficient),x);
793 }
CanonicalForm convertNTLZZpX2CF(const ZZ_pX &poly, const Variable &x)
NAME: convertNTLZZpX2CF.
Definition: NTLconvert.cc:243

◆ convertNTLzzpE2CF()

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

Definition at line 794 of file NTLconvert.cc.

795 {
796  return convertNTLzzpX2CF(rep(coefficient),x);
797 }
CanonicalForm convertNTLzzpX2CF(const zz_pX &poly, const Variable &x)
Definition: NTLconvert.cc:248

◆ 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 243 of file NTLconvert.cc.

244 {
245  return convertNTLZZX2CF (to_ZZX (poly), x);
246 }
CanonicalForm convertNTLZZX2CF(const ZZX &polynom, const Variable &x)
Definition: NTLconvert.cc:278

◆ convertNTLzzpX2CF()

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

Definition at line 248 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
int j
Definition: facHensel.cc:105
factory&#39;s main class
Definition: canonicalform.h:77
CanonicalForm mapinto() const

◆ convertNTLZZX2CF()

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

Definition at line 278 of file NTLconvert.cc.

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 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
int j
Definition: facHensel.cc:105
factory&#39;s main class
Definition: canonicalform.h:77
static BOOLEAN IsZero(number a, const coeffs r)
Definition: flintcf_Q.cc:326
CanonicalForm convertZZ2CF(const ZZ &a)
NAME: convertZZ2CF.
Definition: NTLconvert.cc:489

◆ 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 489 of file NTLconvert.cc.

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  {
524  Free (cf_stringtemp, cf_stringtemp_l);
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 }
int j
Definition: facHensel.cc:105
const long MINIMMEDIATE
Definition: imm.h:54
factory&#39;s main class
Definition: canonicalform.h:77
#define Free(A, L)
Definition: NTLconvert.cc:36
#define Alloc(L)
Definition: NTLconvert.cc:35
STATIC_VAR unsigned char * cf_stringtemp
Definition: NTLconvert.cc:474
const long MAXIMMEDIATE
Definition: imm.h:55
return result
Definition: facAbsBiFact.cc:76
STATIC_VAR unsigned long cf_stringtemp_l
Definition: NTLconvert.cc:475

Variable Documentation

◆ fac_NTL_char

EXTERN_VAR long fac_NTL_char

Definition at line 91 of file NTLconvert.h.