- Timestamp:
- Jan 7, 2013, 2:11:57 PM (11 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 058c1dafb078d10e814cec52ca5c9d37faa3cd50
- Parents:
- dea3d2f3263988c3b3ce21066d80fc2d903ace67
- git-author:
- Martin Lee <martinlee84@web.de>2013-01-07 14:11:57+01:00
- git-committer:
- Martin Lee <martinlee84@web.de>2013-05-02 11:42:33+02:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/fac_absfact.cc
rdea3d2 rb962395 26 26 27 27 #ifdef HAVE_FLINT 28 void out_cf(const char *s1,const CanonicalForm &f,const char *s2);29 28 30 29 int choosePoint (const CanonicalForm& F, int tdegF, CFArray& eval) … … 44 43 Off (SW_RATIONAL); 45 44 f= E2(f); 46 out_cf ("f= ", f, "\n");47 45 if (!f.isZero() && f > cf_getSmallPrime (cf_getNumSmallPrimes())) 48 46 { … … 87 85 CFList absFactorize (const CanonicalForm& G) 88 86 { 89 out_cf ("maxNorm (G)= ", maxNorm (G), "\n");90 87 //F is assumed to be bivariate, irreducible over Q, primitive wrt x and y, compressed 91 88 92 89 CanonicalForm F= bCommonDen (G)*G; 93 90 Off (SW_RATIONAL); 94 //out_cf ("icontent (F)= ", icontent (F), "\n");95 91 F /= icontent (F); 96 out_cf ("LC (F,1)= ", LC (F,1), "\n");97 out_cf ("LC (F,2)= ", LC (F,2), "\n");98 92 On (SW_RATIONAL); 99 93 CFArray eval; … … 103 97 while (1) 104 98 { 105 printf ("enter while\n");106 99 p= choosePoint (F, tdegF, eval); 107 100 108 printf ("p= %d\n", p);109 101 setCharacteristic (p); 110 102 Fp=F.mapinto(); 111 103 CFFList factors= factorize (Fp); 112 104 113 printf ("after factorize\n");114 105 factors.removeFirst(); 115 106 CFFListIterator iter= factors; … … 127 118 if (tdegF % minTdeg == 0) 128 119 break; 129 else 130 printf ("fail"); 131 } 132 out_cf ("eval[0]= ", eval[0], "\n"); 133 out_cf ("eval[1]= ", eval[1], "\n"); 134 //out_cf ("Fp= ", Fp, "\n"); 120 //TODO else 121 } 135 122 CanonicalForm Gp= Fp/smallestFactor; 136 printf ("Fp==Gp*smallestFactor? %d\n",Fp==Gp*smallestFactor);137 123 Gp= Gp (eval[0].mapinto(), 1); 138 124 Fp= Fp (eval[0].mapinto(), 1); 139 125 CanonicalForm smallestFactorEval= smallestFactor (eval[0].mapinto(),1); 140 out_cf ("Fp= ", Fp, "\n");141 out_cf ("Gp= ", Gp, "\n");142 out_cf ("smallestFactorEval= ", smallestFactorEval, "\n");143 //out_cf ("Gp*smallestFactorEval= ", Gp*smallestFactorEval, "\n");144 printf ("Gp*smallestFactorEval==Fp? %d\n", Gp*smallestFactorEval == Fp);145 126 setCharacteristic (0); 146 out_cf ("eval[0]= ", eval[0], "\n");147 127 CanonicalForm F1= F(eval[0],1); 148 128 setCharacteristic (p); 149 printf ("F1.mapinto()==Fp? %d\n", Fp==F1.mapinto());150 129 setCharacteristic (0); 151 //out_cf ("Fp= ", Fp, "\n");152 //out_cf ("F1= ", F1, "\n");153 130 int s= tdegF/minTdeg + 1; 154 131 CanonicalForm bound= power (maxNorm (F1), 2*(s-1)); … … 163 140 } 164 141 165 printf ("k= %ld\n", k); 166 //k= 73L; //reicht fÃŒr bertoneinput1 167 //k= 92L; 168 //k= 128L; 169 //k= 141L; 170 //k=256L; 171 //k= 512L; 172 //k= 1024L; 173 printf ("k= %ld\n", k); 142 //TODO take floor (log2(k)) 174 143 k= k+1; 175 144 fmpz_poly_t FLINTF1; 176 145 convertFacCF2Fmpz_poly_t (FLINTF1, F1); 177 /*fmpz_poly_print_pretty (FLINTF1, "x");178 printf ("\n");*/179 146 setCharacteristic (p); 180 147 nmod_poly_t FLINTFp, FLINTGp; 181 148 convertFacCF2nmod_poly_t (FLINTFp, smallestFactorEval/lc (smallestFactorEval)); 182 149 convertFacCF2nmod_poly_t (FLINTGp, Gp/lc (Gp)); 183 printf ("test= %d\n", (smallestFactorEval/lc (smallestFactorEval))*(Gp/lc (Gp))*lc (Fp) == Fp);184 150 nmod_poly_factor_t nmodFactors; 185 151 nmod_poly_factor_init (nmodFactors); 186 nmod_poly_factor_insert (nmodFactors, FLINTFp, 1L); //wird da vorne drangehangen oder hinten?152 nmod_poly_factor_insert (nmodFactors, FLINTFp, 1L); 187 153 nmod_poly_factor_insert (nmodFactors, FLINTGp, 1L); 188 154 … … 198 164 fmpz_poly_factor_init (liftedFactors); 199 165 _fmpz_poly_hensel_start_lift(liftedFactors, link, v, w, FLINTF1, nmodFactors, k); //lift factors up to p^k 200 //fmpz_poly_hensel_lift_once (liftedFactors, FLINTF1, nmodFactors, k);201 166 202 167 nmod_poly_factor_clear (nmodFactors); … … 204 169 nmod_poly_clear (FLINTGp); 205 170 206 //out_cf ("smallestFactorEval= ", smallestFactorEval, "\n");207 printf ("after lift\n");208 171 setCharacteristic(0); 209 172 modpk pk= modpk (p,k); 210 printf ("after modpk\n");211 /*printf ("liftedSmallestFactor= ");212 fmpz_poly_print_pretty ((fmpz_poly_t &) liftedFactors->p[0], "x");213 printf ("\n");*/214 173 CanonicalForm liftedSmallestFactor= convertFmpz_poly_t2FacCF ((fmpz_poly_t &)liftedFactors->p[0],Variable (2)); 215 out_cf ("liftedSmallestFactor= ", liftedSmallestFactor, "\n"); 216 //liftedSmallestFactor *= lc (F1); 217 218 //liftedSmallestFactor= pk (liftedSmallestFactor); 219 //out_cf ("icontent (liftedSmallestFactor)= ", icontent (liftedSmallestFactor), "\n"); 220 //liftedSmallestFactor /= icontent (liftedSmallestFactor); 174 221 175 CanonicalForm otherFactor= convertFmpz_poly_t2FacCF ((fmpz_poly_t &)liftedFactors->p[1],Variable (2)); 222 //otherFactor *= lc (F1);223 //otherFactor= pk (otherFactor);224 //out_cf ("icontent (otherFactor)= ", icontent (otherFactor), "\n");225 printf ("isOn (SW_RATIONAL)= %d\n", isOn (SW_RATIONAL));226 //out_cf ("F1= ", F1, "\n");227 176 CanonicalForm test= pk (otherFactor*liftedSmallestFactor); 228 printf ("test == F1 %d\n", test == F1);229 //out_cf ("otherFactor*smallestFactor= ", test, "\n");230 231 setCharacteristic (p);232 //out_cf ("F1.mapinto()= ", F1.mapinto(), "\n");233 //out_cf ("test.mapinto()= ", test.mapinto(), "\n");234 printf ("test.mapinto() == F1.mapinto() ? %d\n", test.mapinto() == F1.mapinto());235 setCharacteristic (0);236 //out_cf ("liftedSmallestFactor= ", liftedSmallestFactor, "\n");237 //out_cf ("otherFactor= ", otherFactor, "\n");238 177 239 178 Off (SW_SYMMETRIC_FF); 240 179 liftedSmallestFactor= pk (liftedSmallestFactor); 241 //out_cf ("pk.getpk()= ", pk.getpk(), "\n");242 //out_cf ("liftedSmallestFactor= ", liftedSmallestFactor, "\n");243 180 liftedSmallestFactor= liftedSmallestFactor (eval[1],2); 244 181 On (SW_SYMMETRIC_FF); … … 251 188 } 252 189 253 printf ("before LLL\n");254 /*for (int i= 1; i <= s; i++)255 {256 printf ("M (i)= ");257 for (int j= 1; j <=s; j++)258 out_cf (" ", M(i,j), "");259 printf ("\n");260 }*/261 262 190 mat_ZZ NTLM= *convertFacCFMatrix2NTLmat_ZZ (M); 263 191 … … 269 197 M= *convertNTLmat_ZZ2FacCFMatrix (NTLM); 270 198 271 printf ("r= %ld\n", r);272 printf ("s= %d\n", s);273 /*for (int i= 1; i <= s; i++)274 {275 printf ("M (i)= ");276 for (int j= 1; j <=s; j++)277 out_cf (" ", M(i,j), "");278 printf ("\n");279 }*/280 199 CanonicalForm mipo= 0; 281 200 Variable x= Variable (1); … … 283 202 mipo += M (i,1)*power (x,s-i); 284 203 285 out_cf ("/= ", F1 (eval[1],2)*lc(mipo), "\n");286 out_cf ("mipo/= ", mipo (0,1)*lc (F1), "\n");287 204 CFFList mipoFactors= factorize (mipo); 288 printf ("mipoFactors.length()= %d\n", mipoFactors.length());289 205 mipoFactors.removeFirst(); 290 out_cf ("mipoFactors.getFirst()= ", mipoFactors.getFirst().factor(), "\n");291 //out_cf ("lc (F1)= ", lc (F1), "\n");292 //out_cf ("F1eval= ", F1 (eval[1],2), "\n");293 //out_cf ("F1= ", F1, "\n");294 //out_cf ("icontent (mipo)= ", icontent (mipo), "\n");295 206 On (SW_RATIONAL); 296 207 Variable alpha= rootOf (mipo); 297 208 CFFList QaFactors= factorize (F1, alpha); 298 for (CFFListIterator iter= QaFactors; iter.hasItem(); iter++)299 out_cf ("iter.getItem()= ", iter.getItem().factor(), "\n");300 209 301 210 fmpz_poly_clear (v[0]); … … 307 216 delete [] link; 308 217 fmpz_poly_factor_clear (liftedFactors); 309 //TODO delete v, wclear310 218 return CFList(); 311 219 }
Note: See TracChangeset
for help on using the changeset viewer.