Changeset c729f2 in git for factory/NTLconvert.cc
- Timestamp:
- Mar 5, 2012, 10:05:50 PM (11 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 47dc5eae8e5fa15711c4af64c3ce91a844425401
- Parents:
- b78a13dc05baa2440a909f8b9174e8b4491d56cc
- git-author:
- Martin Lee <martinlee84@web.de>2012-03-05 22:05:50+01:00
- git-committer:
- Martin Lee <martinlee84@web.de>2012-04-04 14:42:26+02:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/NTLconvert.cc
rb78a13 rc729f2 84 84 NTLcurrentExp=i.exp(); 85 85 86 CanonicalForm c=i.coeff(); 87 if (!c.isImm()) c=c.mapinto(); //c%= getCharacteristic(); 88 if (!c.isImm()) 89 { //This case will never happen if the characteristic is in fact a prime 90 // number, since all coefficients are represented as immediates 91 #ifndef NOSTREAMIO 92 cout<<"convertFacCF2NTLZZ_pX: coefficient not immediate! : "<<f<<"\n"; 93 #else 94 //NTL_SNS 95 printf("convertFacCF2NTLZZ_pX: coefficient not immediate!, char=%d\n", 96 getCharacteristic()); 97 #endif 98 NTL_SNS exit(1); 99 } 100 else 101 { 102 SetCoeff(ntl_poly,NTLcurrentExp,c.intval()); 103 } 86 SetCoeff(ntl_poly,NTLcurrentExp,to_ZZ_p (convertFacCF2NTLZZ (i.coeff()))); 104 87 NTLcurrentExp--; 105 88 } … … 265 248 CanonicalForm convertNTLZZpX2CF(ZZ_pX poly,Variable x) 266 249 { 267 //printf("convertNTLZZpX2CF\n"); 268 CanonicalForm bigone; 269 270 271 if (deg(poly)>0) 272 { 273 // poly is non-constant 274 bigone=0; 275 bigone.mapinto(); 276 // Compute the canonicalform coefficient by coefficient, 277 // bigone summarizes the result. 278 for (int j=0;j<=deg(poly);j++) 279 { 280 if (coeff(poly,j)!=0) 281 { 282 bigone+=(power(x,j)*CanonicalForm(to_long(rep(coeff(poly,j))))); 283 } 284 } 285 } 286 else 287 { 288 // poly is immediate 289 bigone=CanonicalForm(to_long(rep(coeff(poly,0)))); 290 bigone.mapinto(); 291 } 292 return bigone; 250 return convertNTLZZX2CF (to_ZZX (poly), x); 293 251 } 294 252 … … 1145 1103 return bigone; 1146 1104 } 1105 1106 CanonicalForm convertNTLZZ_pEX2CF (ZZ_pEX f, Variable x, Variable alpha) 1107 { 1108 CanonicalForm bigone; 1109 if (deg (f) > 0) 1110 { 1111 bigone= 0; 1112 bigone.mapinto(); 1113 for (int j=0;j<deg(f)+1;j++) 1114 { 1115 if (coeff(f,j)!=0) 1116 { 1117 bigone+=(power(x,j)*convertNTLZZpE2CF(coeff(f,j),alpha)); 1118 } 1119 } 1120 } 1121 else 1122 { 1123 bigone= convertNTLZZpE2CF(coeff(f,0),alpha); 1124 bigone.mapinto(); 1125 } 1126 return bigone; 1127 } 1147 1128 //---------------------------------------------------------------------- 1148 1129 mat_ZZ* convertFacCFMatrix2NTLmat_ZZ(CFMatrix &m)
Note: See TracChangeset
for help on using the changeset viewer.