Changeset 4ec288 in git for factory/facFqBivar.cc


Ignore:
Timestamp:
Apr 11, 2012, 3:11:20 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
98adcdd62df51a4c6090574f59ad2b9a5d432d39
Parents:
4bafa67969ab030397c6410e512aadf5574be0dc0a7d0ca68a61f160eb5b83774592a019ed99f025
Message:
Merge pull request #94 from mmklee/swSingularFlint

first support of flint in singular:SW

TODO: improve the configure tests 
TODO: should flint be prefered over NTL by default?
TODO: suppress linking to different versions of libgmp.so in the same time due to flint
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/facFqBivar.cc

    r4bafa67 r4ec288  
    3030#include "cf_random.h"
    3131#include "facHensel.h"
     32#include "facMul.h"
    3233#include "cf_map.h"
    3334#include "cf_gcd_smallp.h"
     
    3536#include "facFqBivar.h"
    3637#include "cfNewtonPolygon.h"
     38#include "algext.h"
    3739
    3840#ifdef HAVE_NTL
     
    4244TIMING_DEFINE_PRINT(fac_hensel_lift12)
    4345
    44 CanonicalForm prodMod0 (const CFList& L, const CanonicalForm& M)
     46CanonicalForm prodMod0 (const CFList& L, const CanonicalForm& M, const modpk& b)
    4547{
    4648  if (L.isEmpty())
     
    4951    return mod (L.getFirst()(0, 1) , M);
    5052  else if (L.length() == 2)
    51     return mod (mulNTL (L.getFirst()(0, 1),L.getLast()(0, 1)), M);
     53    return mod (mulNTL (L.getFirst()(0, 1),L.getLast()(0, 1), b), M);
    5254  else
    5355  {
     
    5961      tmp1.append (i.getItem());
    6062    tmp2= Difference (L, tmp1);
    61     buf1= prodMod0 (tmp1, M);
    62     buf2= prodMod0 (tmp2, M);
    63     return mod (mulNTL (buf1,buf2), M);
     63    buf1= prodMod0 (tmp1, M, b);
     64    buf2= prodMod0 (tmp2, M, b);
     65    return mod (mulNTL (buf1,buf2, b), M);
    6466  }
    6567}
     
    143145{
    144146  Variable x= A.mvar();
    145   ASSERT (A.isUnivariate(), "univariate polynomial expected");
     147  ASSERT (A.isUnivariate() || A.inCoeffDomain(),
     148          "univariate polynomial expected or constant expected");
    146149  CFFList factorsA;
    147150  ZZ p= to_ZZ (getCharacteristic());
     
    149152  if (GF)
    150153  {
    151     Variable beta= rootOf (gf_mipo);
    152154    int k= getGFDegree();
    153155    char cGFName= gf_name;
     156    CanonicalForm mipo= gf_mipo;
    154157    setCharacteristic (getCharacteristic());
     158    Variable beta= rootOf (mipo.mapinto());
    155159    CanonicalForm buf= GF2FalphaRep (A, beta);
    156160    if (getCharacteristic() > 2)
    157161    {
    158       ZZ_pX NTLMipo= convertFacCF2NTLZZpX (gf_mipo);
     162      ZZ_pX NTLMipo= convertFacCF2NTLZZpX (mipo.mapinto());
    159163      ZZ_pE::init (NTLMipo);
    160164      ZZ_pEX NTLA= convertFacCF2NTLZZ_pEX (buf, NTLMipo);
     
    167171    else
    168172    {
    169       GF2X NTLMipo= convertFacCF2NTLGF2X (gf_mipo);
     173      GF2X NTLMipo= convertFacCF2NTLGF2X (mipo.mapinto());
    170174      GF2E::init (NTLMipo);
    171175      GF2EX NTLA= convertFacCF2NTLGF2EX (buf, NTLMipo);
     
    268272
    269273  DEBOUTLN (cerr, "LC (F, 1)*prodMod (factors, M) == F " <<
    270             (LC (F, 1)*prodMod (factors, M) == F));
     274            (mod (LC (F, 1)*prodMod (factors, M), M)/Lc (mod (LC (F, 1)*prodMod (factors, M), M)) == F/Lc (F)));
    271275  int degMipoBeta= 1;
    272276  if (!k && beta.level() != 1)
     
    449453factorRecombination (CFList& factors, CanonicalForm& F,
    450454                     const CanonicalForm& N, DegreePattern& degs, int s,
    451                      int thres
     455                     int thres, const modpk& b
    452456                    )
    453457{
     
    463467    return result;
    464468  }
    465   DEBOUTLN (cerr, "LC (F, 1)*prodMod (factors, N) == F " <<
    466             (LC (F, 1)*prodMod (factors, N) == F));
     469#ifdef DEBUGOUTPUT
     470  if (b.getp() == 0)
     471    DEBOUTLN (cerr, "LC (F, 1)*prodMod (factors, N) == F " <<
     472              (mod (LC (F, 1)*prodMod (factors, N),N)/Lc (mod (LC (F, 1)*prodMod (factors, N),N)) == F/Lc(F)));
     473  else
     474    DEBOUTLN (cerr, "LC (F, 1)*prodMod (factors, N) == F " <<
     475              (mod (b(LC (F, 1)*prodMod (factors, N)),N)/Lc (mod (b(LC (F, 1)*prodMod (factors, N)),N)) == F/Lc(F)));
     476#endif
    467477  CFList T, S;
    468478
     
    486496  bool recombination= false;
    487497  CanonicalForm test;
    488   CanonicalForm buf0= buf (0, x)*LCBuf;
     498  bool isRat= (isOn (SW_RATIONAL) && getCharacteristic() == 0) || getCharacteristic() > 0;
     499  if (!isRat)
     500    On (SW_RATIONAL);
     501  CanonicalForm buf0= mulNTL (buf (0, x), LCBuf);
     502  if (!isRat)
     503    Off (SW_RATIONAL);
     504  buf0= buf(0,x)*LCBuf;
    489505  while (T.length() >= 2*s && s <= thres)
    490506  {
     
    498514          T.insert (LCBuf);
    499515          g= prodMod (T, M);
     516          if (b.getp() != 0)
     517            g= b(g);
    500518          T.removeFirst();
    501519          result.append (g/content (g, x));
     
    518536      else
    519537      {
     538        if (!isRat)
     539          On (SW_RATIONAL);
    520540        test= prodMod0 (S, M);
    521         test *= LCBuf;
    522         test = mod (test, M);
    523         if (fdivides (test, buf0))
    524         {
     541        if (!isRat)
     542        {
     543          test *= bCommonDen (test);
     544          Off (SW_RATIONAL);
     545        }
     546        test= mulNTL (test, LCBuf, b);
     547        test= mod (test, M);
     548        if (uniFdivides (test, buf0))
     549        {
     550          if (!isRat)
     551            On (SW_RATIONAL);
    525552          S.insert (LCBuf);
    526553          g= prodMod (S, M);
    527554          S.removeFirst();
     555          if (!isRat)
     556          {
     557            g *= bCommonDen(g);
     558            Off (SW_RATIONAL);
     559          }
     560          if (b.getp() != 0)
     561            g= b(g);
     562          if (!isRat)
     563            On (SW_RATIONAL);
    528564          g /= content (g, x);
    529565          if (fdivides (g, buf, quot))
     
    536572            l -= degree (g);
    537573            M= power (y, l);
    538             buf0= buf (0, x)*LCBuf;
     574            buf0= mulNTL (buf (0, x), LCBuf);
     575            if (!isRat)
     576              Off (SW_RATIONAL);
    539577            // compute new possible degree pattern
    540578            bufDegs2= DegreePattern (T);
     
    562600            if (nosubset) break;
    563601          }
     602          if (!isRat)
     603            Off (SW_RATIONAL);
    564604        }
    565605      }
     
    638678earlyFactorDetection (CFList& reconstructedFactors, CanonicalForm& F, CFList&
    639679                      factors, int& adaptedLiftBound, int*& factorsFoundIndex,
    640                       DegreePattern& degs, bool& success, int deg)
     680                      DegreePattern& degs, bool& success, int deg,
     681                      const modpk& b)
    641682{
    642683  DegreePattern bufDegs1= degs;
     
    650691  adaptedLiftBound= 0;
    651692  int d= degree (F), l= 0;
     693  bool isRat= (isOn (SW_RATIONAL) && getCharacteristic() == 0) || getCharacteristic() > 0;
     694  if (!isRat)
     695    On (SW_RATIONAL);
     696  CanonicalForm buf0= mulNTL (buf (0,x), LCBuf);
     697  CanonicalForm buf1= mulNTL (buf (1,x), LCBuf);
     698  if (!isRat)
     699    Off (SW_RATIONAL);
     700  CanonicalForm test0, test1;
     701
    652702  for (CFListIterator i= factors; i.hasItem(); i++, l++)
    653703  {
     
    656706    else
    657707    {
    658       g= mulMod2 (i.getItem(), LCBuf, M);
    659       g /= content (g, x);
    660       if (fdivides (g, buf, quot))
    661       {
    662         reconstructedFactors.append (g);
    663         factorsFoundIndex[l]= 1;
    664         buf= quot;
    665         d -= degree (g);
    666         LCBuf= LC (buf, x);
    667         T= Difference (T, CFList (i.getItem()));
    668         F= buf;
    669 
    670         // compute new possible degree pattern
    671         bufDegs2= DegreePattern (T);
    672         bufDegs1.intersect (bufDegs2);
    673         bufDegs1.refine ();
    674         if (bufDegs1.getLength() <= 1)
    675         {
    676           reconstructedFactors.append (buf);
    677           break;
     708      test1= mod (mulNTL (i.getItem() (1,x), LCBuf, b), M);
     709      if (uniFdivides (test1, buf1))
     710      {
     711        test0= mod (mulNTL (i.getItem() (0,x), LCBuf, b), M);
     712        if (uniFdivides (test0, buf0))
     713        {
     714          if (!isRat)
     715            On (SW_RATIONAL);
     716          g= mulMod2 (i.getItem(), LCBuf, M);
     717          if (!isRat)
     718          {
     719            g *= bCommonDen(g);
     720            Off (SW_RATIONAL);
     721          }
     722          if (b.getp() != 0)
     723            g= b(g);
     724          if (!isRat)
     725            On (SW_RATIONAL);
     726          g /= content (g, x);
     727          if (fdivides (g, buf, quot))
     728          {
     729            reconstructedFactors.append (g);
     730            factorsFoundIndex[l]= 1;
     731            buf= quot;
     732            d -= degree (g);
     733            LCBuf= LC (buf, x);
     734            buf0= mulNTL (buf (0,x), LCBuf);
     735            buf1= mulNTL (buf (1,x), LCBuf);
     736            if (!isRat)
     737              Off (SW_RATIONAL);
     738            T= Difference (T, CFList (i.getItem()));
     739            F= buf;
     740
     741            // compute new possible degree pattern
     742            bufDegs2= DegreePattern (T);
     743            bufDegs1.intersect (bufDegs2);
     744            bufDegs1.refine ();
     745            if (bufDegs1.getLength() <= 1)
     746            {
     747              reconstructedFactors.append (buf);
     748              break;
     749            }
     750          }
     751          if (!isRat)
     752            Off (SW_RATIONAL);
    678753        }
    679754      }
     
    859934                    earlyFactors, DegreePattern& degs, int& liftBound,
    860935                    const CFList& uniFactors, const ExtensionInfo& info,
    861                     const CanonicalForm& eval)
     936                    const CanonicalForm& eval, modpk& b)
    862937{
    863938  Variable alpha= info.getAlpha();
     
    875950  CFList diophant;
    876951  CFList bufUniFactors= uniFactors;
     952  CanonicalForm bufA= A;
     953  CanonicalForm lcA0= 0;
     954  bool mipoHasDen= false;
     955  if (getCharacteristic() == 0 && b.getp() != 0)
     956  {
     957    if (alpha.level() == 1)
     958    {
     959      lcA0= lc (A (0, 2));
     960      A *= b.inverse (lcA0);
     961      A= b (A);
     962      for (CFListIterator i= bufUniFactors; i.hasItem(); i++)
     963        i.getItem()= b (i.getItem()*b.inverse (lc (i.getItem())));
     964    }
     965    else
     966    {
     967      lcA0= Lc (A (0,2));
     968      On (SW_RATIONAL);
     969      mipoHasDen= !bCommonDen(getMipo(alpha)).isOne();
     970      Off (SW_RATIONAL);
     971      CanonicalForm lcA0inverse= b.inverse (lcA0);
     972      A *= lcA0inverse;
     973      A= b (A);
     974      // Lc of bufUniFactors is in Z
     975      for (CFListIterator i= bufUniFactors; i.hasItem(); i++)
     976        i.getItem()= b (i.getItem()*b.inverse (lc (i.getItem())));
     977    }
     978  }
    877979  bufUniFactors.insert (LC (A, x));
    878980  CFMatrix M= CFMatrix (liftBound, bufUniFactors.length() - 1);
     
    885987  for (int i= 0; i < uniFactors.length(); i++)
    886988    factorsFoundIndex [i]= 0;
    887   CanonicalForm bufA= A;
    888 
     989
     990  CFList bufBufUniFactors;
     991  Variable v= alpha;
    889992  if (smallFactorDeg >= liftBound || degree (A,y) <= 4)
    890     henselLift12 (A, bufUniFactors, liftBound, Pi, diophant, M);
     993    henselLift12 (A, bufUniFactors, liftBound, Pi, diophant, M, b, true);
    891994  else if (sizeOfLiftPre > 1 && sizeOfLiftPre < 30)
    892995  {
    893     henselLift12 (A, bufUniFactors, smallFactorDeg, Pi, diophant, M);
     996    henselLift12 (A, bufUniFactors, smallFactorDeg, Pi, diophant, M, b, true);
     997    if (mipoHasDen)
     998    {
     999      for (CFListIterator iter= bufUniFactors; iter.hasItem(); iter++)
     1000        if (hasFirstAlgVar (iter.getItem(), v))
     1001          break;
     1002      if (v != alpha)
     1003      {
     1004        bufBufUniFactors= bufUniFactors;
     1005        for (CFListIterator iter= bufBufUniFactors; iter.hasItem(); iter++)
     1006          iter.getItem()= replacevar (iter.getItem(), v, alpha);
     1007        A= replacevar (A, alpha, v);
     1008      }
     1009    }
     1010
    8941011    if (!extension)
    895       earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
    896                             factorsFoundIndex, degs, earlySuccess,
    897                             smallFactorDeg);
     1012    {
     1013      if (v==alpha)
     1014        earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
     1015                              factorsFoundIndex, degs, earlySuccess,
     1016                              smallFactorDeg, b);
     1017      else
     1018        earlyFactorDetection(earlyFactors, bufA, bufBufUniFactors, newLiftBound,
     1019                             factorsFoundIndex, degs, earlySuccess,
     1020                             smallFactorDeg, b);
     1021    }
    8981022    else
    8991023      extEarlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
     
    9071031        bufUniFactors.insert (LC (A, x));
    9081032        henselLiftResume12 (A, bufUniFactors, smallFactorDeg,
    909                             liftPre[sizeOfLiftPre-1] + 1, Pi, diophant, M);
     1033                            liftPre[sizeOfLiftPre-1] + 1, Pi, diophant, M, b);
     1034        if (v!=alpha)
     1035        {
     1036          bufBufUniFactors= bufUniFactors;
     1037          for (CFListIterator iter= bufBufUniFactors; iter.hasItem(); iter++)
     1038            iter.getItem()= replacevar (iter.getItem(), v, alpha);
     1039        }
    9101040        if (!extension)
     1041        {
     1042          if (v==alpha)
    9111043          earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
    9121044                                factorsFoundIndex, degs, earlySuccess,
    913                                 liftPre[sizeOfLiftPre-1] + 1);
     1045                                liftPre[sizeOfLiftPre-1] + 1, b);
     1046          else
     1047          earlyFactorDetection (earlyFactors,bufA,bufBufUniFactors,newLiftBound,
     1048                                factorsFoundIndex, degs, earlySuccess,
     1049                                liftPre[sizeOfLiftPre-1] + 1, b);
     1050        }
    9141051        else
    915           extEarlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
     1052          extEarlyFactorDetection (earlyFactors,bufA,bufUniFactors,newLiftBound,
    9161053                                   factorsFoundIndex, degs, earlySuccess, info,
    9171054                                   eval, liftPre[sizeOfLiftPre-1] + 1);
     
    9281065        bufUniFactors.insert (LC (A, x));
    9291066        henselLiftResume12 (A, bufUniFactors, liftPre[i] + 1,
    930                             liftPre[i-1] + 1, Pi, diophant, M);
     1067                            liftPre[i-1] + 1, Pi, diophant, M, b);
     1068        if (v!=alpha)
     1069        {
     1070          bufBufUniFactors= bufUniFactors;
     1071          for (CFListIterator iter= bufBufUniFactors; iter.hasItem(); iter++)
     1072            iter.getItem()= replacevar (iter.getItem(), v, alpha);
     1073        }
    9311074        if (!extension)
     1075        {
     1076          if (v==alpha)
    9321077          earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
    9331078                                factorsFoundIndex, degs, earlySuccess,
    934                                 liftPre[i-1] + 1);
     1079                                liftPre[i-1] + 1, b);
     1080          else
     1081          earlyFactorDetection (earlyFactors,bufA,bufBufUniFactors,newLiftBound,
     1082                                factorsFoundIndex, degs, earlySuccess,
     1083                                liftPre[i-1] + 1, b);
     1084        }
    9351085        else
    936           extEarlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
     1086          extEarlyFactorDetection (earlyFactors,bufA,bufUniFactors,newLiftBound,
    9371087                                   factorsFoundIndex, degs, earlySuccess, info,
    9381088                                   eval, liftPre[i-1] + 1);
     
    9511101  else
    9521102  {
    953     henselLift12 (A, bufUniFactors, smallFactorDeg, Pi, diophant, M);
     1103    henselLift12 (A, bufUniFactors, smallFactorDeg, Pi, diophant, M, b, true);
     1104    if (mipoHasDen)
     1105    {
     1106      for (CFListIterator iter= bufUniFactors; iter.hasItem(); iter++)
     1107        if (hasFirstAlgVar (iter.getItem(), v))
     1108          break;
     1109      if (v != alpha)
     1110      {
     1111        bufBufUniFactors= bufUniFactors;
     1112        for (CFListIterator iter= bufBufUniFactors; iter.hasItem(); iter++)
     1113          iter.getItem()= replacevar (iter.getItem(), v, alpha);
     1114        A= replacevar (A, alpha, v);
     1115      }
     1116    }
    9541117    if (!extension)
     1118    {
     1119      if (v==alpha)
    9551120      earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
    9561121                            factorsFoundIndex, degs, earlySuccess,
    957                             smallFactorDeg);
     1122                            smallFactorDeg, b);
     1123      else
     1124      earlyFactorDetection (earlyFactors, bufA, bufBufUniFactors, newLiftBound,
     1125                            factorsFoundIndex, degs, earlySuccess,
     1126                            smallFactorDeg, b);
     1127    }
    9581128    else
    9591129      extEarlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
     
    9681138      bufUniFactors.insert (LC (A, x));
    9691139      henselLiftResume12 (A, bufUniFactors, smallFactorDeg,
    970                           dummy, Pi, diophant, M);
     1140                          dummy, Pi, diophant, M, b);
     1141      if (v!=alpha)
     1142      {
     1143        bufBufUniFactors= bufUniFactors;
     1144        for (CFListIterator iter= bufBufUniFactors; iter.hasItem(); iter++)
     1145          iter.getItem()= replacevar (iter.getItem(), v, alpha);
     1146      }
    9711147      if (!extension)
     1148      {
     1149        if (v==alpha)
    9721150        earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
    973                               factorsFoundIndex, degs, earlySuccess, dummy);
     1151                              factorsFoundIndex, degs, earlySuccess, dummy, b);
     1152        else
     1153        earlyFactorDetection (earlyFactors, bufA,bufBufUniFactors, newLiftBound,
     1154                              factorsFoundIndex, degs, earlySuccess, dummy, b);
     1155      }
    9741156      else
    975         extEarlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
     1157        extEarlyFactorDetection (earlyFactors, bufA,bufUniFactors, newLiftBound,
    9761158                                 factorsFoundIndex, degs, earlySuccess, info,
    9771159                                 eval, dummy);
     
    9841166        dummy= tmin (degree (A,y)+1, (degree (A,y)/4)*(i+1)+4);
    9851167        henselLiftResume12 (A, bufUniFactors, (degree (A,y)/4)*i + 4,
    986                             dummy, Pi, diophant, M);
     1168                            dummy, Pi, diophant, M, b);
     1169        if (v!=alpha)
     1170        {
     1171          bufBufUniFactors= bufUniFactors;
     1172          for (CFListIterator iter= bufBufUniFactors; iter.hasItem(); iter++)
     1173            iter.getItem()= replacevar (iter.getItem(), v, alpha);
     1174        }
    9871175        if (!extension)
     1176        {
     1177          if (v==alpha)
    9881178          earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
    989                                 factorsFoundIndex, degs, earlySuccess, dummy);
     1179                                factorsFoundIndex, degs, earlySuccess, dummy,b);
     1180          else
     1181          earlyFactorDetection (earlyFactors,bufA,bufBufUniFactors,newLiftBound,
     1182                                factorsFoundIndex, degs, earlySuccess, dummy,b);
     1183        }
    9901184        else
    991           extEarlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound,
     1185          extEarlyFactorDetection (earlyFactors,bufA,bufUniFactors,newLiftBound,
    9921186                                   factorsFoundIndex, degs, earlySuccess, info,
    9931187                                   eval, dummy);
     
    10161210
    10171211  return bufUniFactors;
     1212}
     1213
     1214CFList
     1215henselLiftAndEarly (CanonicalForm& A, bool& earlySuccess, CFList&
     1216                    earlyFactors, DegreePattern& degs, int& liftBound,
     1217                    const CFList& uniFactors, const ExtensionInfo& info,
     1218                    const CanonicalForm& eval)
     1219{
     1220  modpk dummy= modpk();
     1221  return henselLiftAndEarly (A, earlySuccess, earlyFactors, degs, liftBound,
     1222                             uniFactors, info, eval, dummy);
    10181223}
    10191224
     
    15921797        {
    15931798          if (A[ii].size() - 1 >= i)
     1799          {
    15941800            buf= getCoeffs (A[ii] [i], k);
    1595           writeInMatrix (C, buf, ii + 1, 0);
     1801            writeInMatrix (C, buf, ii + 1, 0);
     1802          }
    15961803        }
    15971804        NTLC= convertFacCFMatrix2NTLmat_zz_p(C);
     
    17601967              buf= getCoeffs (A[ii] [i], k, l, degMipo, gamma, 0, *NTLMat);
    17611968            }
     1969            writeInMatrix (C, buf, ii + 1, 0);
    17621970          }
    1763           writeInMatrix (C, buf, ii + 1, 0);
    17641971          if (GF)
    17651972            setCharacteristic (getCharacteristic(), degMipo, info.getGFName());
     
    18842091
    18852092          if (A[ii].size() - 1 >= i)
     2093          {
    18862094            buf= getCoeffs (A[ii] [i], k);
    1887           writeInMatrix (C, buf, ii + 1, 0);
     2095            writeInMatrix (C, buf, ii + 1, 0);
     2096          }
    18882097        }
    18892098
     
    20002209        {
    20012210          if (A[ii].size() - 1 >= i)
     2211          {
    20022212            buf= getCoeffs (A[ii] [i], k, alpha);
    2003           writeInMatrix (C, buf, ii + 1, 0);
     2213            writeInMatrix (C, buf, ii + 1, 0);
     2214          }
    20042215        }
    20052216
     
    21042315        {
    21052316          if (A[ii].size() - 1 >= i)
     2317          {
    21062318            buf= getCoeffs (A[ii] [i], k);
    2107           writeInMatrix (C, buf, ii + 1, 0);
     2319            writeInMatrix (C, buf, ii + 1, 0);
     2320          }
    21082321        }
    21092322        NTLC= convertFacCFMatrix2NTLmat_zz_p(C);
     
    22352448        {
    22362449          if (A[ii].size() - 1 >= i)
     2450          {
    22372451            buf= getCoeffs (A[ii] [i], k);
    2238           writeInMatrix (C, buf, ii + 1, 0);
     2452            writeInMatrix (C, buf, ii + 1, 0);
     2453          }
    22392454        }
    22402455        NTLC= convertFacCFMatrix2NTLmat_zz_pE(C);
     
    24142629              buf= getCoeffs (A[ii] [i], k, l, degMipo, gamma, 0, *NTLMat);
    24152630            }
     2631            writeInMatrix (C, buf, ii + 1, 0);
    24162632          }
    2417           writeInMatrix (C, buf, ii + 1, 0);
    24182633          if (GF)
    24192634            setCharacteristic (getCharacteristic(), degMipo, info.getGFName());
     
    25582773        {
    25592774          if (A[ii].size() - 1 >= i)
     2775          {
    25602776            buf= getCoeffs (A[ii] [i], k);
    2561           writeInMatrix (C, buf, ii + 1, 0);
     2777            writeInMatrix (C, buf, ii + 1, 0);
     2778          }
    25622779        }
    25632780        NTLC= convertFacCFMatrix2NTLmat_zz_pE(C);
     
    26782895        {
    26792896          if (A[ii].size() - 1 >= i)
     2897          {
    26802898            buf= getCoeffs (A[ii] [i], k, alpha);
    2681           writeInMatrix (C, buf, ii + 1, 0);
     2899            writeInMatrix (C, buf, ii + 1, 0);
     2900          }
    26822901        }
    26832902        NTLC= convertFacCFMatrix2NTLmat_zz_p(C);
     
    28013020        {
    28023021          if (A[ii].size() - 1 >= i)
     3022          {
    28033023            buf= getCoeffs (A[ii] [i], k);
    2804           writeInMatrix (C, buf, ii + 1, 0);
     3024            writeInMatrix (C, buf, ii + 1, 0);
     3025          }
    28053026        }
    28063027        NTLC= convertFacCFMatrix2NTLmat_zz_p(C);
     
    29033124        {
    29043125          if (A[ii].size() - 1 >= i)
     3126          {
    29053127            buf= getCoeffs (A[ii] [i], k);
    2906           writeInMatrix (C, buf, ii + 1, 0);
     3128            writeInMatrix (C, buf, ii + 1, 0);
     3129          }
    29073130        }
    29083131        NTLC= convertFacCFMatrix2NTLmat_zz_pE(C);
     
    30583281              buf= getCoeffs (A[ii] [i], k, oldL, degMipo, gamma, 0, *NTLMat);
    30593282            }
     3283            writeInMatrix (C, buf, ii + 1, 0);
    30603284          }
    3061           writeInMatrix (C, buf, ii + 1, 0);
    30623285          if (GF)
    30633286            setCharacteristic (getCharacteristic(), degMipo, info.getGFName());
     
    31823405        {
    31833406          if (A[ii].size() - 1 >= i)
     3407          {
    31843408            buf= getCoeffs (A[ii] [i], k, alpha);
    3185           writeInMatrix (C, buf, ii + 1, 0);
     3409            writeInMatrix (C, buf, ii + 1, 0);
     3410          }
    31863411        }
    31873412        NTLC= convertFacCFMatrix2NTLmat_zz_p(C);
     
    32863511        {
    32873512          if (A[ii].size() - 1 >= i)
     3513          {
    32883514            buf= getCoeffs (A[ii] [i], k);
    3289           writeInMatrix (C, buf, ii + 1, 0);
     3515            writeInMatrix (C, buf, ii + 1, 0);
     3516          }
    32903517        }
    32913518        NTLC= convertFacCFMatrix2NTLmat_zz_p(C);
     
    34223649        {
    34233650          if (A[ii].size() - 1 >= i)
     3651          {
    34243652            buf= getCoeffs (A[ii] [i], k);
    3425           writeInMatrix (C, buf, ii + 1, 0);
     3653            writeInMatrix (C, buf, ii + 1, 0);
     3654          }
    34263655        }
    34273656        NTLC= convertFacCFMatrix2NTLmat_zz_pE(C);
     
    36113840              buf= getCoeffs (A[ii] [i], k, l, degMipo, gamma, 0, *NTLMat);
    36123841            }
     3842            writeInMatrix (C, buf, ii + 1, 0);
    36133843          }
    3614           writeInMatrix (C, buf, ii + 1, 0);
    36153844          if (GF)
    36163845            setCharacteristic (getCharacteristic(), degMipo, info.getGFName());
     
    37613990          CFArray buf;
    37623991          if (A[ii].size() - 1 >= i)
     3992          {
    37633993            buf= getCoeffs (A[ii] [i], k, alpha);
    3764           writeInMatrix (C, buf, ii + 1, 0);
     3994            writeInMatrix (C, buf, ii + 1, 0);
     3995          }
    37653996        }
    37663997        NTLC= convertFacCFMatrix2NTLmat_zz_p(C);
     
    43534584  bool success;
    43544585  smallFactors= sieveSmallFactors (F, bufUniFactors, degs, H, diophant, Pi, M,
    4355                                    success, 2*(minBound + 1)
     4586                                   success, minBound + 1
    43564587                                  );
    43574588
     
    44784709  {
    44794710    if (alpha.level() == 1)
    4480       oldL= liftAndComputeLattice (F, bounds, d, 2*(minBound + 1), liftBound,
     4711      oldL= liftAndComputeLattice (F, bounds, d, minBound + 1, liftBound,
    44814712                                   minBound, bufUniFactors, NTLN, diophant, M,
    44824713                                   Pi, bufQ, irreducible
     
    44854716    {
    44864717      if (reduceFq2Fp)
    4487         oldL= liftAndComputeLatticeFq2Fp (F, bounds, d, 2*(minBound + 1),
     4718        oldL= liftAndComputeLatticeFq2Fp (F, bounds, d, minBound + 1,
    44884719                                          liftBound, minBound, bufUniFactors,
    44894720                                          NTLN, diophant, M, Pi, bufQ,
     
    44914722                                         );
    44924723      else
    4493         oldL= liftAndComputeLattice (F, bounds, d, 2*(minBound + 1), liftBound,
     4724        oldL= liftAndComputeLattice (F, bounds, d, minBound + 1, liftBound,
    44944725                                     minBound, bufUniFactors, NTLNe, diophant,
    44954726                                     M, Pi, bufQ, irreducible
     
    55955826      TIMING_END_AND_PRINT (fac_uni_factorizer,
    55965827                            "time for univariate factorization in y: ");
    5597       DEBOUTLN (cerr, "Lc (Aeval2)*prod (uniFactors2)== Aeval2 " <<
     5828      DEBOUTLN (cerr, "Lc (bufAeval2)*prod (bufUniFactors2)== bufAeval2 " <<
    55985829                (prod (bufUniFactors2)*Lc (bufAeval2) == bufAeval2));
    55995830    }
     
    59556186      factors= biFactorize (A, info2);
    59566187
    5957       Variable vBuf= rootOf (gf_mipo);
     6188      CanonicalForm mipo= gf_mipo;
    59586189      setCharacteristic (getCharacteristic());
     6190      Variable vBuf= rootOf (mipo.mapinto());
    59596191      for (CFListIterator j= factors; j.hasItem(); j++)
    59606192        j.getItem()= GF2FalphaRep (j.getItem(), vBuf);
     
    60356267      // pass to GF(p^k+1)
    60366268      {
     6269        CanonicalForm mipo= gf_mipo;
    60376270        setCharacteristic (p);
    6038         Variable vBuf= rootOf (gf_mipo);
     6271        Variable vBuf= rootOf (mipo.mapinto());
    60396272        A= GF2FalphaRep (A, vBuf);
    60406273        setCharacteristic (p, extensionDeg, 'Z');
     
    60446277      else // not able to pass to another GF, pass to F_p(\alpha)
    60456278      {
     6279        CanonicalForm mipo= gf_mipo;
    60466280        setCharacteristic (p);
    6047         Variable vBuf= rootOf (gf_mipo);
     6281        Variable vBuf= rootOf (mipo.mapinto());
    60486282        A= GF2FalphaRep (A, vBuf);
    60496283        Variable v= chooseExtension (vBuf, beta, k);
     
    60646298      else // not able to pass to GF (p^2k), pass to F_p (\alpha)
    60656299      {
     6300        CanonicalForm mipo= gf_mipo;
    60666301        setCharacteristic (p);
    6067         Variable v1= rootOf (gf_mipo);
     6302        Variable v1= rootOf (mipo.mapinto());
    60686303        A= GF2FalphaRep (A, v1);
    60696304        Variable v2= chooseExtension (v1, v1, k);
Note: See TracChangeset for help on using the changeset viewer.