Changeset 428b38e in git


Ignore:
Timestamp:
Nov 16, 2012, 12:56:34 PM (12 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c1c65551e4b3a0de0b13ddf30446f6e9569681b5')
Children:
f3bd4cf51acbd4ce841f52698b25e2b56e561b5d
Parents:
241a04727aaaf99b8ac0d6d44f9fddd8bc4d8221
git-author:
Martin Lee <martinlee84@web.de>2012-11-16 12:56:34+01:00
git-committer:
Martin Lee <martinlee84@web.de>2012-11-16 13:39:10+01:00
Message:
chg: use NTL in tryBrownGCD
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/algext.cc

    r241a04 r428b38e  
    2727#include "cf_generator.h"
    2828#include "facMul.h"
     29#include "facNTLzzpEXGCD.h"
    2930
    3031#ifdef HAVE_NTL
     
    463464    mv = g.level();
    464465  // here: mv is level of the largest variable in f, g
     466  Variable v1= Variable (1);
     467#ifdef HAVE_NTL
     468  Variable v= M.mvar();
     469  zz_p::init (getCharacteristic());
     470  zz_pX NTLMipo= convertFacCF2NTLzzpX (M);
     471  zz_pE::init (NTLMipo);
     472  zz_pEX NTLResult;
     473  zz_pEX NTLF;
     474  zz_pEX NTLG;
     475#endif
    465476  if(mv == 1) // f,g univariate
    466477  {
    467478    TIMING_START (alg_euclid_p)
     479#ifdef HAVE_NTL
     480    NTLF= convertFacCF2NTLzz_pEX (f, NTLMipo);
     481    NTLG= convertFacCF2NTLzz_pEX (g, NTLMipo);
     482    tryNTLGCD (NTLResult, NTLF, NTLG, fail);
     483    if (fail)
     484      return;
     485    result= convertNTLzz_pEX2CF (NTLResult, f.mvar(), v);
     486#else
    468487    tryEuclid(f,g,M,result,fail);
     488    if(fail)
     489      return;
     490#endif
    469491    TIMING_END_AND_PRINT (alg_euclid_p, "time for euclidean alg mod p: ")
    470     if(fail)
    471       return;
    472492    result= NN (reduce (result, M)); // do not forget to map back
    473493    return;
     
    482502    return;
    483503  CanonicalForm c;
     504#ifdef HAVE_NTL
     505  NTLF= convertFacCF2NTLzz_pEX (cf, NTLMipo);
     506  NTLG= convertFacCF2NTLzz_pEX (cg, NTLMipo);
     507  tryNTLGCD (NTLResult, NTLF, NTLG, fail);
     508  if (fail)
     509    return;
     510  c= convertNTLzz_pEX2CF (NTLResult, v1, v);
     511#else
    484512  tryEuclid(cf,cg,M,c,fail);
    485513  if(fail)
    486514    return;
     515#endif
    487516  // f /= cf
    488517  f.tryDiv (cf, M, fail);
     
    518547  CanonicalForm gamma;
    519548  TIMING_START (alg_euclid_p)
     549#ifdef HAVE_NTL
     550  NTLF= convertFacCF2NTLzz_pEX (firstLC (f), NTLMipo);
     551  NTLG= convertFacCF2NTLzz_pEX (firstLC (g), NTLMipo);
     552  tryNTLGCD (NTLResult, NTLF, NTLG, fail);
     553  if (fail)
     554    return;
     555  gamma= convertNTLzz_pEX2CF (NTLResult, v1, v);
     556#else
    520557  tryEuclid( firstLC(f), firstLC(g), M, gamma, fail );
     558  if(fail)
     559    return;
     560#endif
    521561  TIMING_END_AND_PRINT (alg_euclid_p, "time for gcd of lcs in alg mod p: ")
    522   if(fail)
    523     return;
    524562  for(int i=2; i<=mv; i++) // entries at i=0,1 not visited
    525563    if(N[i] < L[i])
Note: See TracChangeset for help on using the changeset viewer.