Changeset 14e634 in git for factory/facFqBivar.cc


Ignore:
Timestamp:
Dec 10, 2012, 3:38:49 PM (11 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
b15cf8578937df382dad415dbfdd2229103409bf
Parents:
3e7db4d961b4509d248e12d8e96e2bed08d9cfe8
git-author:
Martin Lee <martinlee84@web.de>2012-12-10 15:38:49+01:00
git-committer:
Martin Lee <martinlee84@web.de>2012-12-12 15:24:58+01:00
Message:
fix: bug in factorization over Q(a)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/facFqBivar.cc

    r3e7db4 r14e634  
    482482factorRecombination (CFList& factors, CanonicalForm& F,
    483483                     const CanonicalForm& N, DegreePattern& degs, int s,
    484                      int thres, const modpk& b
     484                     int thres, const modpk& b, const CanonicalForm& den
    485485                    )
    486486{
     
    515515  Variable y= Variable (2);
    516516  Variable x= Variable (1);
    517   CanonicalForm LCBuf= LC (F, x);
     517  CanonicalForm denom= den, denQuot;
     518  CanonicalForm LCBuf= LC (F, x)*denom;
    518519  CanonicalForm g, quot, buf= F;
    519520  int * v= new int [T.length()];
     
    598599          {
    599600            On (SW_RATIONAL);
     601            if (!Lc (g).inBaseDomain())
     602              g /= Lc (g);
    600603            g *= bCommonDen (g);
    601604            Off (SW_RATIONAL);
     
    605608          if (fdivides (g, buf, quot))
    606609          {
     610            denom *= abs (lc (g));
    607611            recombination= true;
    608612            result.append (g);
    609613            if (b.getp() != 0)
    610               buf= quot*bCommonDen (quot);
     614            {
     615              denQuot= bCommonDen (quot);
     616              buf= quot*denQuot;
     617              Off (SW_RATIONAL);
     618              denom /= gcd (denom, denQuot);
     619              On (SW_RATIONAL);
     620            }
    611621            else
    612622              buf= quot;
    613             LCBuf= LC (buf, x);
     623            LCBuf= LC (buf, x)*denom;
    614624            T= Difference (T, S);
    615625            l -= degree (g);
     
    726736                      factors, int& adaptedLiftBound, int*& factorsFoundIndex,
    727737                      DegreePattern& degs, bool& success, int deg,
    728                       const modpk& b)
     738                      const modpk& b, CanonicalForm& den)
    729739{
    730740  DegreePattern bufDegs1= degs;
     
    742752  if (b.getp() != 0)
    743753    buf *= bCommonDen (buf);
    744   CanonicalForm LCBuf= LC (buf, x);
     754  CanonicalForm LCBuf= LC (buf, x)*den;
    745755  CanonicalForm buf0= mulNTL (buf (0,x), LCBuf);
    746756  CanonicalForm buf1= mulNTL (buf (1,x), LCBuf);
     
    748758    Off (SW_RATIONAL);
    749759  CanonicalForm test0, test1;
     760  CanonicalForm denQuot;
    750761
    751762  for (CFListIterator i= factors; i.hasItem(); i++, l++)
     
    777788          {
    778789            On (SW_RATIONAL);
     790            if (!Lc (g).inBaseDomain())
     791              g /= Lc (g);
    779792            g *= bCommonDen (g);
    780793            Off (SW_RATIONAL);
     
    784797          if (fdivides (g, buf, quot))
    785798          {
     799            den *= abs (lc (g));
    786800            reconstructedFactors.append (g);
    787801            factorsFoundIndex[l]= 1;
    788802            if (b.getp() != 0)
    789               buf= quot*bCommonDen(quot);
     803            {
     804              denQuot= bCommonDen (quot);
     805              buf= quot*denQuot;
     806              Off (SW_RATIONAL);
     807              den /= gcd (den, denQuot);
     808              On (SW_RATIONAL);
     809            }
    790810            else
    791811              buf= quot;
    792812            d -= degree (g);
    793             LCBuf= LC (buf, x);
     813            LCBuf= LC (buf, x)*den;
    794814            buf0= mulNTL (buf (0,x), LCBuf);
    795815            buf1= mulNTL (buf (1,x), LCBuf);
     
    827847  if (bufDegs1.getLength() <= 1)
    828848    degs= bufDegs1;
     849}
     850
     851void
     852earlyFactorDetection (CFList& reconstructedFactors, CanonicalForm& F, CFList&
     853                      factors, int& adaptedLiftBound, int*& factorsFoundIndex,
     854                      DegreePattern& degs, bool& success, int deg,
     855                      const modpk& b)
     856{
     857  CanonicalForm den= 1;
     858  earlyFactorDetection (reconstructedFactors, F, factors, adaptedLiftBound, factorsFoundIndex, degs, success, deg,b, den);
    829859}
    830860
     
    10021032                    earlyFactors, DegreePattern& degs, int& liftBound,
    10031033                    const CFList& uniFactors, const ExtensionInfo& info,
    1004                     const CanonicalForm& eval, modpk& b)
     1034                    const CanonicalForm& eval,modpk& b, CanonicalForm& den)
    10051035{
    10061036  Variable alpha= info.getAlpha();
     
    10181048  CFList diophant;
    10191049  CFList bufUniFactors= uniFactors;
     1050  On (SW_RATIONAL);
    10201051  CanonicalForm bufA= A;
     1052  if (!Lc (A).inBaseDomain())
     1053  {
     1054    bufA /= Lc (A);
     1055    CanonicalForm denBufA= bCommonDen (bufA);
     1056    bufA *= denBufA;
     1057    Off (SW_RATIONAL);
     1058    den /= gcd (den, denBufA);
     1059  }
     1060  else
     1061  {
     1062    bufA= A;
     1063    Off (SW_RATIONAL);
     1064    den /= gcd (den, Lc (A));
     1065  }
    10211066  CanonicalForm lcA0= 0;
    10221067  bool mipoHasDen= false;
     
    10821127        earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
    10831128                              factorsFoundIndex, degs, earlySuccess,
    1084                               smallFactorDeg, b);
     1129                              smallFactorDeg, b, den);
    10851130      else
    10861131        earlyFactorDetection(earlyFactors, bufA, bufBufUniFactors, newLiftBound,
    10871132                             factorsFoundIndex, degs, earlySuccess,
    1088                              smallFactorDeg, b);
     1133                             smallFactorDeg, b, den);
    10891134    }
    10901135    else
     
    11111156          earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
    11121157                                factorsFoundIndex, degs, earlySuccess,
    1113                                 liftPre[sizeOfLiftPre-1] + 1, b);
     1158                                liftPre[sizeOfLiftPre-1] + 1, b, den);
    11141159          else
    11151160          earlyFactorDetection (earlyFactors,bufA,bufBufUniFactors,newLiftBound,
    11161161                                factorsFoundIndex, degs, earlySuccess,
    1117                                 liftPre[sizeOfLiftPre-1] + 1, b);
     1162                                liftPre[sizeOfLiftPre-1] + 1, b, den);
    11181163        }
    11191164        else
     
    11451190          earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
    11461191                                factorsFoundIndex, degs, earlySuccess,
    1147                                 liftPre[i-1] + 1, b);
     1192                                liftPre[i-1] + 1, b, den);
    11481193          else
    11491194          earlyFactorDetection (earlyFactors,bufA,bufBufUniFactors,newLiftBound,
    11501195                                factorsFoundIndex, degs, earlySuccess,
    1151                                 liftPre[i-1] + 1, b);
     1196                                liftPre[i-1] + 1, b, den);
    11521197        }
    11531198        else
     
    11881233      earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
    11891234                            factorsFoundIndex, degs, earlySuccess,
    1190                             smallFactorDeg, b);
     1235                            smallFactorDeg, b, den);
    11911236      else
    11921237      earlyFactorDetection (earlyFactors, bufA, bufBufUniFactors, newLiftBound,
    11931238                            factorsFoundIndex, degs, earlySuccess,
    1194                             smallFactorDeg, b);
     1239                            smallFactorDeg, b, den);
    11951240    }
    11961241    else
     
    12171262        if (v==alpha)
    12181263        earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
    1219                               factorsFoundIndex, degs, earlySuccess, dummy, b);
     1264                              factorsFoundIndex, degs, earlySuccess, dummy, b,
     1265                              den);
    12201266        else
    12211267        earlyFactorDetection (earlyFactors, bufA,bufBufUniFactors, newLiftBound,
    1222                               factorsFoundIndex, degs, earlySuccess, dummy, b);
     1268                              factorsFoundIndex, degs, earlySuccess, dummy, b,
     1269                              den);
    12231270      }
    12241271      else
     
    12451292          if (v==alpha)
    12461293          earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
    1247                                 factorsFoundIndex, degs, earlySuccess, dummy,b);
     1294                                factorsFoundIndex, degs, earlySuccess, dummy,b,
     1295                                den);
    12481296          else
    12491297          earlyFactorDetection (earlyFactors,bufA,bufBufUniFactors,newLiftBound,
    1250                                 factorsFoundIndex, degs, earlySuccess, dummy,b);
     1298                                factorsFoundIndex, degs, earlySuccess, dummy,b,
     1299                                den);
    12511300        }
    12521301        else
     
    12871336{
    12881337  modpk dummy= modpk();
     1338  CanonicalForm den= 1;
    12891339  return henselLiftAndEarly (A, earlySuccess, earlyFactors, degs, liftBound,
    1290                              uniFactors, info, eval, dummy);
     1340                             uniFactors, info, eval, dummy, den);
    12911341}
    12921342
Note: See TracChangeset for help on using the changeset viewer.