Changeset 7b5cb2 in git for factory/facSparseHensel.cc


Ignore:
Timestamp:
Aug 8, 2012, 1:31:30 PM (10 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
Children:
8267b8f9ab43170a4026e7e570df48db4601a748
Parents:
97686ecde8614d72ee9d26e96dc9344df8a7da32
git-author:
Martin Lee <martinlee84@web.de>2012-08-08 13:31:30+02:00
git-committer:
Martin Lee <martinlee84@web.de>2012-09-04 18:01:07+02:00
Message:
chg: faster retrieval of terms
chg: LucksWangSparseHeuristic now returns also partial factors
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/facSparseHensel.cc

    r97686e r7b5cb2  
    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());
    106111  do
     
    110115      break;
    111116    if (!simplify (A, newSolution, F.level() + 1))
    112     {
    113       delete [] stripped2;
    114       return false;
    115     }
     117      break;
    116118    if (isZero (newSolution))
    117     {
    118       delete [] stripped2;
    119       return false;
    120     }
     119      break;
    121120    if (!merge (solution, newSolution))
    122     {
    123       delete [] stripped2;
    124       return false;
    125     }
     121      break;
    126122  } while (1);
    127123
    128124
    129125  result= CFList();
     126  if (isEqual (startingSolution, solution))
     127  {
     128    delete [] stripped2;
     129    return 0;
     130  }
    130131  CanonicalForm factor;
    131132  num= 0;
     
    135136    factor= 0;
    136137    for (j= 0; j < k; j++, num++)
     138    {
     139      if (solution [num].isZero())
     140        continue;
    137141      factor += solution [num]*stripped2[i][j];
     142    }
    138143    result.append (factor);
    139144  }
    140145
    141146  delete [] stripped2;
    142   return true;
     147  if (result.length() > 0)
     148    return 1;
     149  return 0;
    143150}
    144151
Note: See TracChangeset for help on using the changeset viewer.