Changeset c9733f in git


Ignore:
Timestamp:
Nov 27, 2012, 10:30:55 AM (10 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
c7de47e178c8349df34306fb175cec16e9827d57
Parents:
e23e9c874091d7a0a8a96c8b8bb4e1b069f1aedc
git-author:
Martin Lee <martinlee84@web.de>2012-11-27 10:30:55+01:00
git-committer:
Martin Lee <martinlee84@web.de>2012-11-27 11:18:05+01:00
Message:
chg: add new function diophantineQa
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/facHensel.cc

    re23e9c rc9733f  
    693693
    694694CFList
     695diophantineQa (const CanonicalForm& F, const CanonicalForm& G,
     696               const CFList& factors, modpk& b, const Variable& alpha)
     697{
     698  bool fail= false;
     699  CFList recResult;
     700  CanonicalForm modMipo, mipo;
     701  //here SW_RATIONAL is off
     702  On (SW_RATIONAL);
     703  mipo= getMipo (alpha);
     704  bool mipoHasDen= false;
     705  if (!bCommonDen (mipo).isOne())
     706  {
     707    mipo *= bCommonDen (mipo);
     708    mipoHasDen= true;
     709  }
     710  Off (SW_RATIONAL);
     711  int p= b.getp();
     712  setCharacteristic (p);
     713  setReduce (alpha, false);
     714  while (1)
     715  {
     716    setCharacteristic (p);
     717    modMipo= mapinto (mipo);
     718    modMipo /= lc (modMipo);
     719    tryDiophantine (recResult, mapinto (F), mapinto (factors), modMipo, fail);
     720    if (fail)
     721    {
     722      int i= 0;
     723      while (cf_getBigPrime (i) < p)
     724        i++;
     725      findGoodPrime (F, i);
     726      findGoodPrime (G, i);
     727      p=cf_getBigPrime(i);
     728      b = coeffBound( G, p, mipo );
     729      modpk bb= coeffBound (F, p, mipo );
     730      if (bb.getk() > b.getk() ) b=bb;
     731      fail= false;
     732    }
     733    else
     734      break;
     735  }
     736  setReduce (alpha, true);
     737  setCharacteristic (0);
     738
     739  Variable gamma= alpha;
     740  CanonicalForm den;
     741  if (mipoHasDen)
     742  {
     743    On (SW_RATIONAL);
     744    modMipo= getMipo (alpha);
     745    den= bCommonDen (modMipo);
     746    modMipo *= den;
     747    Off (SW_RATIONAL);
     748    setReduce (alpha, false);
     749    gamma= rootOf (b (modMipo*b.inverse (den)));
     750    setReduce (alpha, true);
     751  }
     752
     753  Variable x= Variable (1);
     754  CanonicalForm buf1, buf2, buf3, S;
     755  CFList bufFactors= factors;
     756  CFListIterator i= bufFactors;
     757  if (mipoHasDen)
     758  {
     759    for (; i.hasItem(); i++)
     760      i.getItem()= replacevar (i.getItem(), alpha, gamma);
     761  }
     762  i= bufFactors;
     763  CFList result;
     764  if (i.hasItem())
     765    i++;
     766  buf1= 0;
     767  CanonicalForm Freplaced;
     768  if (mipoHasDen)
     769  {
     770    Freplaced= replacevar (F, alpha, gamma);
     771    buf2= divNTL (Freplaced, replacevar (i.getItem(), alpha, gamma), b);
     772  }
     773  else
     774    buf2= divNTL (F, i.getItem(), b);
     775  ZZ_p::init (convertFacCF2NTLZZ (b.getpk()));
     776  ZZ_pX NTLmipo= to_ZZ_pX (convertFacCF2NTLZZX (getMipo (gamma)));
     777  ZZ_pE::init (NTLmipo);
     778  ZZ_pEX NTLS, NTLT, NTLbuf3;
     779  ZZ_pEX NTLbuf1= convertFacCF2NTLZZ_pEX (buf1, NTLmipo);
     780  ZZ_pEX NTLbuf2= convertFacCF2NTLZZ_pEX (buf2, NTLmipo);
     781  XGCD (NTLbuf3, NTLS, NTLT, NTLbuf1, NTLbuf2);
     782  result.append (b (convertNTLZZ_pEX2CF (NTLS, x, gamma)));
     783  result.append (b (convertNTLZZ_pEX2CF (NTLT, x, gamma)));
     784  if (i.hasItem())
     785    i++;
     786  for (; i.hasItem(); i++)
     787  {
     788    if (mipoHasDen)
     789      buf1= divNTL (Freplaced, i.getItem(), b);
     790    else
     791      buf1= divNTL (F, i.getItem(), b);
     792    XGCD (NTLbuf3, NTLS, NTLT, NTLbuf3, convertFacCF2NTLZZ_pEX (buf1, NTLmipo));
     793    CFListIterator k= bufFactors;
     794    S= convertNTLZZ_pEX2CF (NTLS, x, gamma);
     795    for (CFListIterator j= result; j.hasItem(); j++, k++)
     796    {
     797      j.getItem()= mulNTL (j.getItem(), S, b);
     798      j.getItem()= modNTL (j.getItem(), k.getItem(), b);
     799    }
     800    result.append (b (convertNTLZZ_pEX2CF (NTLT, x, gamma)));
     801  }
     802  return result;
     803}
     804
     805CFList
    695806diophantine (const CanonicalForm& F, const CanonicalForm& G,
    696807             const CFList& factors, modpk& b)
     
    706817      if (b.getp() != 0)
    707818      {
    708         CFList result= diophantineHenselQa (F, G, factors, b, v);
     819        CFList result= diophantineQa (F, G, factors, b, v);
    709820        return result;
    710821      }
Note: See TracChangeset for help on using the changeset viewer.