Changeset 001cc15 in git for factory/facSparseHensel.cc


Ignore:
Timestamp:
Sep 6, 2012, 7:11:17 PM (12 years ago)
Author:
Oleksandr Motsak <malex984@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
0b27942997f2964b33d7b6fb15f97e372d54fc5f
Parents:
24a77fb14c59fc78cc67eb5f6934a45d8862d99e107aac1a78fd9b689a33a864d23b7cfb1caa5bdf
Message:
Merge pull request #179 from mmklee/factory_fix_sw

Factory fix sw
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/facSparseHensel.cc

    r24a77fb r001cc15  
    2121#include "facFqFactorize.h"
    2222
    23 bool
     23int
    2424LucksWangSparseHeuristic (const CanonicalForm& F, const CFList& factors,
    2525                          int level, const CFList& leadingCoeffs, CFList& result)
     
    6666  delete [] monomsLead;
    6767
    68   CFArray termsF= getTerms (F);
    69   sort (termsF);
     68  CFArray termsF= getBiTerms (F);
     69  if (termsF.size() > 450)
     70  {
     71    delete [] monoms;
     72    return 0;
     73  }
     74  sort (termsF, level);
    7075
    7176  CFList tmp;
     
    8085  CanonicalForm H= prod (tmp);
    8186  CFArray monomsH= getMonoms (H);
    82   sort (monomsH);
    83 
    84   groupTogether (termsF, level);
     87  sort (monomsH,F.level());
     88
    8589  groupTogether (monomsH, F.level());
    8690
     
    8892  {
    8993    delete [] stripped2;
    90     return false;
     94    return 0;
    9195  }
    9296
     
    99103  {
    100104    delete [] stripped2;
    101     return false;
     105    return 0;
    102106  }
    103107
    104108  CFArray A= getEquations (monomsH, termsF);
     109  CFArray startingSolution= solution;
    105110  CFArray newSolution= CFArray (solution.size());
     111  result= CFList();
    106112  do
    107113  {
     
    112118    {
    113119      delete [] stripped2;
    114       return false;
     120      return 0;
    115121    }
    116122    if (isZero (newSolution))
    117     {
    118       delete [] stripped2;
    119       return false;
    120     }
     123      break;
    121124    if (!merge (solution, newSolution))
    122     {
    123       delete [] stripped2;
    124       return false;
    125     }
     125      break;
    126126  } while (1);
    127127
    128 
    129   result= CFList();
     128  if (isEqual (startingSolution, solution))
     129  {
     130    delete [] stripped2;
     131    return 0;
     132  }
    130133  CanonicalForm factor;
    131134  num= 0;
     
    135138    factor= 0;
    136139    for (j= 0; j < k; j++, num++)
     140    {
     141      if (solution [num].isZero())
     142        continue;
    137143      factor += solution [num]*stripped2[i][j];
     144    }
    138145    result.append (factor);
    139146  }
    140147
    141148  delete [] stripped2;
    142   return true;
     149  if (result.length() > 0)
     150    return 1;
     151  return 0;
    143152}
    144153
Note: See TracChangeset for help on using the changeset viewer.