Changeset 1130ffc in git for factory/cf_gcd_smallp.cc


Ignore:
Timestamp:
Oct 25, 2012, 2:25:59 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
139f6f800b915490dfaa914ef7676d29a3236b92186df6b3fe891f605e0e3e7324333e7713165436
Parents:
becbea965e6c5de8e8ab195c7f480cabc295ac0cd91423947d67c2ab2eaf1aae4a61f9f2988e9510
Message:
Merge pull request #198 from mmklee/factory_clean_sw

Factory clean sw
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_gcd_smallp.cc

    rbecbea r1130ffc  
    4545TIMING_DEFINE_PRINT(gcd_recursion)
    4646TIMING_DEFINE_PRINT(newton_interpolation)
     47TIMING_DEFINE_PRINT(termination_test)
     48TIMING_DEFINE_PRINT(ez_p_compress)
     49TIMING_DEFINE_PRINT(ez_p_hensel_lift)
     50TIMING_DEFINE_PRINT(ez_p_eval)
     51TIMING_DEFINE_PRINT(ez_p_content)
    4752
    4853bool
     
    797802    if ((uni_lcoeff (H) == gcdlcAlcB) || (G_m == H))
    798803    {
     804      TIMING_START (termination_test);
    799805      if (gcdlcAlcB.isOne())
    800806        cH= 1;
     
    831837          coF= N ((cA/gcdcAcB)*ppCoF);
    832838          coG= N ((cB/gcdcAcB)*ppCoG);
     839          TIMING_END_AND_PRINT (termination_test,
     840                                "time for successful termination test Fq: ");
    833841          return N(gcdcAcB*ppH);
    834842        }
     
    846854        }
    847855        coF= N ((cA/gcdcAcB)*ppCoF);
    848         coG= N ((cB/gcdcAcB)*ppCoG);;
     856        coG= N ((cB/gcdcAcB)*ppCoG);
     857        TIMING_END_AND_PRINT (termination_test,
     858                              "time for successful termination test Fq: ");
    849859        return N(gcdcAcB*ppH);
    850860      }
     861      TIMING_END_AND_PRINT (termination_test,
     862                            "time for unsuccessful termination test Fq: ");
    851863    }
    852864
     
    12371249    if ((uni_lcoeff (H) == gcdlcAlcB) || (G_m == H))
    12381250    {
     1251      TIMING_START (termination_test);
    12391252      if (gcdlcAlcB.isOne())
    12401253        cH= 1;
     
    12701283          coG= N ((cB/gcdcAcB)*ppCoG);
    12711284          setCharacteristic (p, k, gf_name_buf);
     1285          TIMING_END_AND_PRINT (termination_test,
     1286                                "time for successful termination GF: ");
    12721287          return N(gcdcAcB*ppH);
    12731288        }
     
    12881303          coF= N ((cA/gcdcAcB)*ppCoF);
    12891304          coG= N ((cB/gcdcAcB)*ppCoG);
     1305          TIMING_END_AND_PRINT (termination_test,
     1306                                "time for successful termination GF: ");
    12901307          return N(gcdcAcB*ppH);
    12911308        }
    12921309      }
     1310      TIMING_END_AND_PRINT (termination_test,
     1311                            "time for unsuccessful termination GF: ");
    12931312    }
    12941313
     
    17441763    if ((uni_lcoeff (H) == gcdlcAlcB) || (G_m == H))
    17451764    {
     1765      TIMING_START (termination_test);
    17461766      if (gcdlcAlcB.isOne())
    17471767        cH= 1;
     
    17691789        coF= N ((cA/gcdcAcB)*ppCoF);
    17701790        coG= N ((cB/gcdcAcB)*ppCoG);
     1791        TIMING_END_AND_PRINT (termination_test,
     1792                              "time for successful termination Fp: ");
    17711793        return N(gcdcAcB*ppH);
    17721794      }
     1795      TIMING_END_AND_PRINT (termination_test,
     1796                            "time for unsuccessful termination Fp: ");
    17731797    }
    17741798
     
    44504474  CFMap M,N;
    44514475  int smallestDegLev;
     4476  TIMING_START (ez_p_compress)
    44524477  int best_level= compress4EZGCD (F, G, M, N, smallestDegLev);
    44534478
     
    44564481  F= M (F);
    44574482  G= M (G);
    4458 
     4483  TIMING_END_AND_PRINT (ez_p_compress, "time for compression in EZ_P: ")
     4484
     4485  TIMING_START (ez_p_content)
    44594486  f = content( F, x ); g = content( G, x );
    44604487  d = gcd( f, g );
    44614488  F /= f; G /= g;
     4489  TIMING_END_AND_PRINT (ez_p_content, "time to extract content in EZ_P: ")
    44624490
    44634491  if( F.isUnivariate() && G.isUnivariate() )
     
    45984626  while( !gcdfound )
    45994627  {
     4628    TIMING_START (ez_p_eval);
    46004629    if( !findeval_P( F, G, Fb, Gb, Db, b, delta, degF, degG, maxeval, count, o,
    46014630         maxeval/maxNumVars, t ))
     
    46204649      return N (d*result);
    46214650    }
     4651    TIMING_END_AND_PRINT (ez_p_eval, "time for eval point search in EZ_P1: ");
    46224652    delta = degree( Db );
    46234653    if( delta == 0 )
     
    46324662    {
    46334663      bt = b;
     4664      TIMING_START (ez_p_eval);
    46344665      if( !findeval_P(F,G,Fbt,Gbt,Dbt, bt, delta, degF, degG, maxeval, count, o,
    46354666           maxeval/maxNumVars, t ))
     
    46544685        return N (d*result);
    46554686      }
     4687      TIMING_END_AND_PRINT (ez_p_eval, "time for eval point search in EZ_P2: ");
    46564688      int dd = degree( Dbt );
    46574689      if( dd == 0 )
     
    48074839      }
    48084840
     4841      TIMING_START (ez_p_hensel_lift);
    48094842      gcdfound= Hensel_P (B*lcD, DD, b, lcDD);
    4810 
    4811       if (gcdfound == -1)
    4812       {
    4813         Off (SW_USE_EZGCD_P);
    4814         result= gcd (F,G);
    4815         On (SW_USE_EZGCD_P);
    4816         if (passToGF)
    4817         {
    4818           CanonicalForm mipo= gf_mipo;
    4819           setCharacteristic (p);
    4820           Variable alpha= rootOf (mipo.mapinto());
    4821           result= GF2FalphaRep (result, alpha);
     4843      TIMING_END_AND_PRINT (ez_p_hensel_lift, "time for Hensel lift in EZ_P: ");
     4844
     4845      if (gcdfound == -1) //things became dense
     4846      {
     4847        if (algExtension)
     4848        {
     4849          result= GCD_Fp_extension (F, G, a);
     4850          if (extOfExt)
     4851            result= mapDown (result, primElem, imPrimElem, oldA, dest, source);
     4852          return N (d*result);
    48224853        }
    4823         if (k > 1)
    4824         {
    4825           result= GFMapDown (result, k);
    4826           setCharacteristic (p, k, gf_name);
     4854        if (CFFactory::gettype() == GaloisFieldDomain)
     4855        {
     4856          result= GCD_GF (F, G);
     4857          if (passToGF)
     4858          {
     4859            CanonicalForm mipo= gf_mipo;
     4860            setCharacteristic (p);
     4861            Variable alpha= rootOf (mipo.mapinto());
     4862            result= GF2FalphaRep (result, alpha);
     4863          }
     4864          if (k > 1)
     4865          {
     4866            result= GFMapDown (result, k);
     4867            setCharacteristic (p, k, gf_name);
     4868          }
     4869          return N (d*result);
    48274870        }
    4828         if (extOfExt)
    4829           result= mapDown (result, primElem, imPrimElem, oldA, dest, source);
    4830         return N (d*result);
     4871        else
     4872          return N (d*GCD_small_p (F,G));
    48314873      }
    48324874
    48334875      if (gcdfound == 1)
    48344876      {
     4877        TIMING_START (termination_test);
    48354878        contcand= content (DD[2], Variable (1));
    48364879        cand = DD[2] / contcand;
     
    48394882        else
    48404883          gcdfound = fdivides( cand, F ) && cand*(DD[1]/(lcD/contcand)) == G;
     4884        TIMING_END_AND_PRINT (termination_test,
     4885                              "time for termination test EZ_P: ");
    48414886
    48424887        if (passToGF && gcdfound)
Note: See TracChangeset for help on using the changeset viewer.