Changeset b962395 in git for factory


Ignore:
Timestamp:
Jan 7, 2013, 2:11:57 PM (11 years ago)
Author:
Martin Lee <martinlee84@…>
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
Message:
chg: deleted debug output from absfact
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/fac_absfact.cc

    rdea3d2 rb962395  
    2626
    2727#ifdef HAVE_FLINT
    28 void out_cf(const char *s1,const CanonicalForm &f,const char *s2);
    2928
    3029int choosePoint (const CanonicalForm& F, int tdegF, CFArray& eval)
     
    4443      Off (SW_RATIONAL);
    4544      f= E2(f);
    46       out_cf ("f= ", f, "\n");
    4745      if (!f.isZero() && f > cf_getSmallPrime (cf_getNumSmallPrimes()))
    4846      {
     
    8785CFList absFactorize (const CanonicalForm& G)
    8886{
    89   out_cf ("maxNorm (G)= ", maxNorm (G), "\n");
    9087  //F is assumed to be bivariate, irreducible over Q, primitive wrt x and y, compressed
    9188
    9289  CanonicalForm F= bCommonDen (G)*G;
    9390  Off (SW_RATIONAL);
    94   //out_cf ("icontent (F)= ", icontent (F), "\n");
    9591  F /= icontent (F);
    96   out_cf ("LC (F,1)= ", LC (F,1), "\n");
    97   out_cf ("LC (F,2)= ", LC (F,2), "\n");
    9892  On (SW_RATIONAL);
    9993  CFArray eval;
     
    10397  while (1)
    10498  {
    105     printf ("enter while\n");
    10699    p= choosePoint (F, tdegF, eval);
    107100
    108     printf ("p= %d\n", p);
    109101    setCharacteristic (p);
    110102    Fp=F.mapinto();
    111103    CFFList factors= factorize (Fp);
    112104
    113     printf ("after factorize\n");
    114105    factors.removeFirst();
    115106    CFFListIterator iter= factors;
     
    127118    if (tdegF % minTdeg == 0)
    128119      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  }
    135122  CanonicalForm Gp= Fp/smallestFactor;
    136   printf ("Fp==Gp*smallestFactor? %d\n",Fp==Gp*smallestFactor);
    137123  Gp= Gp (eval[0].mapinto(), 1);
    138124  Fp= Fp (eval[0].mapinto(), 1);
    139125  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);
    145126  setCharacteristic (0);
    146   out_cf ("eval[0]= ", eval[0], "\n");
    147127  CanonicalForm F1= F(eval[0],1);
    148128  setCharacteristic (p);
    149   printf ("F1.mapinto()==Fp? %d\n", Fp==F1.mapinto());
    150129  setCharacteristic (0);
    151   //out_cf ("Fp= ", Fp, "\n");
    152   //out_cf ("F1= ", F1, "\n");
    153130  int s= tdegF/minTdeg + 1;
    154131  CanonicalForm bound= power (maxNorm (F1), 2*(s-1));
     
    163140  }
    164141
    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))
    174143  k= k+1;
    175144  fmpz_poly_t FLINTF1;
    176145  convertFacCF2Fmpz_poly_t (FLINTF1, F1);
    177   /*fmpz_poly_print_pretty (FLINTF1, "x");
    178   printf ("\n");*/
    179146  setCharacteristic (p);
    180147  nmod_poly_t FLINTFp, FLINTGp;
    181148  convertFacCF2nmod_poly_t (FLINTFp, smallestFactorEval/lc (smallestFactorEval));
    182149  convertFacCF2nmod_poly_t (FLINTGp, Gp/lc (Gp));
    183   printf ("test= %d\n", (smallestFactorEval/lc (smallestFactorEval))*(Gp/lc (Gp))*lc (Fp) == Fp);
    184150  nmod_poly_factor_t nmodFactors;
    185151  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);
    187153  nmod_poly_factor_insert (nmodFactors, FLINTGp, 1L);
    188154
     
    198164  fmpz_poly_factor_init (liftedFactors);
    199165  _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);
    201166
    202167  nmod_poly_factor_clear (nmodFactors);
     
    204169  nmod_poly_clear (FLINTGp);
    205170
    206   //out_cf ("smallestFactorEval= ", smallestFactorEval, "\n");
    207   printf ("after lift\n");
    208171  setCharacteristic(0);
    209172  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");*/
    214173  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
    221175  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");
    227176  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");
    238177
    239178  Off (SW_SYMMETRIC_FF);
    240179  liftedSmallestFactor= pk (liftedSmallestFactor);
    241   //out_cf ("pk.getpk()= ", pk.getpk(), "\n");
    242   //out_cf ("liftedSmallestFactor= ", liftedSmallestFactor, "\n");
    243180  liftedSmallestFactor= liftedSmallestFactor (eval[1],2);
    244181  On (SW_SYMMETRIC_FF);
     
    251188  }
    252189
    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 
    262190  mat_ZZ NTLM= *convertFacCFMatrix2NTLmat_ZZ (M);
    263191
     
    269197  M= *convertNTLmat_ZZ2FacCFMatrix (NTLM);
    270198
    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   }*/
    280199  CanonicalForm mipo= 0;
    281200  Variable x= Variable (1);
     
    283202    mipo += M (i,1)*power (x,s-i);
    284203
    285   out_cf ("/= ", F1 (eval[1],2)*lc(mipo), "\n");
    286   out_cf ("mipo/= ", mipo (0,1)*lc (F1), "\n");
    287204  CFFList mipoFactors= factorize (mipo);
    288   printf ("mipoFactors.length()= %d\n", mipoFactors.length());
    289205  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");
    295206  On (SW_RATIONAL);
    296207  Variable alpha= rootOf (mipo);
    297208  CFFList QaFactors= factorize (F1, alpha);
    298   for (CFFListIterator iter= QaFactors; iter.hasItem(); iter++)
    299     out_cf ("iter.getItem()= ", iter.getItem().factor(), "\n");
    300209
    301210  fmpz_poly_clear (v[0]);
     
    307216  delete [] link;
    308217  fmpz_poly_factor_clear (liftedFactors);
    309   //TODO delete v, wclear
    310218  return CFList();
    311219}
Note: See TracChangeset for help on using the changeset viewer.