21#include <NTL/ZZXFactoring.h> 
   22#include <NTL/ZZ_pXFactoring.h> 
   23#include <NTL/lzz_pXFactoring.h> 
   24#include <NTL/GF2XFactoring.h> 
   25#include <NTL/ZZ_pEXFactoring.h> 
   26#include <NTL/lzz_pEXFactoring.h> 
   27#include <NTL/GF2EXFactoring.h> 
   29#include <NTL/mat_ZZ.h> 
   30#include <NTL/version.h> 
   36#define Alloc(L) omAlloc(L) 
   37#define Free(A,L) omFreeSize(A,L) 
   39#define Alloc(L) malloc(L) 
   40#define Free(A,L) free(A) 
   71  int NTLcurrentExp=
i.exp();
 
   72  int largestExp=
i.exp();
 
   76  ntl_poly.SetMaxLength(largestExp+1);
 
   78  for (;
i.hasTerms();
i++)
 
   80    for (
k=NTLcurrentExp;
k>
i.exp();
k--)
 
   82      SetCoeff(ntl_poly,
k,0);
 
   84    NTLcurrentExp=
i.exp();
 
   95  for (
k=NTLcurrentExp;
k>=0;
k--)
 
   97    SetCoeff(ntl_poly,
k,0);
 
  101  ntl_poly.normalize();
 
  112  int NTLcurrentExp=
i.exp();
 
  113  int largestExp=
i.exp();
 
  117  ntl_poly.SetMaxLength(largestExp+1);
 
  119  for (;
i.hasTerms();
i++)
 
  121    for (
k=NTLcurrentExp;
k>
i.exp();
k--)
 
  123      SetCoeff(ntl_poly,
k,0);
 
  125    NTLcurrentExp=
i.exp();
 
  135       cout<<
"convertFacCF2NTLzz_pX: coefficient not immediate! : "<<
f<<
"\n";
 
  138       printf(
"convertFacCF2NTLzz_pX: coefficient not immediate!, char=%d\n",
 
  145      SetCoeff(ntl_poly,NTLcurrentExp,c.
intval());
 
  155  for (
k=NTLcurrentExp;
k>=0;
k--)
 
  157    SetCoeff(ntl_poly,
k,0);
 
  161  ntl_poly.normalize();
 
  192  int NTLcurrentExp=
i.exp();
 
  193  int largestExp=
i.exp();
 
  197  ntl_poly.SetMaxLength(largestExp+1);
 
  199  for (;
i.hasTerms();
i++)
 
  202    for (
k=NTLcurrentExp;
k>
i.exp();
k--)
 
  204      SetCoeff(ntl_poly,
k,0);
 
  206    NTLcurrentExp=
i.exp();
 
  208    if (!
i.coeff().isImm()) 
i.coeff()=
i.coeff().mapinto();
 
  209    if (!
i.coeff().isImm())
 
  212      cout<<
"convertFacCF2NTLGF2X: coefficient not immediate! : " << 
f << 
"\n";
 
  215      printf(
"convertFacCF2NTLGF2X: coefficient not immediate!");
 
  221      SetCoeff(ntl_poly,NTLcurrentExp,
i.coeff().intval());
 
  225  for (
k=NTLcurrentExp;
k>=0;
k--)
 
  227    SetCoeff(ntl_poly,
k,0);
 
  268    for (
int j=0;
j<=deg(poly);
j++)
 
  270      if (coeff(poly,
j)!=0)
 
  295  for (
int j=0;
j<=deg(polynom);
j++)
 
  297    coefficient=coeff(polynom,
j);
 
  337    for (
int j=0;
j<=deg(poly);
j++)
 
  339      if (coeff(poly,
j)!=0) bigone+=
power(
x,
j);
 
  374                                  (
const vec_pair_ZZ_pX_long & e,
const ZZ_p & cont,
const Variable & 
x)
 
  389  for (
int i=e.length()-1;
i>=0;
i--)
 
  399                                  (
const vec_pair_zz_pX_long & e,
const zz_p cont,
const Variable & 
x)
 
  414  for (
int i=e.length()-1;
i>=0;
i--)
 
  446    (
const vec_pair_GF2X_long& e, GF2 , 
const Variable & 
x)
 
  461  for (
int i=e.length()-1;
i>=0;
i--)
 
  467    for (
int j=0;
j<=deg(polynom);
j++)
 
  469      if (coeff(polynom,
j)!=0)
 
  497  long coeff_long=to_long(a);
 
  500  if ( (NumBits(a)<((
long)NTL_ZZ_NBITS))
 
  509#if NTL_MAJOR_VERSION <= 6 
  510      static_cast<long *
>( a.rep );
 
  511#elif NTL_MAJOR_VERSION <=9 
  512      static_cast<long *
>( a.rep.rep ); 
 
  514      (
long*)( a.rep.rep );
 
  516    long sizeofrep= rep[1];
 
  517    bool lessZero= 
false;
 
  521      sizeofrep= -sizeofrep;
 
  534    int cc= mpn_get_str (
cf_stringtemp, 16, (mp_limb_t *) ((rep) + 2), sizeofrep);
 
  536    char* cf_stringtemp2;
 
  539      cf_stringtemp2= 
new char [cc + 2];
 
  540      cf_stringtemp2[0]=
'-';
 
  541      for (
int j= 1; 
j <= cc; 
j++)
 
  543      cf_stringtemp2[cc+1]=
'\0';
 
  547      cf_stringtemp2= 
new char [cc + 1];
 
  548      for (
int j= 0; 
j < cc; 
j++)
 
  550      cf_stringtemp2[cc]=
'\0';
 
  554    delete [] cf_stringtemp2;
 
  673  if (
f.isImm()) temp=
f.intval();
 
  681    int l=mpz_sizeinbase(gmp_val,10)+2;
 
  682    stringtemp=(
char*)
Alloc(
l);
 
  683    stringtemp=mpz_get_str(stringtemp,10,gmp_val);
 
  685    conv(temp,stringtemp);
 
  698    int NTLcurrentExp=
i.exp();
 
  699    int largestExp=
i.exp();
 
  703    ntl_poly.SetMaxLength(largestExp+1);
 
  706    for (;
i.hasTerms();
i++)
 
  708      for (
k=NTLcurrentExp;
k>
i.exp();
k--)
 
  710        SetCoeff(ntl_poly,
k,0);
 
  712      NTLcurrentExp=
i.exp();
 
  718      SetCoeff(ntl_poly,NTLcurrentExp,temp);
 
  722    for (
k=NTLcurrentExp;
k>=0;
k--)
 
  724      SetCoeff(ntl_poly,
k,0);
 
  728    ntl_poly.normalize();
 
  762  for (
int i=e.length()-1;
i>=0;
i--)
 
  837  for (
int i=e.length()-1;
i>=0;
i--)
 
  844    for (
int j=0;
j<=deg(polynom);
j++)
 
  846      if (
IsOne(coeff(polynom,
j)))
 
  853        if (coeff(polynom,
j)!=0)
 
  855          bigone += (
power(
x,
j)*coefficient);
 
  882  for (
int i=e.length()-1;
i>=0;
i--)
 
  889    for (
int j=0;
j<=deg(polynom);
j++)
 
  891      if (
IsOne(coeff(polynom,
j)))
 
  898        if (coeff(polynom,
j)!=0)
 
  900          bigone += (
power(
x,
j)*coefficient);
 
  971  for (
int i=e.length()-1;
i>=0;
i--)
 
  978    for (
int j=0;
j<=deg(polynom);
j++)
 
  980      if (
IsOne(coeff(polynom,
j)))
 
  987        if (coeff(polynom,
j)!=0)
 
  989          bigone += (
power(
x,
j)*coefficient);
 
 1014  int NTLcurrentExp=
i.exp();
 
 1015  int largestExp=
i.exp();
 
 1018  result.SetMaxLength(largestExp+1);
 
 1019  for(;
i.hasTerms();
i++)
 
 1021    for(
k=NTLcurrentExp;
k>
i.exp();
k--) SetCoeff(
result,
k,0);
 
 1022    NTLcurrentExp=
i.exp();
 
 1027    SetCoeff(
result,NTLcurrentExp,to_GF2E(cc));
 
 1030  for(
k=NTLcurrentExp;
k>=0;
k--) SetCoeff(
result,
k,0);
 
 1044  int NTLcurrentExp=
i.exp();
 
 1045  int largestExp=
i.exp();
 
 1048  result.SetMaxLength(largestExp+1);
 
 1049  for(;
i.hasTerms();
i++)
 
 1051    for(
k=NTLcurrentExp;
k>
i.exp();
k--) SetCoeff(
result,
k,0);
 
 1052    NTLcurrentExp=
i.exp();
 
 1057    SetCoeff(
result,NTLcurrentExp,to_ZZ_pE(cc));
 
 1060  for(
k=NTLcurrentExp;
k>=0;
k--) SetCoeff(
result,
k,0);
 
 1071  int NTLcurrentExp=
i.exp();
 
 1072  int largestExp=
i.exp();
 
 1075  result.SetMaxLength(largestExp+1);
 
 1076  for(;
i.hasTerms();
i++)
 
 1078    for(
k=NTLcurrentExp;
k>
i.exp();
k--) SetCoeff(
result,
k,0);
 
 1079    NTLcurrentExp=
i.exp();
 
 1084    SetCoeff(
result,NTLcurrentExp,to_zz_pE(cc));
 
 1087  for(
k=NTLcurrentExp;
k>=0;
k--) SetCoeff(
result,
k,0);
 
 1099    for (
int j=0;
j<deg(
f)+1;
j++)
 
 1122    for (
int j=0;
j<deg(
f)+1;
j++)
 
 1140  mat_ZZ *
res=
new mat_ZZ;
 
 1141  res->SetDims(
m.rows(),
m.columns());
 
 1144  for(
i=
m.rows();
i>0;
i--)
 
 1146    for(
j=
m.columns();
j>0;
j--)
 
 1157  for(
i=
res->rows();
i>0;
i--)
 
 1159    for(
j=
res->columns();
j>0;
j--)
 
 1169  mat_zz_p *
res=
new mat_zz_p;
 
 1170  res->SetDims(
m.rows(),
m.columns());
 
 1173  for(
i=
m.rows();
i>0;
i--)
 
 1175    for(
j=
m.columns();
j>0;
j--)
 
 1177      if(!(
m(
i,
j)).isImm()) printf(
"convertFacCFMatrix2NTLmat_zz_p: not imm.\n");
 
 1178      (*res)(
i,
j)=(
m(
i,
j)).intval();
 
 1187  for(
i=
res->rows();
i>0;
i--)
 
 1189    for(
j=
res->columns();
j>0;
j--)
 
 1198  mat_zz_pE *
res=
new mat_zz_pE;
 
 1199  res->SetDims(
m.rows(),
m.columns());
 
 1202  for(
i=
m.rows();
i>0;
i--)
 
 1204    for(
j=
m.columns();
j>0;
j--)
 
 1207      (*res)(
i,
j)=to_zz_pE(cc);
 
 1216  for(
i=
res->rows();
i>0;
i--)
 
 1218    for(
j=
res->columns();
j>0;
j--)
 
CFMatrix * convertNTLmat_zz_p2FacCFMatrix(const mat_zz_p &m)
 
CanonicalForm convertNTLZZpE2CF(const ZZ_pE &coefficient, const Variable &x)
NAME: convertNTLZZpX2CF.
 
STATIC_VAR unsigned char * cf_stringtemp
 
CanonicalForm convertZZ2CF(const ZZ &a)
NAME: convertZZ2CF.
 
CFFList convertNTLvec_pair_GF2X_long2FacCFFList(const vec_pair_GF2X_long &e, GF2, const Variable &x)
NAME: convertNTLvec_pair_GF2X_long2FacCFFList.
 
CanonicalForm convertNTLGF2E2CF(const GF2E &coefficient, const Variable &x)
NAME: convertNTLGF2E2CF.
 
ZZX convertFacCF2NTLZZX(const CanonicalForm &f)
 
zz_pEX convertFacCF2NTLzz_pEX(const CanonicalForm &f, const zz_pX &mipo)
 
CFMatrix * convertNTLmat_zz_pE2FacCFMatrix(const mat_zz_pE &m, const Variable &alpha)
 
CFFList convertNTLvec_pair_zzpEX_long2FacCFFList(const vec_pair_zz_pEX_long &e, const zz_pE &cont, const Variable &x, const Variable &alpha)
 
CFFList convertNTLvec_pair_GF2EX_long2FacCFFList(const vec_pair_GF2EX_long &e, const GF2E &cont, const Variable &x, const Variable &alpha)
NAME: convertNTLvec_pair_GF2EX_long2FacCFFList.
 
CanonicalForm convertNTLzz_pEX2CF(const zz_pEX &f, const Variable &x, const Variable &alpha)
 
ZZ_pEX convertFacCF2NTLZZ_pEX(const CanonicalForm &f, const ZZ_pX &mipo)
CanonicalForm in Z_p(a)[X] to NTL ZZ_pEX.
 
CanonicalForm convertNTLzzpX2CF(const zz_pX &poly, const Variable &x)
 
CFFList convertNTLvec_pair_zzpX_long2FacCFFList(const vec_pair_zz_pX_long &e, const zz_p cont, const Variable &x)
 
mat_zz_pE * convertFacCFMatrix2NTLmat_zz_pE(const CFMatrix &m)
 
GF2EX convertFacCF2NTLGF2EX(const CanonicalForm &f, const GF2X &mipo)
CanonicalForm in Z_2(a)[X] to NTL GF2EX.
 
CanonicalForm convertNTLZZpX2CF(const ZZ_pX &poly, const Variable &x)
NAME: convertNTLZZpX2CF.
 
CanonicalForm convertNTLZZX2CF(const ZZX &polynom, const Variable &x)
 
CFFList convertNTLvec_pair_ZZpEX_long2FacCFFList(const vec_pair_ZZ_pEX_long &e, const ZZ_pE &cont, const Variable &x, const Variable &alpha)
NAME: convertNTLvec_pair_ZZpEX_long2FacCFFList.
 
CanonicalForm convertNTLZZ_pEX2CF(const ZZ_pEX &f, const Variable &x, const Variable &alpha)
 
void out_cf(const char *s1, const CanonicalForm &f, const char *s2)
cf_algorithm.cc - simple mathematical algorithms.
 
CanonicalForm convertNTLzzpE2CF(const zz_pE &coefficient, const Variable &x)
 
zz_pX convertFacCF2NTLzzpX(const CanonicalForm &f)
 
ZZ_pX convertFacCF2NTLZZpX(const CanonicalForm &f)
NAME: convertFacCF2NTLZZpX.
 
mat_ZZ * convertFacCFMatrix2NTLmat_ZZ(const CFMatrix &m)
 
CFFList convertNTLvec_pair_ZZpX_long2FacCFFList(const vec_pair_ZZ_pX_long &e, const ZZ_p &cont, const Variable &x)
NAME: convertNTLvec_pair_ZZpX_long2FacCFFList.
 
mat_zz_p * convertFacCFMatrix2NTLmat_zz_p(const CFMatrix &m)
 
CFMatrix * convertNTLmat_ZZ2FacCFMatrix(const mat_ZZ &m)
 
GF2X convertFacCF2NTLGF2X(const CanonicalForm &f)
NAME: convertFacCF2NTLGF2X.
 
STATIC_VAR unsigned long cf_stringtemp_l
 
ZZ convertFacCF2NTLZZ(const CanonicalForm &f)
NAME: convertFacCF2NTLZZX.
 
CanonicalForm convertNTLGF2X2CF(const GF2X &poly, const Variable &x)
NAME: convertNTLGF2X2CF.
 
CFFList convertNTLvec_pair_ZZX_long2FacCFFList(const vec_pair_ZZX_long &e, const ZZ &cont, const Variable &x)
NAME: convertNTLvec_pair_ZZX_long2FacCFFList.
 
Conversion to and from NTL.
 
declarations of higher level algorithms.
 
Iterators for CanonicalForm's.
 
class to iterate through CanonicalForm's
 
factory's class for variables
 
CFList conv(const CFFList &L)
convert a CFFList to a CFList by dropping the multiplicity
 
squarefree part and factorization over Q, Q(a)
 
static BOOLEAN IsOne(number a, const coeffs)
 
static BOOLEAN IsZero(number a, const coeffs)
 
Factory's internal integers.