Changeset f36755 in git
 Timestamp:
 Aug 15, 2013, 1:36:09 PM (10 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
 Children:
 d2fc7499626d249cfc3ad438edba68d30192d631
 Parents:
 dfa84937f0c3f7da5b22bc6282fb9c46eccad506
 gitauthor:
 Martin Lee <martinlee84@web.de>20130815 13:36:09+02:00
 gitcommitter:
 Martin Lee <martinlee84@web.de>20130830 13:48:32+02:00
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

factory/facAbsBiFact.cc
rdfa849 rf36755 157 157 158 158 //TODO optimize choice of p > choose p as large as possible (better than small p since factorization mod p does not require field extension, also less lifting) 159 int choosePoint (const CanonicalForm& F, int tdegF, CFArray& eval, bool rec) 159 int 160 choosePoint (const CanonicalForm& F, int tdegF, CFArray& eval, bool rec, 161 int absValue) 160 162 { 161 REvaluation E1 (1, 1, IntRandom ( 25));162 REvaluation E2 (2, 2, IntRandom ( 25));163 REvaluation E1 (1, 1, IntRandom (absValue)); 164 REvaluation E2 (2, 2, IntRandom (absValue)); 163 165 if (rec) 164 166 { … … 166 168 E2.nextpoint(); 167 169 } 170 168 171 CanonicalForm f, f1, f2, Fp; 169 172 int i, p; 170 eval=CFArray (2); 173 CFFList f1Factors, f2Factors; 174 CFFListIterator iter; 175 int count= 0; 171 176 while (1) 172 177 { 173 f1= E1(F); 174 if (!f1.isZero() && factorize (f1).length() == 2) 175 { 176 Off (SW_RATIONAL); 177 f= E2(f1); 178 f2= E2 (F); 179 if ((!f.isZero()) && (abs(f)>cf_getSmallPrime (cf_getNumSmallPrimes()1))) 178 count++; 179 f1= E1 (F); 180 if (!f1.isZero() && degree (f1) == degree (F,2)) 181 { 182 f1Factors= factorize (f1); 183 if (f1Factors.getFirst().factor().inCoeffDomain()) 184 f1Factors.removeFirst(); 185 if (f1Factors.length() == 1 && f1Factors.getFirst().exp() == 1) 180 186 { 181 for (i= cf_getNumPrimes()1; i >= 0; i) 187 f= E2(f1); 188 f2= E2 (F); 189 f2Factors= factorize (f2); 190 Off (SW_RATIONAL); 191 if (f2Factors.getFirst().factor().inCoeffDomain()) 192 f2Factors.removeFirst(); 193 if (f2Factors.length() == 1 && f2Factors.getFirst().exp() == 1) 182 194 { 183 if (f % CanonicalForm (cf_getPrime (i)) == 0) 195 ZZX NTLf1= convertFacCF2NTLZZX (f1); 196 ZZX NTLf2= convertFacCF2NTLZZX (f2); 197 ZZ NTLD1= discriminant (NTLf1); 198 ZZ NTLD2= discriminant (NTLf2); 199 CanonicalForm D1= convertZZ2CF (NTLD1); 200 CanonicalForm D2= convertZZ2CF (NTLD2); 201 if ((!f.isZero()) && 202 (abs(f)>cf_getSmallPrime (cf_getNumSmallPrimes()1))) 184 203 { 185 p= cf_getPrime(i); 186 Fp= mod (F,p); 187 if (totaldegree (Fp) == tdegF && 188 degree (mod (f2,p), 1) == degree (F,1) && 189 degree (mod (f1, p),2) == degree (F,2)) 204 for (i= cf_getNumPrimes()1; i >= 0; i) 190 205 { 191 eval[0]= E1[1]; 192 eval[1]= E2[2]; 193 return p; 206 if (f % CanonicalForm (cf_getPrime (i)) == 0) 207 { 208 p= cf_getPrime(i); 209 Fp= mod (F,p); 210 if (totaldegree (Fp) == tdegF && 211 degree (mod (f2,p), 1) == degree (F,1) && 212 degree (mod (f1, p),2) == degree (F,2)) 213 { 214 if (mod (D1, p) != 0 && mod (D2, p) != 0) 215 { 216 eval[0]= E1[1]; 217 eval[1]= E2[2]; 218 return p; 219 } 220 } 221 } 222 } 223 } 224 else if (!f.isZero()) 225 { 226 for (i= cf_getNumSmallPrimes()1; i >= 0; i) 227 { 228 if (f % CanonicalForm (cf_getSmallPrime (i)) == 0) 229 { 230 p= cf_getSmallPrime (i); 231 Fp= mod (F,p); 232 if (totaldegree (Fp) == tdegF && 233 degree (mod (f2, p),1) == degree (F,1) && 234 degree (mod (f1,p),2) == degree (F,2)) 235 { 236 if (mod (D1, p) != 0 && mod (D2, p) != 0) 237 { 238 eval[0]= E1[1]; 239 eval[1]= E2[2]; 240 return p; 241 } 242 } 243 } 194 244 } 195 245 } 196 246 } 247 E2.nextpoint(); 248 On (SW_RATIONAL); 197 249 } 198 else if (!f.isZero()) 199 { 200 for (i= cf_getNumSmallPrimes()1; i >= 0; i) 201 { 202 if (f % CanonicalForm (cf_getSmallPrime (i)) == 0) 203 { 204 p= cf_getSmallPrime (i); 205 Fp= mod (F,p); 206 if (totaldegree (Fp) == tdegF && 207 degree (mod (f2, p),1) == degree (F,1) && 208 degree (mod (f1,p),2) == degree (F,2)) 209 { 210 eval[0]= E1[1]; 211 eval[1]= E2[2]; 212 return p; 213 } 214 } 215 } 216 } 250 } 251 E1.nextpoint(); 252 if (count == 2) 253 { 254 count= 0; 255 absValue++; 256 E1=REvaluation (1, 1, IntRandom (absValue)); 257 E2=REvaluation (2, 2, IntRandom (absValue)); 258 E1.nextpoint(); 217 259 E2.nextpoint(); 218 On (SW_RATIONAL); 219 } 220 E1.nextpoint(); 260 } 221 261 } 222 262 return 0; … … 231 271 F /= icontent (F); 232 272 On (SW_RATIONAL); 233 CFArray eval;234 273 int minTdeg, tdegF= totaldegree (F); 235 274 CanonicalForm Fp, smallestFactor; … … 242 281 CanonicalForm bufF= F; 243 282 CFFListIterator iter; 283 CFArray eval= CFArray (2); 284 int absValue= 1; 244 285 differentevalpoint: 245 286 while (1) 246 287 { 247 288 TIMING_START (fac_evalpoint); 248 p= choosePoint (F, tdegF, eval, rec );289 p= choosePoint (F, tdegF, eval, rec, absValue); 249 290 TIMING_END_AND_PRINT (fac_evalpoint, "time to find eval point: "); 250 291
Note: See TracChangeset
for help on using the changeset viewer.