Changeset 287cc8 in git for ntl/src/GF2EXFactoring.c


Ignore:
Timestamp:
Jan 5, 2010, 5:51:13 PM (14 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
3c38b3810fd61108b01f123f5a91e13ccff52b20
Parents:
1d43d184dd871d77c1ba8e095d768f22a0fbe92f
Message:
ntl 5.5.2

git-svn-id: file:///usr/local/Singular/svn/trunk@12402 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ntl/src/GF2EXFactoring.c

    r1d43d18 r287cc8  
    2929   c = res;
    3030}
    31    
     31
    3232
    3333
     
    7979         d = deg(r)/2;
    8080         f.rep.SetLength(d+1);
    81          for (k = 0; k <= d; k++) 
     81         for (k = 0; k <= d; k++)
    8282            IterSqr(f.rep[k], r.rep[k*2], GF2E::degree()-1);
    8383         m = m*2;
     
    8585   } while (!finished);
    8686}
    87          
     87
    8888
    8989
     
    216216   SetX(res);
    217217   long i;
    218    for (i = 0; i < GF2E::degree(); i++) 
     218   for (i = 0; i < GF2E::degree(); i++)
    219219      SqrMod(res, res, F);
    220220
     
    241241         long m1 = 2*m;
    242242         if (i & d) m1++;
    243    
     243
    244244         if (m1 >= NTL_BITS_PER_LONG-1 || (1L << m1) >= n) break;
    245    
     245
    246246         m = m1;
    247247         i = i >> 1;
     
    290290         long m1 = 2*m;
    291291         if (i & d) m1++;
    292    
     292
    293293         if (m1 >= NTL_BITS_PER_LONG-1 || (1L << m1) >= n) break;
    294    
     294
    295295         m = m1;
    296296         i = i >> 1;
     
    344344
    345345
    346    
     346
    347347
    348348
     
    359359      return;
    360360   }
    361      
     361
    362362   GF2EX h;
    363363
    364364   GF2E r;
    365365
    366    
     366
    367367   {
    368368      GF2EXModulus F;
     
    379379
    380380   RecFindRoots(x, h);
    381    div(h, f, h); 
     381   div(h, f, h);
    382382   RecFindRoots(x, h);
    383383}
     
    435435static
    436436void split(GF2EX& f1, GF2EX& g1, GF2EX& f2, GF2EX& g2,
    437            const GF2EX& f, const GF2EX& g, 
     437           const GF2EX& f, const GF2EX& g,
    438438           const vec_GF2E& roots, long lo, long mid)
    439439{
     
    456456
    457457   GCD(f1, a, f);
    458    
     458
    459459   div(f2, f, f1);
    460460
     
    520520
    521521
    522    
     522
    523523
    524524void SFBerlekamp(vec_GF2EX& factors, const GF2EX& ff, long verbose)
     
    619619      Error("berlekamp: bad args");
    620620
    621    
     621
    622622   SquareFreeDecomp(sfd, f);
    623623
     
    644644
    645645static
    646 void ProcessTable(GF2EX& f, vec_pair_GF2EX_long& factors, 
     646void ProcessTable(GF2EX& f, vec_pair_GF2EX_long& factors,
    647647                  const GF2EXModulus& F, long limit, const vec_GF2EX& tbl,
    648648                  long d, long verbose)
     
    681681
    682682   while (2*d <= deg(t1)) {
    683       GCD(t2, tbl[i], t1); 
     683      GCD(t2, tbl[i], t1);
    684684      if (deg(t2) > 0) {
    685685         AddFactor(factors, t2, d, verbose);
     
    696696
    697697
    698 void TraceMap(GF2EX& w, const GF2EX& a, long d, const GF2EXModulus& F, 
     698void TraceMap(GF2EX& w, const GF2EX& a, long d, const GF2EXModulus& F,
    699699              const GF2EX& b)
    700700
     
    710710   while (d) {
    711711      if (d == 1) {
    712          if (IsZero(w)) 
     712         if (IsZero(w))
    713713            w = y;
    714714         else {
     
    817817long GF2EX_BlockingFactor = 10;
    818818
    819 void DDF(vec_pair_GF2EX_long& factors, const GF2EX& ff, const GF2EX& hh, 
     819void DDF(vec_pair_GF2EX_long& factors, const GF2EX& ff, const GF2EX& hh,
    820820         long verbose)
    821821{
     
    836836   }
    837837
    838    long CompTableSize = 2*SqrRoot(deg(f)); 
     838   long CompTableSize = 2*SqrRoot(deg(f));
    839839
    840840   long GCDTableSize = GF2EX_BlockingFactor;
     
    876876
    877877         if (deg(f) < old_n) {
    878             // f has changed 
     878            // f has changed
    879879
    880880            build(F, f);
     
    916916   GF2EXModulus F;
    917917   vec_GF2E roots;
    918    
     918
    919919   build(F, f);
    920920   long n = F.n;
     
    947947   }
    948948}
    949          
     949
    950950
    951951void EDF(vec_GF2EX& factors, const GF2EX& ff, const GF2EX& bb,
     
    978978   }
    979979
    980    
     980
    981981   factors.SetLength(0);
    982982
     
    10081008   double t;
    10091009
    1010    
     1010
    10111011   GF2EXModulus F;
    10121012   build(F, f);
     
    10501050   }
    10511051}
    1052    
     1052
    10531053void CanZass(vec_pair_GF2EX_long& factors, const GF2EX& f, long verbose)
    10541054{
     
    10601060   vec_GF2EX x;
    10611061
    1062    
     1062
    10631063   SquareFreeDecomp(sfd, f);
    10641064
     
    11211121
    11221122static
    1123 void TandemPowerCompose(GF2EX& y1, GF2EX& y2, const GF2EX& h, 
     1123void TandemPowerCompose(GF2EX& y1, GF2EX& y2, const GF2EX& h,
    11241124                        long q1, long q2, const GF2EXModulus& F)
    11251125{
     
    12011201   long q1, q2, r1, r2;
    12021202
    1203    q1 = fvec[fvec[u].link].val; 
     1203   q1 = fvec[fvec[u].link].val;
    12041204   q2 = fvec[fvec[u].link+1].val;
    12051205
     
    12101210}
    12111211
    1212    
     1212
    12131213
    12141214
     
    12181218   // the common degree of the irreducible factors of f is computed
    12191219{
    1220    if (F.n == 1 || IsX(h)) 
     1220   if (F.n == 1 || IsX(h))
    12211221      return 1;
    12221222
     
    12391239
    12401240   f = ff;
    1241    
     1241
    12421242   if (!IsOne(LeadCoeff(f)))
    12431243      Error("FindRoot: bad args");
     
    12611261      }
    12621262   }
    1263  
     1263
    12641264   root = ConstTerm(f);
    12651265}
     
    13081308
    13091309
    1310    q1 = fvec[fvec[u].link].val; 
     1310   q1 = fvec[fvec[u].link].val;
    13111311   q2 = fvec[fvec[u].link+1].val;
    13121312
    13131313   TandemPowerCompose(h1, h2, h, q1, q2, F);
    1314    return RecIrredTest(fvec[u].link, h2, F, fvec) 
     1314   return RecIrredTest(fvec[u].link, h2, F, fvec)
    13151315          && RecIrredTest(fvec[u].link+1, h1, F, fvec);
    13161316}
     
    13241324
    13251325   build(F, f);
    1326    
     1326
    13271327   GF2EX h;
    13281328
     
    13501350
    13511351   build(F, f);
    1352    
     1352
    13531353   GF2EX h;
    13541354
     
    16721672   long i;
    16731673
    1674    long HexOutput = GF2X::HexOutput; 
     1674   long HexOutput = GF2X::HexOutput;
    16751675   GF2X::HexOutput = 1;
    16761676
     
    17081708}
    17091709
    1710    
     1710
    17111711
    17121712
     
    17781778   }
    17791779}
    1780      
     1780
    17811781
    17821782
     
    18381838
    18391839         long i;
    1840          for (i = 1; i <= k-1; i++) 
     1840         for (i = 1; i <= k-1; i++)
    18411841            rem(BabyStep[i], BabyStep[i], F);
    18421842      }
     
    18471847   }
    18481848
    1849    if (deg(f) > 0) 
     1849   if (deg(f) > 0)
    18501850      NewAddFactor(u, f, 0, verbose);
    18511851
     
    19021902   NewProcessTable(factors, f, F, buf, size, first_d, 1, verbose);
    19031903
    1904    if (deg(f) > 0) 
     1904   if (deg(f) > 0)
    19051905      NewAddFactor(factors, f, deg(f), verbose);
    19061906}
    1907    
     1907
    19081908
    19091909
     
    19351935}
    19361936
    1937      
    1938      
    1939 
    1940      
     1937
     1938
     1939
     1940
    19411941
    19421942void NewDDF(vec_pair_GF2EX_long& factors,
     
    19621962   if (!GF2EX_stem[0])
    19631963      sprintf(GF2EX_stem, "ddf-%ld", RandomBnd(10000));
    1964      
     1964
    19651965   long B = deg(f)/2;
    19661966   long k = SqrRoot(B);
Note: See TracChangeset for help on using the changeset viewer.