 |
My Project
UNKNOWN_GIT_VERSION
|
Go to the documentation of this file.
21 #include <NTL/ZZXFactoring.h>
22 #include <NTL/ZZ_pXFactoring.h>
23 #include <NTL/lzz_pXFactoring.h>
24 #include <NTL/GF2XFactoring.h>
25 #include <NTL/ZZ_pEXFactoring.h>
26 #include <NTL/lzz_pEXFactoring.h>
27 #include <NTL/GF2EXFactoring.h>
28 #include <NTL/tools.h>
29 #include <NTL/mat_ZZ.h>
30 #include <NTL/version.h>
35 #define Alloc(L) malloc(L)
36 #define Free(A,L) free(A)
43 #ifdef NTL_CLIENT // in <NTL/tools.h>: using of name space NTL
66 int NTLcurrentExp=
i.exp();
67 int largestExp=
i.exp();
71 ntl_poly.SetMaxLength(largestExp+1);
73 for (;
i.hasTerms();
i++)
75 for (
k=NTLcurrentExp;
k>
i.exp();
k--)
77 SetCoeff(ntl_poly,
k,0);
79 NTLcurrentExp=
i.exp();
90 for (
k=NTLcurrentExp;
k>=0;
k--)
92 SetCoeff(ntl_poly,
k,0);
107 int NTLcurrentExp=
i.exp();
108 int largestExp=
i.exp();
112 ntl_poly.SetMaxLength(largestExp+1);
114 for (;
i.hasTerms();
i++)
116 for (
k=NTLcurrentExp;
k>
i.exp();
k--)
118 SetCoeff(ntl_poly,
k,0);
120 NTLcurrentExp=
i.exp();
128 cout<<
"convertFacCF2NTLzz_pX: coefficient not immediate! : "<<
f<<
"\n";
131 printf(
"convertFacCF2NTLzz_pX: coefficient not immediate!, char=%d\n",
138 SetCoeff(ntl_poly,NTLcurrentExp,c.
intval());
148 for (
k=NTLcurrentExp;
k>=0;
k--)
150 SetCoeff(ntl_poly,
k,0);
154 ntl_poly.normalize();
185 int NTLcurrentExp=
i.exp();
186 int largestExp=
i.exp();
190 ntl_poly.SetMaxLength(largestExp+1);
192 for (;
i.hasTerms();
i++)
195 for (
k=NTLcurrentExp;
k>
i.exp();
k--)
197 SetCoeff(ntl_poly,
k,0);
199 NTLcurrentExp=
i.exp();
201 if (!
i.coeff().isImm())
i.coeff()=
i.coeff().mapinto();
202 if (!
i.coeff().isImm())
205 cout<<
"convertFacCF2NTLGF2X: coefficient not immediate! : " <<
f <<
"\n";
208 printf(
"convertFacCF2NTLGF2X: coefficient not immediate!");
214 SetCoeff(ntl_poly,NTLcurrentExp,
i.coeff().intval());
218 for (
k=NTLcurrentExp;
k>=0;
k--)
220 SetCoeff(ntl_poly,
k,0);
261 for (
int j=0;
j<=deg(poly);
j++)
288 for (
int j=0;
j<=deg(polynom);
j++)
290 coefficient=
coeff(polynom,
j);
330 for (
int j=0;
j<=deg(poly);
j++)
367 (
const vec_pair_ZZ_pX_long & e,
const ZZ_p & multi,
const Variable &
x)
382 for (
int i=e.length()-1;
i>=0;
i--)
392 (
const vec_pair_zz_pX_long & e,
const zz_p multi,
const Variable &
x)
407 for (
int i=e.length()-1;
i>=0;
i--)
439 (
const vec_pair_GF2X_long& e, GF2 ,
const Variable &
x)
456 for (
int i=e.length()-1;
i>=0;
i--)
462 for (
int j=0;
j<=deg(polynom);
j++)
491 long coeff_long=to_long(a);
494 if ( (NumBits(a)<((
long)NTL_ZZ_NBITS))
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 );
508 (
long*)( a.rep.rep );
510 long sizeofrep= rep[1];
511 bool lessZero=
false;
515 sizeofrep= -sizeofrep;
528 int cc= mpn_get_str (
cf_stringtemp, 16, (mp_limb_t *) ((rep) + 2), sizeofrep);
530 char* cf_stringtemp2;
533 cf_stringtemp2=
new char [cc + 2];
534 cf_stringtemp2[0]=
'-';
535 for (
int j= 1;
j <= cc;
j++)
537 cf_stringtemp2[cc+1]=
'\0';
541 cf_stringtemp2=
new char [cc + 1];
542 for (
int j= 0;
j < cc;
j++)
544 cf_stringtemp2[cc]=
'\0';
548 delete [] cf_stringtemp2;
667 if (
f.isImm()) temp=
f.intval();
675 int l=mpz_sizeinbase(gmp_val,10)+2;
676 stringtemp=(
char*)
Alloc(
l);
677 stringtemp=mpz_get_str(stringtemp,10,gmp_val);
679 conv(temp,stringtemp);
692 int NTLcurrentExp=
i.exp();
693 int largestExp=
i.exp();
697 ntl_poly.SetMaxLength(largestExp+1);
700 for (;
i.hasTerms();
i++)
702 for (
k=NTLcurrentExp;
k>
i.exp();
k--)
704 SetCoeff(ntl_poly,
k,0);
706 NTLcurrentExp=
i.exp();
712 SetCoeff(ntl_poly,NTLcurrentExp,temp);
716 for (
k=NTLcurrentExp;
k>=0;
k--)
718 SetCoeff(ntl_poly,
k,0);
722 ntl_poly.normalize();
756 for (
int i=e.length()-1;
i>=0;
i--)
832 for (
int i=e.length()-1;
i>=0;
i--)
839 for (
int j=0;
j<=deg(polynom);
j++)
850 bigone += (
power(
x,
j)*coefficient);
877 for (
int i=e.length()-1;
i>=0;
i--)
884 for (
int j=0;
j<=deg(polynom);
j++)
895 bigone += (
power(
x,
j)*coefficient);
968 for (
int i=e.length()-1;
i>=0;
i--)
975 for (
int j=0;
j<=deg(polynom);
j++)
986 bigone += (
power(
x,
j)*coefficient);
1013 int NTLcurrentExp=
i.exp();
1014 int largestExp=
i.exp();
1017 result.SetMaxLength(largestExp+1);
1018 for(;
i.hasTerms();
i++)
1020 for(
k=NTLcurrentExp;
k>
i.exp();
k--) SetCoeff(
result,
k,0);
1021 NTLcurrentExp=
i.exp();
1026 SetCoeff(
result,NTLcurrentExp,to_GF2E(cc));
1029 for(
k=NTLcurrentExp;
k>=0;
k--) SetCoeff(
result,
k,0);
1043 int NTLcurrentExp=
i.exp();
1044 int largestExp=
i.exp();
1047 result.SetMaxLength(largestExp+1);
1048 for(;
i.hasTerms();
i++)
1050 for(
k=NTLcurrentExp;
k>
i.exp();
k--) SetCoeff(
result,
k,0);
1051 NTLcurrentExp=
i.exp();
1056 SetCoeff(
result,NTLcurrentExp,to_ZZ_pE(cc));
1059 for(
k=NTLcurrentExp;
k>=0;
k--) SetCoeff(
result,
k,0);
1070 int NTLcurrentExp=
i.exp();
1071 int largestExp=
i.exp();
1074 result.SetMaxLength(largestExp+1);
1075 for(;
i.hasTerms();
i++)
1077 for(
k=NTLcurrentExp;
k>
i.exp();
k--) SetCoeff(
result,
k,0);
1078 NTLcurrentExp=
i.exp();
1083 SetCoeff(
result,NTLcurrentExp,to_zz_pE(cc));
1086 for(
k=NTLcurrentExp;
k>=0;
k--) SetCoeff(
result,
k,0);
1098 for (
int j=0;
j<deg(
f)+1;
j++)
1121 for (
int j=0;
j<deg(
f)+1;
j++)
1139 mat_ZZ *
res=
new mat_ZZ;
1140 res->SetDims(
m.rows(),
m.columns());
1143 for(
i=
m.rows();
i>0;
i--)
1145 for(
j=
m.columns();
j>0;
j--)
1156 for(
i=
res->rows();
i>0;
i--)
1158 for(
j=
res->columns();
j>0;
j--)
1168 mat_zz_p *
res=
new mat_zz_p;
1169 res->SetDims(
m.rows(),
m.columns());
1172 for(
i=
m.rows();
i>0;
i--)
1174 for(
j=
m.columns();
j>0;
j--)
1176 if(!(
m(
i,
j)).isImm()) printf(
"convertFacCFMatrix2NTLmat_zz_p: not imm.\n");
1186 for(
i=
res->rows();
i>0;
i--)
1188 for(
j=
res->columns();
j>0;
j--)
1197 mat_zz_pE *
res=
new mat_zz_pE;
1198 res->SetDims(
m.rows(),
m.columns());
1201 for(
i=
m.rows();
i>0;
i--)
1203 for(
j=
m.columns();
j>0;
j--)
1206 (*res)(
i,
j)=to_zz_pE(cc);
1215 for(
i=
res->rows();
i>0;
i--)
1217 for(
j=
res->columns();
j>0;
j--)
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
CanonicalForm convertZZ2CF(const ZZ &a)
NAME: convertZZ2CF.
CFMatrix * convertNTLmat_zz_pE2FacCFMatrix(const mat_zz_pE &m, const Variable &alpha)
zz_pX convertFacCF2NTLzzpX(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.
mat_zz_pE * convertFacCFMatrix2NTLmat_zz_pE(const CFMatrix &m)
class to iterate through CanonicalForm's
CFFList convertNTLvec_pair_zzpX_long2FacCFFList(const vec_pair_zz_pX_long &e, const zz_p multi, const Variable &x)
static unsigned char * cf_stringtemp
ZZ_pEX convertFacCF2NTLZZ_pEX(const CanonicalForm &f, const ZZ_pX &mipo)
CanonicalForm in Z_p(a)[X] to NTL ZZ_pEX.
static unsigned long cf_stringtemp_l
CanonicalForm convertNTLZZpE2CF(const ZZ_pE &coefficient, const Variable &x)
NAME: convertNTLZZpX2CF.
static BOOLEAN IsOne(number a, const coeffs r)
CanonicalForm convertNTLZZ_pEX2CF(const ZZ_pEX &f, const Variable &x, const Variable &alpha)
CFMatrix * convertNTLmat_zz_p2FacCFMatrix(const mat_zz_p &m)
CanonicalForm convertNTLGF2X2CF(const GF2X &poly, const Variable &x)
NAME: convertNTLGF2X2CF.
CanonicalForm convertNTLzzpE2CF(const zz_pE &coefficient, const Variable &x)
CanonicalForm convertNTLZZpX2CF(const ZZ_pX &poly, const Variable &x)
NAME: convertNTLZZpX2CF.
CFFList convertNTLvec_pair_GF2X_long2FacCFFList(const vec_pair_GF2X_long &e, GF2, const Variable &x)
NAME: convertNTLvec_pair_GF2X_long2FacCFFList.
zz_pEX convertFacCF2NTLzz_pEX(const CanonicalForm &f, const zz_pX &mipo)
CFList conv(const CFFList &L)
convert a CFFList to a CFList by dropping the multiplicity
virtual CanonicalForm coeff(int i)
CanonicalForm InternalCF::coeff ( int i )
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)
mat_ZZ * convertFacCFMatrix2NTLmat_ZZ(const CFMatrix &m)
mat_zz_p * convertFacCFMatrix2NTLmat_zz_p(const CFMatrix &m)
ZZ_pX convertFacCF2NTLZZpX(const CanonicalForm &f)
NAME: convertFacCF2NTLZZpX.
ZZX convertFacCF2NTLZZX(const CanonicalForm &f)
void out_cf(const char *s1, const CanonicalForm &f, const char *s2)
cf_algorithm.cc - simple mathematical algorithms.
CFMatrix * convertNTLmat_ZZ2FacCFMatrix(const mat_ZZ &m)
GF2EX convertFacCF2NTLGF2EX(const CanonicalForm &f, const GF2X &mipo)
CanonicalForm in Z_2(a)[X] to NTL GF2EX.
static BOOLEAN IsZero(number a, const coeffs r)
factory's class for variables
CanonicalForm convertNTLGF2E2CF(const GF2E &coefficient, const Variable &x)
NAME: convertNTLGF2E2CF.
CanonicalForm convertNTLZZX2CF(const ZZX &polynom, const Variable &x)
GF2X convertFacCF2NTLGF2X(const CanonicalForm &f)
NAME: convertFacCF2NTLGF2X.
ZZ convertFacCF2NTLZZ(const CanonicalForm &f)
NAME: convertFacCF2NTLZZX.
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.
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.
CanonicalForm convertNTLzzpX2CF(const zz_pX &poly, 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.