Changeset 0851b0 in git


Ignore:
Timestamp:
Oct 12, 2012, 5:31:21 PM (10 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
cb4f0c3c5277d6de4d18c968650b4169ff1d1b46
Parents:
2a95b234ef67ebbc98057baefb8dd2ed43af3762
git-author:
Martin Lee <martinlee84@web.de>2012-10-12 17:31:21+02:00
git-committer:
Martin Lee <martinlee84@web.de>2012-10-24 12:26:22+02:00
Message:
chg: added more timing infos to main factorization functions
Location:
factory
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • factory/facAlgExt.cc

    r2a95b2 r0851b0  
    2929#include "fac_sqrfree.h"
    3030
     31TIMING_DEFINE_PRINT(fac_alg_resultant)
     32TIMING_DEFINE_PRINT(fac_alg_norm)
     33TIMING_DEFINE_PRINT(fac_alg_factor_norm)
     34TIMING_DEFINE_PRINT(fac_alg_gcd)
     35TIMING_DEFINE_PRINT(fac_alg_sqrf)
     36TIMING_DEFINE_PRINT(fac_alg_factor_sqrf)
     37
    3138// squarefree part of F
    3239CanonicalForm
     
    5360  int degmipo= degree (mipo);
    5461  CanonicalForm norm;
     62  TIMING_START (fac_alg_resultant);
    5563  if (degg >= 8 || degmipo >= 8)
    5664    norm= resultantZ (g, mipo, x);
    5765  else
    5866    norm= resultant (g, mipo, x);
     67  TIMING_END_AND_PRINT (fac_alg_resultant, "time to compute resultant0: ");
    5968
    6069  i= 0;
     
    7281        g= F (y - i*alpha, y);
    7382        g *= bCommonDen (g);
     83        TIMING_START (fac_alg_resultant);
    7484        if (degg >= 8 || degmipo >= 8)
    7585          norm= resultantZ (g (x, alpha), mipo, x);
    7686        else
    7787          norm= resultant (g (x, alpha), mipo, x);
     88        TIMING_END_AND_PRINT (fac_alg_resultant,"time to compute resultant1: ");
    7889      }
    7990      else
     
    8192        g= F (y + i*alpha, y);
    8293        g *= bCommonDen (g);
     94        TIMING_START (fac_alg_resultant);
    8395        if (degg >= 8 || degmipo >= 8)
    8496          norm= resultantZ (g (x, alpha), mipo, x);
    8597        else
    8698          norm= resultant (g (x, alpha), mipo, x);
     99        TIMING_END_AND_PRINT (fac_alg_resultant,"time to compute resultant2: ");
    87100      }
    88101      if (degree (gcd (deriv (norm, y), norm)) <= 0)
     
    108121  CanonicalForm f= F*bCommonDen (F);
    109122  int shift;
     123  TIMING_START (fac_alg_norm);
    110124  CanonicalForm norm= sqrfNorm (f, alpha, shift);
     125  TIMING_END_AND_PRINT (fac_alg_norm, "time to compute sqrf norm: ");
    111126  ASSERT (degree (norm, alpha) <= 0, "wrong norm computed");
     127  TIMING_START (fac_alg_factor_norm);
    112128  CFFList normFactors= factorize (norm);
     129  TIMING_END_AND_PRINT (fac_alg_factor_norm, "time to factor norm: ");
    113130  CFList factors;
    114131  if (normFactors.length() <= 2)
     
    125142  {
    126143    ASSERT (i.getItem().exp() == 1, "norm not squarefree");
     144    TIMING_START (fac_alg_gcd);
    127145    if (shift == 0)
    128146      factor= gcd (buf, i.getItem().factor());
     
    130148      factor= gcd (buf, i.getItem().factor() (f.mvar() + shift*alpha, f.mvar()));
    131149    buf /= factor;
     150    TIMING_END_AND_PRINT (fac_alg_gcd, "time to recover factors: ");
    132151    factors.append (factor);
    133152  }
     
    149168  bool save_rat=!isOn (SW_RATIONAL);
    150169  On (SW_RATIONAL);
     170  TIMING_START (fac_alg_sqrf);
    151171  CFFList sqrf= sqrFreeZ (F);
     172  TIMING_END_AND_PRINT (fac_alg_sqrf, "time for sqrf factors in Q(a)[x]: ");
    152173  CFList factorsSqrf;
    153174  CFFList factors;
     
    158179  {
    159180    if (i.getItem().factor().inCoeffDomain()) continue;
     181    TIMING_START (fac_alg_factor_sqrf);
    160182    factorsSqrf= AlgExtSqrfFactorize (i.getItem().factor(), alpha);
     183    TIMING_END_AND_PRINT (fac_alg_factor_sqrf,
     184                          "time to factor sqrf factors in Q(a)[x]: ");
    161185    for (j= factorsSqrf; j.hasItem(); j++)
    162186    {
  • factory/facBivar.cc

    r2a95b2 r0851b0  
    1313#include "config.h"
    1414
    15 #include "assert.h"
     15#include "cf_assert.h"
    1616#include "debug.h"
    1717#include "timing.h"
     
    2828TIMING_DEFINE_PRINT(fac_bi_hensel_lift)
    2929TIMING_DEFINE_PRINT(fac_bi_factor_recombination)
     30TIMING_DEFINE_PRINT(fac_bi_evaluation)
     31TIMING_DEFINE_PRINT(fac_bi_shift_to_zero)
    3032
    3133// bound on coeffs of f (cf. Musser: Multivariate Polynomial Factorization,
     
    334336  {
    335337    bufAeval= A;
     338    TIMING_START (fac_bi_evaluation);
    336339    bufAeval= evalPoint (A, bufEvaluation);
     340    TIMING_END_AND_PRINT (fac_bi_evaluation, "time for eval point over Q: ");
    337341
    338342    bufAeval2= buf;
     343    TIMING_START (fac_bi_evaluation);
    339344    bufAeval2= evalPoint (buf, bufEvaluation2);
     345    TIMING_END_AND_PRINT (fac_bi_evaluation,
     346                          "time for eval point over Q in y: ");
    340347
    341348    // univariate factorization
    342     TIMING_START (uni_factorize);
    343 
     349    TIMING_START (fac_uni_factorizer);
    344350    if (extension)
    345351      bufUniFactors= conv (factorize (bufAeval, v));
    346352    else
    347353      bufUniFactors= conv (factorize (bufAeval, true));
    348     TIMING_END_AND_PRINT (uni_factorize,
    349                           "time for univariate factorization: ");
     354    TIMING_END_AND_PRINT (fac_uni_factorizer,
     355                          "time for univariate factorization over Q: ");
    350356    DEBOUTLN (cerr, "prod (bufUniFactors)== bufAeval " <<
    351357              (prod (bufUniFactors) == bufAeval));
    352358
    353     TIMING_START (uni_factorize);
     359    TIMING_START (fac_uni_factorizer);
    354360    if (extension)
    355361      bufUniFactors2= conv (factorize (bufAeval2, v));
    356362    else
    357363      bufUniFactors2= conv (factorize (bufAeval2, true));
    358     TIMING_END_AND_PRINT (uni_factorize,
    359                           "time for univariate factorization in y: ");
     364    TIMING_END_AND_PRINT (fac_uni_factorizer,
     365                          "time for univariate factorization in y over Q: ");
    360366    DEBOUTLN (cerr, "prod (bufuniFactors2)== bufAeval2 " <<
    361367              (prod (bufUniFactors2) == bufAeval2));
     
    544550              (A, earlySuccess, earlyFactors, degs, liftBound,
    545551               uniFactors, dummy, evaluation, b);
    546   TIMING_END_AND_PRINT (fac_bi_hensel_lift, "time for hensel lifting: ");
     552  TIMING_END_AND_PRINT (fac_bi_hensel_lift,
     553                        "time for bivariate hensel lifting over Q: ");
    547554  DEBOUTLN (cerr, "lifted factors= " << uniFactors);
    548555
     
    563570  Off (SW_RATIONAL);
    564571
     572  TIMING_START (fac_bi_factor_recombination);
    565573  factors= factorRecombination (uniFactors, A, MODl, degs, 1,
    566574                                uniFactors.length()/2, b);
     575  TIMING_END_AND_PRINT (fac_bi_factor_recombination,
     576                        "time for bivariate factor recombination over Q: ");
    567577
    568578  On (SW_RATIONAL);
  • factory/facBivar.h

    r2a95b2 r0851b0  
    1414#define FAC_BIVAR_H
    1515
    16 #include <config.h>
    17 
    18 #include "assert.h"
     16#include "config.h"
     17
     18#include "cf_assert.h"
     19#include "timing.h"
    1920
    2021#include "facFqBivarUtil.h"
     
    2627#include "algext.h"
    2728#include "fac_util.h"
     29
     30TIMING_DEFINE_PRINT(fac_bi_sqrf)
     31TIMING_DEFINE_PRINT(fac_bi_factor_sqrf)
    2832
    2933/// @return @a biFactorize returns a list of factors of F. If F is not monic
     
    196200  vec_ZZ S;
    197201  F= compress (F, M, S);
     202  TIMING_START (fac_bi_sqrf);
    198203  CFFList sqrfFactors= sqrFree (F);
     204  TIMING_END_AND_PRINT (fac_bi_sqrf,
     205                       "time for bivariate sqrf factors over Q: ");
    199206  for (CFFListIterator i= sqrfFactors; i.hasItem(); i++)
    200207  {
     208    TIMING_START (fac_bi_factor_sqrf);
    201209    CFList tmp= ratBiSqrfFactorize (i.getItem().factor(), v);
     210    TIMING_END_AND_PRINT (fac_bi_factor_sqrf,
     211                          "time to factor bivariate sqrf factors over Q: ");
    202212    for (CFListIterator j= tmp; j.hasItem(); j++)
    203213    {
  • factory/facFactorize.cc

    r2a95b2 r0851b0  
    2929#include "facSparseHensel.h"
    3030
    31 TIMING_DEFINE_PRINT(fac_bi_factorize)
     31TIMING_DEFINE_PRINT(fac_bi_factorizer)
    3232TIMING_DEFINE_PRINT(fac_hensel_lift)
    3333TIMING_DEFINE_PRINT(fac_factor_recombination)
     34TIMING_DEFINE_PRINT(fac_shift_to_zero)
     35TIMING_DEFINE_PRINT(fac_precompute_leadcoeff)
     36TIMING_DEFINE_PRINT(fac_evaluation)
     37TIMING_DEFINE_PRINT(fac_recover_factors)
     38TIMING_DEFINE_PRINT(fac_preprocess_and_content)
     39TIMING_DEFINE_PRINT(fac_bifactor_total)
     40TIMING_DEFINE_PRINT(fac_luckswang)
     41TIMING_DEFINE_PRINT(fac_lcheuristic)
     42TIMING_DEFINE_PRINT(fac_cleardenom)
     43TIMING_DEFINE_PRINT(fac_content)
     44TIMING_DEFINE_PRINT(fac_compress)
    3445
    3546#ifdef HAVE_NTL
     
    158169    return CFList (F);
    159170
     171  TIMING_START (fac_preprocess_and_content);
    160172  // compress and find main Variable
    161173  CFMap N;
     174  TIMING_START (fac_compress)
    162175  CanonicalForm A= myCompress (F, N);
     176  TIMING_END_AND_PRINT (fac_compress, "time to compress poly over Q: ")
    163177
    164178  //univariate case
     
    186200
    187201  // remove content
     202  TIMING_START (fac_content);
    188203  CFList contentAi;
    189204  CanonicalForm lcmCont= lcmContent (A, contentAi);
    190205  A /= lcmCont;
     206  TIMING_END_AND_PRINT (fac_content, "time to extract content over Q: ");
    191207
    192208  // trivial after content removal
     
    214230
    215231  // factorize content
     232  TIMING_START (fac_content);
    216233  contentAFactors= multiFactorize (lcmCont, v);
     234  TIMING_END_AND_PRINT (fac_content, "time to factor content over Q: ");
    217235
    218236  // univariate after content removal
     
    230248
    231249  A *= bCommonDen (A);
    232   // check main variable
    233250  CFList Aeval, list, evaluation, bufEvaluation, bufAeval;
    234251  int factorNums= 1;
     
    241258  int differentSecondVar= 0;
    242259  CanonicalForm bufA;
     260  TIMING_END_AND_PRINT (fac_preprocess_and_content,
     261                       "time to preprocess poly and extract content over Q: ");
     262
    243263  // several bivariate factorizations
     264  TIMING_START (fac_bifactor_total);
    244265  REvaluation E (2, A.level(), IntRandom (25));
    245266  for (int i= 0; i < factorNums; i++)
     
    248269    bufA= A;
    249270    bufAeval= CFList();
     271    TIMING_START (fac_evaluation);
    250272    bufEvaluation= evalPoints (bufA, bufAeval, E);
     273    TIMING_END_AND_PRINT (fac_evaluation,
     274                          "time to find evaluation point over Q: ");
    251275    E.nextpoint();
    252276    evalPoly= 0;
    253277
     278    TIMING_START (fac_evaluation);
    254279    evaluationWRTDifferentSecondVars (bufAeval2, bufEvaluation, A);
     280    TIMING_END_AND_PRINT (fac_evaluation,
     281                          "time to eval wrt diff second vars over Q: ");
    255282
    256283    for (int j= 0; j < lengthAeval2; j++)
     
    262289    bufLift= degree (A, y) + 1 + degree (LC(A, x), y);
    263290
    264     TIMING_START (fac_bi_factorize);
     291    TIMING_START (fac_bi_factorizer);
    265292    bufBiFactors= ratBiSqrfFactorize (bufAeval.getFirst(), v);
    266     TIMING_END_AND_PRINT (fac_bi_factorize,
     293    TIMING_END_AND_PRINT (fac_bi_factorizer,
    267294                          "time for bivariate factorization: ");
    268295    bufBiFactors.removeFirst();
     
    316343  int minFactorsLength;
    317344  bool irred= false;
     345  TIMING_START (fac_bi_factorizer);
    318346  factorizationWRTDifferentSecondVars (A, Aeval2, minFactorsLength, irred, v);
    319 
     347  TIMING_END_AND_PRINT (fac_bi_factorizer,
     348             "time for bivariate factorization wrt diff second vars over Q: ");
     349
     350  TIMING_END_AND_PRINT (fac_bifactor_total,
     351                        "total time for eval and bivar factors over Q: ");
    320352  if (irred)
    321353  {
     
    376408
    377409  Variable w;
     410  TIMING_START (fac_precompute_leadcoeff);
    378411  CFList leadingCoeffs= precomputeLeadingCoeff (LC (A, 1), biFactorsLCs, x,
    379412                                          evaluation, Aeval2, lengthAeval2, w);
     
    477510    }
    478511  }
     512  TIMING_END_AND_PRINT(fac_precompute_leadcoeff,
     513                       "time to precompute LC over Q: ");
     514
     515  TIMING_START (fac_luckswang);
    479516  CFList bufFactors= CFList();
    480517  bool LCheuristic= false;
     
    499536      delete [] index;
    500537      delete [] Aeval2;
     538      TIMING_END_AND_PRINT (fac_luckswang,
     539                            "time for successful LucksWang over Q: ");
    501540      return factors;
    502541    }
     
    837876    delete [] index;
    838877  }
     878  TIMING_END_AND_PRINT (fac_luckswang, "time for LucksWang over Q: ");
     879
     880  TIMING_START (fac_lcheuristic);
    839881  if (!LCheuristic && !LCmultiplierIsConst && bufFactors.isEmpty()
    840882      && fdivides (getVars (LCmultiplier), testVars))
     
    9861028    }
    9871029  }
     1030  TIMING_END_AND_PRINT (fac_lcheuristic, "time for Lc heuristic over Q: ");
    9881031
    9891032tryAgainWithoutHeu:
    9901033  //shifting to zero
     1034  TIMING_START (fac_shift_to_zero);
    9911035  A= shift2Zero (A, Aeval, evaluation);
    9921036
     
    10071051    }
    10081052  }
     1053  TIMING_END_AND_PRINT (fac_shift_to_zero,
     1054                        "time to shift evaluation point to zero: ");
    10091055
    10101056  CFArray Pi;
     
    10181064  bool noOneToOne= false;
    10191065
     1066  TIMING_START (fac_cleardenom);
    10201067  CFList commonDenominators;
    10211068  for (iter=biFactors; iter.hasItem(); iter++)
     
    10561103      iter.getItem() *= iter2.getItem()*multiplier;
    10571104  }
    1058 
    1059 
     1105  TIMING_END_AND_PRINT (fac_cleardenom, "time to clear denominators: ");
     1106
     1107  TIMING_START (fac_hensel_lift);
    10601108  factors= nonMonicHenselLift (Aeval, biFactors, leadingCoeffs2, diophant,
    10611109                               Pi, liftBounds, liftBoundsLength, noOneToOne);
     1110  TIMING_END_AND_PRINT (fac_hensel_lift,
     1111                        "time for non monic hensel lifting over Q: ");
    10621112
    10631113  if (!noOneToOne)
     
    10651115    int check= factors.length();
    10661116    A= oldA;
     1117    TIMING_START (fac_recover_factors);
    10671118    factors= recoverFactors (A, factors, evaluation);
     1119    TIMING_END_AND_PRINT (fac_recover_factors,
     1120                          "time to recover factors over Q: ");
    10681121    if (check != factors.length())
    10691122      noOneToOne= true;
  • factory/facFactorize.h

    r2a95b2 r0851b0  
    1414#define FAC_FACTORIZE_H
    1515
    16 // #include "config.h"
     16#include "config.h"
     17#include "timing.h"
    1718
    1819#include "facBivar.h"
    1920#include "facFqBivarUtil.h"
     21
     22TIMING_DEFINE_PRINT (fac_squarefree)
     23TIMING_DEFINE_PRINT (fac_factor_squarefree)
    2024
    2125/// Factorization over Q (a)
     
    120124
    121125  CFFList result;
     126  TIMING_START (fac_squarefree);
    122127  CFFList sqrfFactors= sqrFree (F);
     128  TIMING_END_AND_PRINT (fac_squarefree,
     129                        "time for squarefree factorization over Q: ");
     130
     131  CFList tmp;
    123132  for (CFFListIterator i= sqrfFactors; i.hasItem(); i++)
    124133  {
    125     CFList tmp= ratSqrfFactorize (i.getItem().factor(), v);
     134    TIMING_START (fac_factor_squarefree);
     135    tmp= ratSqrfFactorize (i.getItem().factor(), v);
     136    TIMING_END_AND_PRINT (fac_factor_squarefree,
     137                          "time to factorize sqrfree factor over Q: ");
    126138    for (CFListIterator j= tmp; j.hasItem(); j++)
    127139    {
  • factory/facFqBivar.cc

    r2a95b2 r0851b0  
    4646TIMING_DEFINE_PRINT(fac_fq_bi_hensel_lift)
    4747TIMING_DEFINE_PRINT(fac_fq_bi_factor_recombination)
     48TIMING_DEFINE_PRINT(fac_fq_bi_evaluation)
     49TIMING_DEFINE_PRINT(fac_fq_bi_shift_to_zero)
    4850
    4951CanonicalForm prodMod0 (const CFList& L, const CanonicalForm& M, const modpk& b)
     
    60826084  {
    60836085    bufAeval= A;
     6086    TIMING_START (fac_fq_bi_evaluation);
    60846087    bufEvaluation= evalPoint (A, bufAeval, alpha, list, GF, fail);
     6088    TIMING_END_AND_PRINT (fac_fq_bi_evaluation, "time to find eval point: ");
    60856089    if (!derivXZero && !fail2 && !symmetric)
    60866090    {
     
    60916095      }
    60926096      bufAeval2= buf;
     6097      TIMING_START (fac_fq_bi_evaluation);
    60936098      bufEvaluation2= evalPoint (buf, bufAeval2, alpha, list2, GF, fail2);
     6099      TIMING_END_AND_PRINT (fac_fq_bi_evaluation,
     6100                            "time to find eval point wrt y: ");
    60946101    }
    60956102    // first try to change main variable if there is no valid evaluation point
     
    61326139    bufUniFactors= uniFactorizer (bufAeval, alpha, GF);
    61336140    TIMING_END_AND_PRINT (fac_fq_uni_factorizer,
    6134                           "time for univariate factorization: ");
     6141                          "time for univariate factorization over Fq: ");
    61356142    DEBOUTLN (cerr, "Lc (bufAeval)*prod (bufUniFactors)== bufAeval " <<
    61366143              (prod (bufUniFactors)*Lc (bufAeval) == bufAeval));
     
    61416148      bufUniFactors2= uniFactorizer (bufAeval2, alpha, GF);
    61426149      TIMING_END_AND_PRINT (fac_fq_uni_factorizer,
    6143                             "time for univariate factorization in y: ");
     6150                            "time for univariate factorization in y over Fq: ");
    61446151      DEBOUTLN (cerr, "Lc (bufAeval2)*prod (bufUniFactors2)== bufAeval2 " <<
    61456152                (prod (bufUniFactors2)*Lc (bufAeval2) == bufAeval2));
     
    62916298  }
    62926299
     6300  TIMING_START (fac_fq_bi_shift_to_zero);
    62936301  A= A (y + evaluation, y);
     6302  TIMING_END_AND_PRINT (fac_fq_bi_shift_to_zero,
     6303                        "time to shift eval to zero: ");
    62946304
    62956305  int degMipo= 1;
     
    63076317               (A, earlySuccess, earlyFactors, degs, liftBound,
    63086318                uniFactors, info, evaluation);
    6309     TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift, "time for hensel lifting: ");
     6319    TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift,
     6320                          "time for bivariate hensel lifting over Fq: ");
    63106321    DEBOUTLN (cerr, "lifted factors= " << uniFactors);
    63116322
    63126323    CanonicalForm MODl= power (y, liftBound);
    63136324
     6325    TIMING_START (fac_fq_bi_factor_recombination);
    63146326    if (extension)
    63156327      factors= extFactorRecombination (uniFactors, A, MODl, info, degs,
     
    63186330      factors= factorRecombination (uniFactors, A, MODl, degs, 1,
    63196331                                    uniFactors.length()/2);
     6332    TIMING_END_AND_PRINT (fac_fq_bi_factor_recombination,
     6333                          "time for naive bivariate factor recombi over Fq: ");
    63206334
    63216335    if (earlySuccess)
     
    63466360      factors= Union (lll, factors);
    63476361    }
    6348     TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift, "time for hensel lifting: ");
     6362    TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift,
     6363                          "time to bivar lift and LLL recombi over Fq: ");
    63496364    DEBOUTLN (cerr, "lifted factors= " << uniFactors);
    63506365  }
     
    63576372               (A, earlySuccess, earlyFactors, degs, liftBound,
    63586373                uniFactors, info, evaluation);
    6359     TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift, "time for hensel lifting: ");
     6374    TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift,
     6375                          "time for bivar hensel lifting over Fq: ");
    63606376    DEBOUTLN (cerr, "lifted factors= " << uniFactors);
    63616377
     
    63636379    if (!extension)
    63646380    {
     6381      TIMING_START (fac_fq_bi_factor_recombination);
    63656382      factors= factorRecombination (uniFactors, A, MODl, degs, 1, 3);
     6383      TIMING_END_AND_PRINT (fac_fq_bi_factor_recombination,
     6384                            "time for small subset naive recombi over Fq: ");
    63666385
    63676386      int oldUniFactorsLength= uniFactors.length();
     
    63696388      {
    63706389        CFList tmp;
     6390        TIMING_START (fac_fq_bi_hensel_lift);
    63716391        if (alpha.level() == 1)
    63726392          tmp= increasePrecision (A, uniFactors, 0, uniFactors.length(), 1,
     
    63846404                                   );
    63856405        }
     6406        TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift,
     6407                              "time to increase precision: ");
    63866408        factors= Union (factors, tmp);
    63876409        if (tmp.length() == 0 || (tmp.length() > 0 && uniFactors.length() != 0
  • factory/facFqBivar.h

    r2a95b2 r0851b0  
    1515#define FAC_FQ_BIVAR_H
    1616
    17 // #include "config.h"
    18 
     17 #include "config.h"
     18
     19#include "timing.h"
    1920#include "cf_assert.h"
    2021
     
    2627#include "cf_map.h"
    2728#include "cfNewtonPolygon.h"
     29
     30TIMING_DEFINE_PRINT(fac_fq_bi_sqrf)
     31TIMING_DEFINE_PRINT(fac_fq_bi_factor_sqrf)
    2832
    2933static const double log2exp= 1.442695041;
     
    273277  F= compress (F, M, S);
    274278
     279  TIMING_START (fac_fq_bi_sqrf);
    275280  CFFList sqrf= FpSqrf (F, false);
     281  TIMING_END_AND_PRINT (fac_fq_bi_sqrf,
     282                       "time for bivariate sqrf factors over Fp: ");
    276283  CFList bufResult;
    277284  sqrf.removeFirst();
     
    279286  for (CFFListIterator iter= sqrf; iter.hasItem(); iter++)
    280287  {
     288    TIMING_START (fac_fq_bi_factor_sqrf);
    281289    bufResult= biFactorize (iter.getItem().factor(), info);
     290    TIMING_END_AND_PRINT (fac_fq_bi_factor_sqrf,
     291                          "time to factor bivariate sqrf factors over Fp: ");
    282292    for (i= bufResult; i.hasItem(); i++)
    283293      result.append (CFFactor (N (decompress (i.getItem(), M, S)),
     
    374384  F= compress (F, M, S);
    375385
     386  TIMING_START (fac_fq_bi_sqrf);
    376387  CFFList sqrf= FqSqrf (F, alpha, false);
     388  TIMING_END_AND_PRINT (fac_fq_bi_sqrf,
     389                       "time for bivariate sqrf factors over Fq: ");
    377390  CFList bufResult;
    378391  sqrf.removeFirst();
     
    380393  for (CFFListIterator iter= sqrf; iter.hasItem(); iter++)
    381394  {
     395    TIMING_START (fac_fq_bi_factor_sqrf);
    382396    bufResult= biFactorize (iter.getItem().factor(), info);
     397    TIMING_END_AND_PRINT (fac_fq_bi_factor_sqrf,
     398                          "time to factor bivariate sqrf factors over Fq: ");
    383399    for (i= bufResult; i.hasItem(); i++)
    384400      result.append (CFFactor (N (decompress (i.getItem(), M, S)),
     
    476492  F= compress (F, M, S);
    477493
     494  TIMING_START (fac_fq_bi_sqrf);
    478495  CFFList sqrf= GFSqrf (F, false);
     496  TIMING_END_AND_PRINT (fac_fq_bi_sqrf,
     497                       "time for bivariate sqrf factors over GF: ");
    479498  CFList bufResult;
    480499  sqrf.removeFirst();
     
    482501  for (CFFListIterator iter= sqrf; iter.hasItem(); iter++)
    483502  {
     503    TIMING_START (fac_fq_bi_factor_sqrf);
    484504    bufResult= biFactorize (iter.getItem().factor(), info);
     505    TIMING_END_AND_PRINT (fac_fq_bi_factor_sqrf,
     506                          "time to factor bivariate sqrf factors over GF: ");
    485507    for (i= bufResult; i.hasItem(); i++)
    486508      result.append (CFFactor (N (decompress (i.getItem(), M, S)),
  • factory/facFqFactorize.cc

    r2a95b2 r0851b0  
    3838TIMING_DEFINE_PRINT(fac_fq_hensel_lift)
    3939TIMING_DEFINE_PRINT(fac_fq_factor_recombination)
     40TIMING_DEFINE_PRINT(fac_fq_shift_to_zero)
     41TIMING_DEFINE_PRINT(fac_fq_precompute_leadcoeff)
     42TIMING_DEFINE_PRINT(fac_fq_evaluation)
     43TIMING_DEFINE_PRINT(fac_fq_recover_factors)
     44TIMING_DEFINE_PRINT(fac_fq_preprocess_and_content)
     45TIMING_DEFINE_PRINT(fac_fq_bifactor_total)
     46TIMING_DEFINE_PRINT(fac_fq_luckswang)
     47TIMING_DEFINE_PRINT(fac_fq_lcheuristic)
     48TIMING_DEFINE_PRINT(fac_fq_content)
     49TIMING_DEFINE_PRINT(fac_fq_check_mainvar)
     50TIMING_DEFINE_PRINT(fac_fq_compress)
    4051
    4152static inline
     
    21962207    return CFList (F);
    21972208
     2209  TIMING_START (fac_fq_preprocess_and_content);
    21982210  // compress and find main Variable
    21992211  CFMap N;
     2212  TIMING_START (fac_fq_compress)
    22002213  CanonicalForm A= myCompress (F, N);
     2214  TIMING_END_AND_PRINT (fac_fq_compress, "time to compress poly over Fq: ")
    22012215
    22022216  A /= Lc (A); // make monic
     
    22322246
    22332247  // remove content
     2248  TIMING_START (fac_fq_content);
    22342249  CFList contentAi;
    22352250  CanonicalForm lcmCont= lcmContent (A, contentAi);
    22362251  A /= lcmCont;
     2252  TIMING_END_AND_PRINT (fac_fq_content, "time to extract content over Fq: ");
    22372253
    22382254  // trivial after content removal
     
    22602276
    22612277  // factorize content
     2278  TIMING_START (fac_fq_content);
    22622279  contentAFactors= multiFactorize (lcmCont, info);
     2280  TIMING_END_AND_PRINT (fac_fq_content, "time to factor content over Fq: ");
    22632281
    22642282  // univariate after content removal
     
    22732291
    22742292  // check main variable
     2293  TIMING_START (fac_fq_check_mainvar);
    22752294  int swapLevel= 0;
    22762295  CanonicalForm derivZ;
     
    23152334    }
    23162335  }
    2317 
     2336  TIMING_END_AND_PRINT (fac_fq_check_mainvar,
     2337                        "time to check main var over Fq: ");
     2338  TIMING_END_AND_PRINT (fac_fq_preprocess_and_content,
     2339                       "time to preprocess poly and extract content over Fq: ");
    23182340
    23192341  CFList Aeval, list, evaluation, bufEvaluation, bufAeval;
     
    23352357  int differentSecondVar= 0;
    23362358  // several bivariate factorizations
     2359  TIMING_START (fac_fq_bifactor_total);
    23372360  for (int i= 0; i < factorNums; i++)
    23382361  {
     
    23402363    bufA= A;
    23412364    bufAeval= CFList();
     2365    TIMING_START (fac_fq_evaluation);
    23422366    bufEvaluation= evalPoints (bufA, bufAeval, alpha, list, GF, fail);
     2367    TIMING_END_AND_PRINT (fac_fq_evaluation,
     2368                          "time to find evaluation point over Fq: ");
    23432369    evalPoly= 0;
    23442370
     
    23852411      break;
    23862412
     2413    TIMING_START (fac_fq_evaluation);
    23872414    evaluationWRTDifferentSecondVars (bufAeval2, bufEvaluation, A);
     2415    TIMING_END_AND_PRINT (fac_fq_evaluation,
     2416                          "time for evaluation wrt diff second vars over Fq: ");
    23882417
    23892418    for (int j= 0; j < lengthAeval2; j++)
     
    24602489  int minFactorsLength;
    24612490  bool irred= false;
     2491  TIMING_START (fac_fq_bi_factorizer);
    24622492  factorizationWRTDifferentSecondVars (A, Aeval2, info, minFactorsLength,irred);
    2463 
     2493  TIMING_END_AND_PRINT (fac_fq_bi_factorizer,
     2494             "time for bivariate factorization wrt diff second vars over Fq: ");
     2495
     2496  TIMING_END_AND_PRINT (fac_fq_bifactor_total,
     2497                        "total time for eval and bivar factors over Fq: ");
    24642498  if (irred)
    24652499  {
     
    25322566
    25332567  Variable v;
     2568  TIMING_START (fac_fq_precompute_leadcoeff);
    25342569  CFList leadingCoeffs= precomputeLeadingCoeff (LC (A, 1), biFactorsLCs, alpha,
    25352570                                          evaluation, Aeval2, lengthAeval2, v);
     
    26312666    }
    26322667  }
     2668  TIMING_END_AND_PRINT(fac_fq_precompute_leadcoeff,
     2669                       "time to precompute LC over Fq: ");
     2670
     2671  TIMING_START (fac_fq_luckswang);
    26332672  CFList bufFactors= CFList();
    26342673  bool LCheuristic= false;
     
    26582697      delete [] index;
    26592698      delete [] Aeval2;
     2699      TIMING_END_AND_PRINT (fac_fq_luckswang,
     2700                            "time for successful LucksWang over Fq: ");
    26602701      return factors;
    26612702    }
     
    29973038    delete [] index;
    29983039  }
    2999 
     3040  TIMING_END_AND_PRINT (fac_fq_luckswang, "time for LucksWang over Fq: ");
     3041
     3042  TIMING_START (fac_fq_lcheuristic);
    30003043  if (!LCheuristic && !LCmultiplierIsConst && bufFactors.isEmpty()
    30013044      && fdivides (getVars (LCmultiplier), testVars))
     
    31473190    }
    31483191  }
     3192  TIMING_END_AND_PRINT (fac_fq_lcheuristic, "time for Lc heuristic over Fq: ");
    31493193
    31503194tryAgainWithoutHeu:
     3195  TIMING_START (fac_fq_shift_to_zero);
    31513196  A= shift2Zero (A, Aeval, evaluation);
    31523197
     
    31673212    }
    31683213  }
     3214  TIMING_END_AND_PRINT (fac_fq_shift_to_zero,
     3215                        "time to shift evaluation point to zero: ");
    31693216
    31703217  CFArray Pi;
     
    31773224  Aeval.removeFirst();
    31783225  bool noOneToOne= false;
     3226  TIMING_START (fac_fq_hensel_lift);
    31793227  factors= nonMonicHenselLift (Aeval, biFactors, leadingCoeffs2, diophant,
    31803228                               Pi, liftBounds, liftBoundsLength, noOneToOne);
     3229  TIMING_END_AND_PRINT (fac_fq_hensel_lift,
     3230                        "time for non monic hensel lifting over Fq: ");
    31813231
    31823232  if (!noOneToOne)
     
    31843234    int check= factors.length();
    31853235    A= oldA;
     3236    TIMING_START (fac_fq_recover_factors);
    31863237    factors= recoverFactors (A, factors, evaluation);
     3238    TIMING_END_AND_PRINT (fac_fq_recover_factors,
     3239                          "time to recover factors over Fq: ");
    31873240    if (check != factors.length())
    31883241      noOneToOne= true;
     
    32433296                   (A, MOD, liftBounds, earlySuccess, earlyFactors,
    32443297                    Aeval, biFactors, evaluation, info);
    3245     TIMING_END_AND_PRINT (fac_fq_hensel_lift, "time for hensel lifting: ");
     3298    TIMING_END_AND_PRINT (fac_fq_hensel_lift,
     3299                          "time for hensel lifting over Fq: ");
    32463300
    32473301    if (!extension)
  • factory/facFqFactorize.h

    r2a95b2 r0851b0  
    1515#define FAC_FQ_FACTORIZE_H
    1616
    17 // #include "config.h"
     17#include "config.h"
     18#include "timing.h"
    1819
    1920#include "facFqBivar.h"
     
    2324#include "facFqSquarefree.h"
    2425#include "facFqBivarUtil.h"
     26
     27
     28TIMING_DEFINE_PRINT (fac_fq_squarefree)
     29TIMING_DEFINE_PRINT (fac_fq_factor_squarefree)
    2530
    2631/// Factorization over a finite field
     
    150155  Variable a= Variable (1);
    151156  CanonicalForm LcF= Lc (F);
     157  TIMING_START (fac_fq_squarefree);
    152158  CFFList sqrf= FpSqrf (F, false);
     159  TIMING_END_AND_PRINT (fac_fq_squarefree,
     160                        "time for squarefree factorization over Fq: ");
    153161  CFFList result;
    154162  CFList bufResult;
     
    157165  for (CFFListIterator iter= sqrf; iter.hasItem(); iter++)
    158166  {
     167    TIMING_START (fac_fq_factor_squarefree);
    159168    bufResult= multiFactorize (iter.getItem().factor(), info);
     169    TIMING_END_AND_PRINT (fac_fq_factor_squarefree,
     170                          "time to factorize sqrfree factor over Fq: ");
    160171    for (i= bufResult; i.hasItem(); i++)
    161172      result.append (CFFactor (i.getItem(), iter.getItem().exp()));
     
    227238  ExtensionInfo info= ExtensionInfo (alpha, false);
    228239  CanonicalForm LcF= Lc (F);
     240  TIMING_START (fac_fq_squarefree);
    229241  CFFList sqrf= FqSqrf (F, alpha, false);
     242  TIMING_END_AND_PRINT (fac_fq_squarefree,
     243                        "time for squarefree factorization over Fq: ");
    230244  CFFList result;
    231245  CFList bufResult;
     
    234248  for (CFFListIterator iter= sqrf; iter.hasItem(); iter++)
    235249  {
     250    TIMING_START (fac_fq_factor_squarefree);
    236251    bufResult= multiFactorize (iter.getItem().factor(), info);
     252    TIMING_END_AND_PRINT (fac_fq_factor_squarefree,
     253                          "time to factorize sqrfree factor over Fq: ");
    237254    for (i= bufResult; i.hasItem(); i++)
    238255      result.append (CFFactor (i.getItem(), iter.getItem().exp()));
Note: See TracChangeset for help on using the changeset viewer.