Changeset 1bc7201 in git for factory


Ignore:
Timestamp:
Oct 19, 2012, 6:38:35 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
c879eea1669e963fb4c7287a3963abb287d00a49
Parents:
b37b3984a12e1552c7bafc9fd5a7849240ea79806bbe944402dfca102dcc3e036c4f2f119be41e44
Message:
Merge pull request #192 from mmklee/algExtGCD_sw

Alg ext gcd sw
Location:
factory
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • factory/algext.cc

    rb37b398 r1bc7201  
    548548        return;
    549549      m *= (x - alpha);
    550       if(gnew == gm) // gnew did not change
    551       {
    552         cf = tryvcontent(gm, Variable(2), M, fail);
     550      if((firstLC(gnew) == gamma) || (gnew == gm)) // gnew did not change
     551      {
     552        cf = tryvcontent(gnew, Variable(2), M, fail);
    553553        if(fail)
    554554          return;
    555555        divides = true;
    556         g_image= gm;
     556        g_image= gnew;
    557557        g_image.tryDiv (cf, M, fail);
    558558        if(fail)
     
    692692  }
    693693  // here: a is the biggest alg. var in f and g AND some of f,g is in extension
    694   // (in the sequel b is used to swap alg/poly vars)
    695694  setReduce(a,false); // do not reduce expressions modulo mipo
    696695  tmp = getMipo(a);
     
    703702    mv = i;
    704703  // here: mv is level of the largest variable in f, g
    705   b = Variable(mv+1);
    706704  bound = new int[mv+1]; // 'bound' could be indexed from 0 to mv, but we will only use from 1 to mv
    707705  other = new int[mv+1];
     
    750748    if(isEqual(bound, other, 1, mv)) // equal
    751749    {
    752       chineseRemainder( D, q, replacevar( mapinto(Dp), a, b ), p, tmp, newq );
     750      chineseRemainder( D, q, mapinto(Dp), p, tmp, newq );
    753751      // tmp = Dp mod p
    754752      // tmp = D mod q
     
    758756        D = tmp;
    759757      On( SW_RATIONAL );
    760       tmp = replacevar( Farey( D, q ), b, a ); // Farey and switch back to alg var
     758      tmp = Farey( D, q ); // Farey
     759      tmp *= bCommonDen (tmp);
    761760      setReduce(a,true); // reduce expressions modulo mipo
    762761      On( SW_RATIONAL ); // needed by fdivides
     
    780779    // here: isLess(other, bound, 1, mv) ) ==> all previous primes unlucky
    781780    q = p;
    782     D = replacevar( mapinto(Dp), a, b ); // shortcut CRA // shortcut CRA
     781    D = mapinto(Dp); // shortcut CRA // shortcut CRA
    783782    for(int i=1; i<=mv; i++) // tighten bound
    784783      bound[i] = other[i];
  • factory/cf_chinese.cc

    rb37b398 r1bc7201  
    227227          }
    228228          else
     229            result += power( x, i.exp() ) * Farey(c,q);
     230#else
     231          if (c.inZ())
     232            result += power( x, i.exp() ) * Farey_n(c,q);
     233          else
     234            result += power( x, i.exp() ) * Farey(c,q);
    229235#endif
    230             result += power( x, i.exp() ) * Farey_n(c,q);
    231236        }
    232237        else
  • factory/cf_gcd_smallp.cc

    r6bbe94 r1bc7201  
    42294229  Evaluation result= Evaluation (A.min(), A.max());
    42304230  ASSERT (A.min() == 2, "expected A.min() == 2");
    4231   ASSERT (A.max() >= n, "expected A.max() >= n");
    42324231  int max_deg;
    42334232  int k= n;
  • factory/facFqBivarUtil.cc

    r6bbe94 r1bc7201  
    519519  }
    520520
    521   q= newtonDiv (bufF, G, xToLOldL);
     521  if (l-oldL > 0)
     522    q= newtonDiv (bufF, G, xToLOldL);
     523  else
     524    q= 0;
    522525  q *= xToOldL;
    523526  q += oldQ;
  • factory/facFqSquarefree.h

    r6bbe94 r1bc7201  
    1818#include "cf_factory.h"
    1919#include "fac_sqrfree.h"
     20#include "cf_factory.h"
    2021
    2122/// squarefree factorization over a finite field
  • factory/facHensel.cc

    r6bbe94 r1bc7201  
    544544  }
    545545
     546  setReduce (alpha, false);
    546547  for (k= 0; k < factors.length(); k++)
    547548  {
     
    554555    }
    555556  }
     557  setReduce (alpha, true);
    556558  setCharacteristic(0);
    557559
     
    591593  }
    592594  setCharacteristic (p);
     595  setReduce (alpha, false);
    593596  recResult= mapinto (recResult);
     597  setReduce (alpha, true);
    594598  if (mipoHasDen)
    595599  {
     
    606610    coeffE= div (e, modulus);
    607611    setCharacteristic (p);
     612    if (mipoHasDen)
     613      setReduce (gamma, false);
     614    else
     615      setReduce (alpha, false);
    608616    coeffE= coeffE.mapinto();
     617    if (mipoHasDen)
     618      setReduce (gamma, true);
     619    else
     620      setReduce (alpha, true);
    609621    if (mipoHasDen)
    610622      coeffE= replacevar (coeffE, gamma, beta);
     
    619631      {
    620632        setCharacteristic (p);
     633        setReduce (alpha, false);
    621634        g= mulNTL (coeffE, j.getItem());
    622635        g= modNTL (g, bufFactors[ii]);
     636        setReduce (alpha, true);
    623637        setCharacteristic (0);
    624638        if (mipoHasDen)
    625639        {
     640          setReduce (beta, false);
    626641          k.getItem() += replacevar (g.mapinto()*modulus, beta, gamma);
    627642          e -= mulNTL (replacevar (g.mapinto(), beta, gamma)*modulus,
    628643                                   l.getItem(), b);
     644          setReduce (beta, true);
    629645        }
    630646        else
  • factory/facMul.cc

    r6bbe94 r1bc7201  
    404404      {
    405405        ZZ_p::init (convertFacCF2NTLZZ (b.getpk()));
    406         ZZ_pX NTLmipo= to_ZZ_pX (convertFacCF2NTLZZX (getMipo (alpha)));
     406        CanonicalForm mipo= getMipo (alpha);
     407        bool is_rat= isOn (SW_RATIONAL);
     408        if (!is_rat)
     409          On (SW_RATIONAL);
     410        mipo *=bCommonDen (mipo);
     411        if (!is_rat)
     412          Off (SW_RATIONAL);
     413        ZZ_pX NTLmipo= to_ZZ_pX (convertFacCF2NTLZZX (mipo));
    407414        ZZ_pE::init (NTLmipo);
    408415        ZZ_pEX NTLg= convertFacCF2NTLZZ_pEX (G, NTLmipo);
  • factory/fac_ezgcd.cc

    r6bbe94 r1bc7201  
    215215  Evaluation result= Evaluation (A.min(), A.max());
    216216  ASSERT (A.min() == 2, "expected A.min() == 2");
    217   ASSERT (A.max() == n, "expected A.max() == n");
    218217  int max_deg;
    219218  int k= n;
Note: See TracChangeset for help on using the changeset viewer.