Changeset c89740 in git


Ignore:
Timestamp:
Aug 21, 2012, 5:22:07 PM (10 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
Children:
b30017f937034d50539db11d0bee89dc2991375c
Parents:
5dad7c78535e5d3163be097e8a0d3e8d69c6593e
git-author:
Martin Lee <martinlee84@web.de>2012-08-21 17:22:07+02:00
git-committer:
Martin Lee <martinlee84@web.de>2012-09-04 18:01:19+02:00
Message:
chg: minor improvements
chg: prepare for adding heuristics
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/facFqFactorize.cc

    r5dad7c7 rc89740  
    22872287  CFList biFactors, bufBiFactors;
    22882288  CanonicalForm evalPoly;
    2289   int lift, bufLift;
     2289  int lift, bufLift, lengthAeval2= A.level()-2;
    22902290  double logarithm= (double) ilog2 (totaldegree (A));
    22912291  logarithm /= log2exp;
     
    22932293  if (factorNums < (int) logarithm)
    22942294    factorNums= (int) logarithm;
    2295   CFList* bufAeval2= new CFList [A.level() - 2];
    2296   CFList* Aeval2= new CFList [A.level() - 2];
     2295  CFList* bufAeval2= new CFList [lengthAeval2];
     2296  CFList* Aeval2= new CFList [lengthAeval2];
    22972297  int counter;
    22982298  int differentSecondVar= 0;
     
    23512351    evaluationWRTDifferentSecondVars (bufAeval2, bufEvaluation, A);
    23522352
    2353     for (int j= 0; j < A.level() - 2; j++)
     2353    for (int j= 0; j < lengthAeval2; j++)
    23542354    {
    23552355      if (!bufAeval2[j].isEmpty())
     
    23922392      biFactors= bufBiFactors;
    23932393      lift= bufLift;
    2394       for (int j= 0; j < A.level() - 2; j++)
     2394      for (int j= 0; j < lengthAeval2; j++)
    23952395        Aeval2 [j]= bufAeval2 [j];
    23962396      differentSecondVar= counter;
     
    24062406        biFactors= bufBiFactors;
    24072407        lift= bufLift;
    2408         for (int j= 0; j < A.level() - 2; j++)
     2408        for (int j= 0; j < lengthAeval2; j++)
    24092409          Aeval2 [j]= bufAeval2 [j];
    24102410        differentSecondVar= counter;
     
    24462446  minFactorsLength= tmin (minFactorsLength, biFactors.length());
    24472447
    2448   if (differentSecondVar == A.level() - 2)
     2448  if (differentSecondVar == lengthAeval2)
    24492449  {
    24502450    bool zeroOccured= false;
     
    24802480  CFList uniFactors= buildUniFactors (biFactors, evaluation.getLast(), y);
    24812481
    2482   sortByUniFactors (Aeval2, A.level() - 2, uniFactors, evaluation);
    2483 
    2484   CFList * oldAeval= new CFList [A.level() - 2]; //TODO use bufAeval2 for this
    2485   for (int i= 0; i < A.level() - 2; i++)
     2482  sortByUniFactors (Aeval2, lengthAeval2, uniFactors, evaluation);
     2483
     2484  CFList * oldAeval= new CFList [lengthAeval2]; //TODO use bufAeval2 for this
     2485  for (int i= 0; i < lengthAeval2; i++)
    24862486    oldAeval[i]= Aeval2[i];
    24872487
     
    24942494  Variable v;
    24952495  CFList leadingCoeffs= precomputeLeadingCoeff (LC (A, 1), biFactorsLCs, alpha,
    2496                                           evaluation, Aeval2, A.level() - 2, v);
     2496                                          evaluation, Aeval2, lengthAeval2, v);
    24972497
    24982498  if (v.level() != 1)
     
    25122512      }
    25132513    }
    2514     for (i= 0; i < A.level() - 2; i++)
     2514    for (i= 0; i < lengthAeval2; i++)
    25152515    {
    25162516      if (oldAeval[i].isEmpty())
     
    25602560  }
    25612561
     2562  CanonicalForm LCmultiplier= leadingCoeffs.getFirst();
     2563  bool LCmultiplierIsConst= LCmultiplier.inCoeffDomain();
    25622564  leadingCoeffs.removeFirst();
    25632565
    25642566  //prepare leading coefficients
    2565   CFList* leadingCoeffs2= new CFList [A.level() - 2];
     2567  CFList* leadingCoeffs2= new CFList [lengthAeval2];
    25662568  prepareLeadingCoeffs (leadingCoeffs2, A.level(), leadingCoeffs, biFactors,
    25672569                        evaluation);
     
    25742576  A /= hh;
    25752577
     2578  CFListIterator iter2;
     2579  CFList bufLeadingCoeffs2= leadingCoeffs2[lengthAeval2-1];
     2580  bufBiFactors= biFactors;
     2581  bufA= A;
     2582  CanonicalForm bufLCmultiplier= LCmultiplier;
     2583  CanonicalForm testVars;
     2584  if (!LCmultiplierIsConst)
     2585  {
     2586    testVars= Variable (2);
     2587    for (int i= 0; i < lengthAeval2; i++)
     2588    {
     2589      if (!oldAeval[i].isEmpty())
     2590        testVars *= oldAeval[i].getFirst().mvar();
     2591    }
     2592  }
    25762593  CFList bufFactors= CFList();
    2577   if (LucksWangSparseHeuristic (A, biFactors, 2, leadingCoeffs2 [A.level() - 3],
     2594  bool LCheuristic= false;
     2595  if (LucksWangSparseHeuristic (A, biFactors, 2, leadingCoeffs2 [lengthAeval2-1],
    25782596                                 factors))
    25792597  {
     
    25862604    {
    25872605      if (extension)
    2588         factors= extNonMonicFactorRecombination (factors, A, info);
     2606        factors= extNonMonicFactorRecombination (factors, bufA, info);       //TODO brauche hier ein bufA statt A
    25892607
    25902608      if (v.level() != 1)
     
    26132631            iter++;
    26142632          iter.remove (1);
    2615           for (int j= 0; j < A.level() -2; j++)
     2633          for (int j= 0; j < lengthAeval2; j++)
    26162634          {
    26172635            l= leadingCoeffs2[j];
     
    26382656    iter.getItem()= iter.getItem () (y + evaluation.getLast(), y);
    26392657
    2640   for (int i= 0; i < A.level() - 3; i++)
     2658  for (int i= 0; i < lengthAeval2-1; i++)
    26412659    leadingCoeffs2[i]= CFList();
    2642   for (iter= leadingCoeffs2[A.level() - 3]; iter.hasItem(); iter++)
     2660  for (iter= leadingCoeffs2[lengthAeval2-1]; iter.hasItem(); iter++)
    26432661  {
    26442662    iter.getItem()= shift2Zero (iter.getItem(), list, evaluation);
    26452663    for (int i= A.level() - 4; i > -1; i--)
    26462664    {
    2647       if (i + 1 == A.level() - 3)
     2665      if (i + 1 == lengthAeval2-1)
    26482666        leadingCoeffs2[i].append (iter.getItem() (0, i + 4));
    26492667      else
Note: See TracChangeset for help on using the changeset viewer.