Changeset f8ac2df in git for factory/facBivar.cc
- Timestamp:
- Jan 9, 2012, 2:01:10 PM (12 years ago)
- Branches:
- (u'spielwiese', 'd0474371d8c5d8068ab70bfb42719c97936b18a6')
- Children:
- 97a0599a2c91cf3fd4b1b2efcdf9d0a40caf5746
- Parents:
- 4bafa67969ab030397c6410e512aadf5574be0dc
- git-author:
- Martin Lee <martinlee84@web.de>2012-01-09 14:01:10+01:00
- git-committer:
- Martin Lee <martinlee84@web.de>2012-04-04 14:42:24+02:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facBivar.cc
r4bafa67 rf8ac2df 22 22 #include "facFqBivar.h" 23 23 #include "facBivar.h" 24 #include "facHensel.h" 24 25 25 26 #ifdef HAVE_NTL … … 81 82 i++; 82 83 } while (1); 84 } 85 86 CFList 87 earlyFactorDetection0 (CanonicalForm& F, CFList& factors,int& adaptedLiftBound, 88 DegreePattern& degs, bool& success, int deg) 89 { 90 DegreePattern bufDegs1= degs; 91 DegreePattern bufDegs2; 92 CFList result; 93 CFList T= factors; 94 CanonicalForm buf= F; 95 CanonicalForm LCBuf= LC (buf, Variable (1)); 96 CanonicalForm g, quot; 97 CanonicalForm M= power (F.mvar(), deg); 98 adaptedLiftBound= 0; 99 int d= degree (F) + degree (LCBuf, F.mvar()); 100 for (CFListIterator i= factors; i.hasItem(); i++) 101 { 102 if (!bufDegs1.find (degree (i.getItem(), 1))) 103 continue; 104 else 105 { 106 g= i.getItem() (0, 1); 107 g *= LCBuf; 108 g= mod (g, M); 109 if (fdivides (LC (g), LCBuf)) 110 { 111 g= mulMod2 (i.getItem(), LCBuf, M); 112 g /= content (g, Variable (1)); 113 if (fdivides (g, buf, quot)) 114 { 115 result.append (g); 116 buf= quot; 117 d -= degree (g) + degree (LC (g, Variable (1)), F.mvar()); 118 LCBuf= LC (buf, Variable (1)); 119 T= Difference (T, CFList (i.getItem())); 120 121 // compute new possible degree pattern 122 bufDegs2= DegreePattern (T); 123 bufDegs1.intersect (bufDegs2); 124 bufDegs1.refine (); 125 if (bufDegs1.getLength() <= 1) 126 { 127 result.append (buf); 128 break; 129 } 130 } 131 } 132 } 133 } 134 adaptedLiftBound= d + 1; 135 if (d < deg) 136 { 137 factors= T; 138 degs= bufDegs1; 139 F= buf; 140 success= true; 141 } 142 if (bufDegs1.getLength() <= 1) 143 degs= bufDegs1; 144 return result; 145 } 146 147 148 CFList 149 henselLiftAndEarly0 (CanonicalForm& A, bool& earlySuccess, CFList& 150 earlyFactors, DegreePattern& degs, int& liftBound, 151 const CFList& uniFactors, const CanonicalForm& eval) 152 { 153 int sizeOfLiftPre; 154 int * liftPre= getLiftPrecisions (A, sizeOfLiftPre, degree (LC (A, 1), 2)); 155 156 Variable x= Variable (1); 157 Variable y= Variable (2); 158 CFArray Pi; 159 CFList diophant; 160 CFList bufUniFactors= uniFactors; 161 bufUniFactors.insert (LC (A, x)); 162 CFMatrix M= CFMatrix (liftBound, bufUniFactors.length() - 1); 163 earlySuccess= false; 164 int newLiftBound= 0; 165 int smallFactorDeg= tmin (11, liftPre [sizeOfLiftPre- 1] + 1);//this is a tunable parameter 166 if (smallFactorDeg >= liftBound || degree (A,y) <= 4) 167 henselLift12 (A, bufUniFactors, liftBound, Pi, diophant, M); 168 else if (sizeOfLiftPre > 1 && sizeOfLiftPre < 30) 169 { 170 henselLift12 (A, bufUniFactors, smallFactorDeg, Pi, diophant, M); 171 earlyFactors= earlyFactorDetection0 (A, bufUniFactors, newLiftBound, 172 degs, earlySuccess, 173 smallFactorDeg); 174 if (degs.getLength() > 1 && !earlySuccess && 175 smallFactorDeg != liftPre [sizeOfLiftPre-1] + 1) 176 { 177 if (newLiftBound > liftPre[sizeOfLiftPre-1]+1) 178 { 179 bufUniFactors.insert (LC (A, x)); 180 henselLiftResume12 (A, bufUniFactors, smallFactorDeg, 181 liftPre[sizeOfLiftPre-1] + 1, Pi, diophant, M); 182 earlyFactors= earlyFactorDetection0 (A, bufUniFactors, newLiftBound, 183 degs, earlySuccess, liftPre[sizeOfLiftPre-1] + 1); 184 } 185 } 186 else if (earlySuccess) 187 liftBound= newLiftBound; 188 int i= sizeOfLiftPre - 1; 189 while (degs.getLength() > 1 && !earlySuccess && i - 1 >= 0) 190 { 191 if (newLiftBound > liftPre[i] + 1) 192 { 193 bufUniFactors.insert (LC (A, x)); 194 henselLiftResume12 (A, bufUniFactors, liftPre[i] + 1, 195 liftPre[i-1] + 1, Pi, diophant, M); 196 earlyFactors= earlyFactorDetection0 (A, bufUniFactors, newLiftBound, 197 degs, earlySuccess, liftPre[i-1] + 1); 198 } 199 else 200 { 201 liftBound= newLiftBound; 202 break; 203 } 204 i--; 205 } 206 if (earlySuccess) 207 liftBound= newLiftBound; 208 //after here all factors are lifted to liftPre[sizeOfLiftPre-1] 209 } 210 else 211 { 212 henselLift12 (A, bufUniFactors, smallFactorDeg, Pi, diophant, M); 213 earlyFactors= earlyFactorDetection0 (A, bufUniFactors, newLiftBound, 214 degs, earlySuccess, 215 smallFactorDeg); 216 int i= 1; 217 while ((degree (A,y)/4)*i + 4 <= smallFactorDeg) 218 i++; 219 if (degs.getLength() > 1 && !earlySuccess) 220 { 221 bufUniFactors.insert (LC (A, x)); 222 henselLiftResume12 (A, bufUniFactors, smallFactorDeg, 223 (degree (A, y)/4)*i + 4, Pi, diophant, M); 224 earlyFactors= earlyFactorDetection0 (A, bufUniFactors, newLiftBound, 225 degs, earlySuccess, (degree (A, y)/4)*i + 4); 226 } 227 while (degs.getLength() > 1 && !earlySuccess && i < 4) 228 { 229 if (newLiftBound > (degree (A, y)/4)*i + 4) 230 { 231 bufUniFactors.insert (LC (A, x)); 232 henselLiftResume12 (A, bufUniFactors, (degree (A,y)/4)*i + 4, 233 (degree (A, y)/4)*(i+1) + 4, Pi, diophant, M); 234 earlyFactors= earlyFactorDetection0 (A, bufUniFactors, newLiftBound, 235 degs, earlySuccess, (degree (A, y)/4)*(i+1) + 4); 236 } 237 else 238 { 239 liftBound= newLiftBound; 240 break; 241 } 242 i++; 243 } 244 if (earlySuccess) 245 liftBound= newLiftBound; 246 } 247 248 return bufUniFactors; 83 249 } 84 250 … … 365 531 int liftBound= degree (A, y) + 1; 366 532 367 ExtensionInfo dummy= ExtensionInfo (false);368 533 bool earlySuccess= false; 369 534 CFList earlyFactors; 370 TIMING_START ( hensel_lift12);371 uniFactors= henselLiftAndEarly 535 TIMING_START (fac_hensel_lift); 536 uniFactors= henselLiftAndEarly0 372 537 (A, earlySuccess, earlyFactors, degs, liftBound, 373 uniFactors, dummy,evaluation);374 TIMING_END_AND_PRINT ( hensel_lift12, "time for hensel lifting: ");538 uniFactors, evaluation); 539 TIMING_END_AND_PRINT (fac_hensel_lift, "time for hensel lifting: "); 375 540 DEBOUTLN (cerr, "lifted factors= " << uniFactors); 376 541
Note: See TracChangeset
for help on using the changeset viewer.