Changeset 03c742 in git


Ignore:
Timestamp:
Jun 26, 2020, 6:03:59 PM (4 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '4188d308699580d975efd0f6cca8dcb41c396f70')
Children:
f87a54f01779194a0163ca39873f5b4255a4f510
Parents:
b666c768103c724ed3617954c684de0e621144d2
Message:
factory: BuildIrred, FLINT/NTL seperation
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • Singular/misc_ip.cc

    rb666c7 r03c742  
    13281328* initialize components of Singular
    13291329*/
     1330#ifdef HAVE_FLINT
     1331extern "C"
     1332{
     1333GLOBAL_VAR flint_rand_t FLINTrandom;
     1334}
     1335#endif
     1336
    13301337void siInit(char *name)
    13311338{
     
    13901397  siRandomStart=t;
    13911398  feOptSpec[FE_OPT_RANDOM].value = (void*) ((long)siRandomStart);
     1399  #ifdef HAVE_FLINT
     1400  flint_randinit(FLINTrandom);
     1401  #endif
    13921402
    13931403// ressource table: ----------------------------------------------------
  • factory/FLINTconvert.h

    rb666c7 r03c742  
    4242#include <flint/fq_nmod_mat.h>
    4343#endif
     44
     45EXTERN_VAR flint_rand_t FLINTrandom;
     46
    4447#ifdef __cplusplus
    4548}
  • factory/cfEzgcd.cc

    rb666c7 r03c742  
    2525#include "cfModGcd.h"
    2626#include "cf_util.h"
     27#include "cf_iter.h"
    2728#include "cf_map_ext.h"
    2829#include "cf_algorithm.h"
     
    3435#include "facHensel.h"
    3536
     37#ifdef HAVE_FLINT
     38#include "FLINTconvert.h"
     39#endif
     40
    3641#ifdef HAVE_NTL
    3742#include "NTLconvert.h"
     43#endif
    3844
    3945static const double log2exp= 1.442695041;
     
    290296}
    291297
     298#ifdef HAVE_NTL // nonMonicHenselLift2
    292299static inline
    293300int Hensel (const CanonicalForm & UU, CFArray & G, const Evaluation & AA,
     
    370377  return 1;
    371378}
     379#endif
    372380
    373381static
     
    477485}
    478486
     487#ifdef HAVE_NTL // Hensel
    479488/// real implementation of EZGCD over Z
    480489static CanonicalForm
     
    838847#endif
    839848
     849#ifdef HAVE_NTL // Hensel
    840850/// Extended Zassenhaus GCD over Z.
    841851/// In case things become too dense we switch to a modular algorithm.
     
    843853ezgcd ( const CanonicalForm & FF, const CanonicalForm & GG )
    844854{
    845 #ifdef HAVE_NTL
    846855  REvaluation b;
    847856  return ezgcd( FF, GG, b, false );
    848 #else
    849   Off (SW_USE_EZGCD);
    850   return gcd (FF, GG);
    851   On (SW_USE_EZGCD);
     857}
    852858#endif
    853 }
    854 
    855 #ifdef HAVE_NTL
     859
     860#if defined(HAVE_NTL) || defined(HAVE_FLINT)
    856861// parameters for heuristic
    857862STATIC_VAR int maxNumEval= 200;
     
    860865/// Extended Zassenhaus GCD for finite fields.
    861866/// In case things become too dense we switch to a modular algorithm.
     867#ifdef HAVE_NTL // primitiveElement, FindRoot
    862868CanonicalForm EZGCD_P( const CanonicalForm & FF, const CanonicalForm & GG )
    863869{
     
    10081014    if (p == 2 && d < 6)
    10091015    {
    1010       if (fac_NTL_char != p)
    1011       {
    1012         fac_NTL_char= p;
    1013         zz_p::init (p);
    1014       }
    10151016      bool primFail= false;
    10161017      Variable vBuf;
     
    10191020      if (d < 3)
    10201021      {
     1022        #ifdef HAVE_FLINT
     1023        nmod_poly_t Irredpoly;
     1024        nmod_poly_init(Irredpoly,p);
     1025        nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, 3*d+1);
     1026        CanonicalForm newMipo=convertnmod_poly_t2FacCF(Irredpoly,Variable(1));
     1027        nmod_poly_clear(Irredpoly);
     1028        #elif defined(HAVE_NTL)
     1029        if (fac_NTL_char != p)
     1030        {
     1031          fac_NTL_char= p;
     1032          zz_p::init (p);
     1033        }
    10211034        zz_pX NTLIrredpoly;
    10221035        BuildIrred (NTLIrredpoly, d*3);
    10231036        CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1));
     1037        #endif
    10241038        v2= rootOf (newMipo);
    10251039      }
    10261040      else
    10271041      {
     1042        #ifdef HAVE_FLINT
     1043        nmod_poly_t Irredpoly;
     1044        nmod_poly_init(Irredpoly,p);
     1045        nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, 2*d+1);
     1046        CanonicalForm newMipo=convertnmod_poly_t2FacCF(Irredpoly,Variable(1));
     1047        nmod_poly_clear(Irredpoly);
     1048        #elif defined(HAVE_NTL)
     1049        if (fac_NTL_char != p)
     1050        {
     1051          fac_NTL_char= p;
     1052          zz_p::init (p);
     1053        }
    10281054        zz_pX NTLIrredpoly;
    10291055        BuildIrred (NTLIrredpoly, d*2);
    10301056        CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1));
     1057        #endif
    10311058        v2= rootOf (newMipo);
    10321059      }
     
    10361063    else if ((p == 3 && d < 4) || ((p == 5 || p == 7) && d < 3))
    10371064    {
    1038       if (fac_NTL_char != p)
    1039       {
    1040         fac_NTL_char= p;
    1041         zz_p::init (p);
    1042       }
    10431065      bool primFail= false;
    10441066      Variable vBuf;
    10451067      primElem= primitiveElement (a, vBuf, primFail);
    10461068      ASSERT (!primFail, "failure in integer factorizer");
     1069      #ifdef HAVE_FLINT
     1070      nmod_poly_t Irredpoly;
     1071      nmod_poly_init(Irredpoly,p);
     1072      nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, 2*d+1);
     1073      CanonicalForm newMipo=convertnmod_poly_t2FacCF(Irredpoly,Variable(1));
     1074      nmod_poly_clear(Irredpoly);
     1075      #elif defined(HAVE_NTL)
     1076      if (fac_NTL_char != p)
     1077      {
     1078        fac_NTL_char= p;
     1079        zz_p::init (p);
     1080      }
    10471081      zz_pX NTLIrredpoly;
    10481082      BuildIrred (NTLIrredpoly, d*2);
    10491083      CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1));
     1084      #endif
    10501085      v2= rootOf (newMipo);
    10511086      imPrimElem= mapPrimElem (primElem, a, v2);
     
    14671502  return N (d*cand);
    14681503}
     1504#endif /*HAVE_NTL*/
    14691505#endif
    1470 
  • factory/cfGcdUtil.cc

    rb666c7 r03c742  
    1414#endif
    1515
     16#ifdef HAVE_FLINT
     17#include "FLINTconvert.h"
     18#endif
     19
    1620/// Coprimality Check. f and g are assumed to have the same level. If swap is
    1721/// true, the main variables of f and g are swapped with Variable(1). If the
    1822/// result is false, d is set to the degree of the gcd of f and g evaluated at a
    1923/// random point in K^n-1. This gcd is a gcd of univariate polynomials.
     24#ifdef HAVE_NTL // primitiveElement, FindRoot
    2025bool
    2126gcd_test_one ( const CanonicalForm & f, const CanonicalForm & g, bool swap, int & d )
     
    8388    else if (p > 0 && p < TEST_ONE_MAX && algExtension)
    8489    {
    85 #ifdef HAVE_NTL
     90#if defined(HAVE_NTL) || defined(HAVE_FLINT)
    8691      int d= degree (getMipo (v));
    8792      CFList source, dest;
     
    9095      if (p == 2 && d < 6)
    9196      {
    92         if (fac_NTL_char != 2)
    93         {
    94           fac_NTL_char= 2;
    95           zz_p::init (p);
    96         }
    9797        bool primFail= false;
    9898        Variable vBuf;
     
    101101        if (d < 3)
    102102        {
     103          #ifdef HAVE_FLINT
     104          nmod_poly_t Irredpoly;
     105          nmod_poly_init(Irredpoly,p);
     106          nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, 3*d+1);
     107          CanonicalForm newMipo=convertnmod_poly_t2FacCF(Irredpoly,Variable(1));
     108          nmod_poly_clear(Irredpoly);
     109          #elif defined(HAVE_NTL)
     110          if (fac_NTL_char != 2)
     111          {
     112            fac_NTL_char= 2;
     113            zz_p::init (p);
     114          }
    103115          zz_pX NTLIrredpoly;
    104116          BuildIrred (NTLIrredpoly, d*3);
    105117          CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1));
     118          #endif
    106119          v2= rootOf (newMipo);
    107120        }
    108121        else
    109122        {
     123          #ifdef HAVE_FLINT
     124          nmod_poly_t Irredpoly;
     125          nmod_poly_init(Irredpoly,p);
     126          nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, 3*d+1);
     127          CanonicalForm newMipo=convertnmod_poly_t2FacCF(Irredpoly,Variable(1));
     128          nmod_poly_clear(Irredpoly);
     129          #elif defined(HAVE_NTL)
     130          if (fac_NTL_char != 2)
     131          {
     132            fac_NTL_char= 2;
     133            zz_p::init (p);
     134          }
    110135          zz_pX NTLIrredpoly;
    111136          BuildIrred (NTLIrredpoly, d*2);
    112137          CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1));
     138          #endif
    113139          v2= rootOf (newMipo);
    114140        }
     
    118144      else if ((p == 3 && d < 4) || ((p == 5 || p == 7) && d < 3))
    119145      {
     146        bool primFail= false;
     147        Variable vBuf;
     148        primElem= primitiveElement (v, vBuf, primFail);
     149        ASSERT (!primFail, "failure in integer factorizer");
     150        #ifdef HAVE_FLINT
     151        nmod_poly_t Irredpoly;
     152        nmod_poly_init(Irredpoly,p);
     153        nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, 2*d+1);
     154        CanonicalForm newMipo=convertnmod_poly_t2FacCF(Irredpoly,Variable(1));
     155        nmod_poly_clear(Irredpoly);
     156        #elif defined(HAVE_NTL)
    120157        if (fac_NTL_char != p)
    121158        {
     
    123160          zz_p::init (p);
    124161        }
    125         bool primFail= false;
    126         Variable vBuf;
    127         primElem= primitiveElement (v, vBuf, primFail);
    128         ASSERT (!primFail, "failure in integer factorizer");
    129162        zz_pX NTLIrredpoly;
    130163        BuildIrred (NTLIrredpoly, d*2);
    131164        CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1));
     165        #endif
    132166        v2= rootOf (newMipo);
    133167        imPrimElem= mapPrimElem (primElem, v, v2);
     
    219253    return result;
    220254}
     255#endif
    221256
    222257/**
  • factory/cfModGcd.cc

    rb666c7 r03c742  
    8585}
    8686
    87 #ifdef HAVE_NTL
     87#if defined(HAVE_NTL)|| defined(HAVE_FLINT)
    8888
    8989static const double log2exp= 1.442695041;
     
    422422Variable chooseExtension (const Variable & alpha)
    423423{
    424   if (fac_NTL_char != getCharacteristic())
    425   {
    426     fac_NTL_char= getCharacteristic();
    427     zz_p::init (getCharacteristic());
    428   }
    429   zz_pX NTLIrredpoly;
    430424  int i, m;
    431425  // extension of F_p needed
     
    440434    m= degree (getMipo (alpha));
    441435  }
     436  #ifdef HAVE_FLINT
     437  nmod_poly_t Irredpoly;
     438  nmod_poly_init(Irredpoly,getCharacteristic());
     439  nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, i*m+1);
     440  CanonicalForm newMipo=convertnmod_poly_t2FacCF(Irredpoly,Variable(1));
     441  nmod_poly_clear(Irredpoly);
     442  #else
     443  if (fac_NTL_char != getCharacteristic())
     444  {
     445    fac_NTL_char= getCharacteristic();
     446    zz_p::init (getCharacteristic());
     447  }
     448  zz_pX NTLIrredpoly;
    442449  BuildIrred (NTLIrredpoly, i*m);
    443450  CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1));
     451  #endif
    444452  return rootOf (newMipo);
    445453}
    446454
     455#ifdef HAVE_NTL
    447456CanonicalForm
    448457modGCDFq (const CanonicalForm& F, const CanonicalForm& G,
    449458                  CanonicalForm& coF, CanonicalForm& coG,
    450459                  Variable & alpha, CFList& l, bool& topLevel);
    451 
     460#endif
     461
     462#ifdef HAVE_NTL // modGCDFq
    452463CanonicalForm
    453464modGCDFq (const CanonicalForm& F, const CanonicalForm& G,
     
    459470  return result;
    460471}
     472#endif
    461473
    462474/// GCD of F and G over \f$ F_{p}(\alpha ) \f$ ,
     
    464476/// based on Alg. 7.2. as described in "Algorithms for
    465477/// Computer Algebra" by Geddes, Czapor, Labahn
     478#ifdef HAVE_NTL // primitiveElement, FindRoot
    466479CanonicalForm
    467480modGCDFq (const CanonicalForm& F, const CanonicalForm& G,
     
    799812  } while (1);
    800813}
     814#endif
    801815
    802816/// compute a random element a of GF, s.t. F(a) \f$ \neq 0 \f$ , F is a
     
    11891203}
    11901204
     1205#ifdef HAVE_NTL // primitiveElement, FindRoot
    11911206CanonicalForm
    11921207modGCDFp (const CanonicalForm& F, const CanonicalForm&  G,
    11931208             CanonicalForm& coF, CanonicalForm& coG,
    11941209             bool& topLevel, CFList& l);
    1195 
     1210#endif
     1211
     1212#ifdef HAVE_NTL // primitiveElement, FindRoot
    11961213CanonicalForm
    11971214modGCDFp (const CanonicalForm& F, const CanonicalForm& G,
     
    12021219  return result;
    12031220}
    1204 
     1221#endif
     1222
     1223#ifdef HAVE_NTL // primitiveElement, FindRoot
    12051224CanonicalForm
    12061225modGCDFp (const CanonicalForm& F, const CanonicalForm&  G,
     
    15571576  } while (1);
    15581577}
     1578#endif
    15591579
    15601580CFArray
     
    17631783}
    17641784
     1785#ifdef HAVE_NTL //gauss, zz_pE
    17651786long
    17661787gaussianElimFq (CFMatrix& M, CFArray& L, const Variable& alpha)
     
    18011822  return rk;
    18021823}
     1824#endif
    18031825
    18041826CFArray
     
    18541876}
    18551877
     1878#ifdef HAVE_NTL //gauss, zz_pE
    18561879CFArray
    18571880solveSystemFq (const CFMatrix& M, const CFArray& L, const Variable& alpha)
     
    18931916  return A;
    18941917}
     1918#endif
    18951919#endif
    18961920
     
    21372161}
    21382162
     2163#ifdef HAVE_NTL // primitiveElement,FindRoot
    21392164CanonicalForm
    21402165monicSparseInterpol (const CanonicalForm& F, const CanonicalForm& G,
     
    24202445  }
    24212446}
    2422 
     2447#endif
     2448
     2449#ifdef HAVE_NTL // primitiveElement, FindRoot
    24232450CanonicalForm
    24242451nonMonicSparseInterpol (const CanonicalForm& F, const CanonicalForm& G,
     
    30683095  }
    30693096}
    3070 
     3097#endif
     3098
     3099#ifdef HAVE_NTL // primitiveElement,FindRoot
    30713100CanonicalForm sparseGCDFq (const CanonicalForm& F, const CanonicalForm& G,
    30723101                           const Variable & alpha, CFList& l, bool& topLevel)
     
    35003529  } while (1);
    35013530}
    3502 
     3531#endif
     3532
     3533#ifdef HAVE_NTL // primitiveElement,FindRoot
    35033534CanonicalForm sparseGCDFp (const CanonicalForm& F, const CanonicalForm& G,
    35043535                           bool& topLevel, CFList& l)
     
    40084039  } while (1); //end of first do
    40094040}
     4041#endif
    40104042
    40114043TIMING_DEFINE_PRINT(modZ_termination)
  • factory/cfModResultant.cc

    rb666c7 r03c742  
    3838#endif
    3939
    40 #ifdef HAVE_NTL
     40#if defined(HAVE_NTL) || defined(HAVE_FLINT)
    4141TIMING_DEFINE_PRINT(fac_resultant_p)
    4242
     
    255255CanonicalForm uniResultant (const CanonicalForm& F, const CanonicalForm& G)
    256256{
    257 #ifdef HAVE_NTL
    258257  ASSERT (getCharacteristic() > 0, "characteristic > 0 expected");
    259258  if (F.inCoeffDomain() && G.inCoeffDomain())
     
    274273    return CanonicalForm ((long) FLINTresult);
    275274  }
    276 #else
     275  return resultant (F, G, F.mvar());
     276#elif defined(HAVE_NTL)
    277277  if (!hasFirstAlgVar (F, alpha) && !hasFirstAlgVar (G,alpha))
    278278  {
     
    289289    return CanonicalForm (to_long (rep (NTLResult)));
    290290  }
    291 #endif
    292291  //at this point F or G has an algebraic var.
    293292  if (fac_NTL_char != getCharacteristic())
     
    346345}
    347346
     347#ifdef HAVE_NTL // primitiveElement
    348348CanonicalForm
    349349resultantFp (const CanonicalForm& A, const CanonicalForm& B, const Variable& x,
     
    522522  return N (H);
    523523}
     524#endif
    524525
    525526static inline
     
    557558}
    558559
     560#ifdef HAVE_NTL // resultantFp
    559561CanonicalForm
    560562resultantZ (const CanonicalForm& A, const CanonicalForm& B, const Variable& x,
     
    685687}
    686688#endif
    687 
     689#endif
     690
  • factory/cfSubResGcd.cc

    rb666c7 r03c742  
    5151    C = gcd( Ci, Ci1 );
    5252    int d= 0;
     53    #ifdef HAVE_NTL // gcd_test_one, primitiveElement
    5354    if ( !( pi.isUnivariate() && pi1.isUnivariate() ) )
    5455    {
     
    6263    }
    6364    else
     65    #endif
    6466    {
    6567        bpure = isPurePoly(pi) && isPurePoly(pi1);
     
    196198#endif
    197199    }
     200    #ifdef HAVE__NTL // gcd_test_one, primitievElement
    198201    else if ( gcd_test_one( pi1, pi, true, d ) )
    199202      return C;
     203    #else
     204    else if (gcd(pi1,pi)==1)
     205      return C;
     206    #endif
    200207    Variable v = f.mvar();
    201208    Hi = power( LC( pi1, v ), delta );
  • factory/cf_gcd.cc

    rb666c7 r03c742  
    141141    else
    142142    #endif
     143    #ifdef HAVE_NTL
    143144    if ( isOn( SW_USE_EZGCD ) )
    144145      fc= ezgcd (fc, gc);
     146    #endif 
    145147    #ifdef HAVE_NTL
    146148    else if (isOn(SW_USE_CHINREM_GCD))
    147149      fc = modGCDZ( fc, gc);
    148     #endif
    149     else
     150    else
     151    #endif
    150152    {
    151153       fc = subResGCD_0( fc, gc );
  • factory/cf_irred.cc

    rb666c7 r03c742  
    1414#ifdef HAVE_NTL
    1515#include "NTLconvert.h"
     16#endif
     17
     18#ifdef HAVE_FLINT
     19#include "FLINTconvert.h"
    1620#endif
    1721
     
    3640}
    3741
    38 #ifdef HAVE_NTL
     42#if defined(HAVE_NTL) || defined(HAVE_FLINT)
    3943/// computes a random monic irreducible univariate polynomial in x over Fp of
    40 /// degree i via NTL
     44/// degree i via NTL/FLINT
    4145CanonicalForm
    4246randomIrredpoly (int i, const Variable & x)
    4347{
    4448  int p= getCharacteristic();
     49  #ifdef HAVE_FLINT
     50  nmod_poly_t Irredpoly;
     51  nmod_poly_init(Irredpoly,p);
     52  nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, i+1);
     53  CanonicalForm CFirredpoly=convertnmod_poly_t2FacCF(Irredpoly,Variable(1));
     54  nmod_poly_clear(Irredpoly);
     55  #elif defined(HAVE_NTL)
    4556  if (fac_NTL_char != p)
    4657  {
     
    4960  }
    5061  zz_pX NTLirredpoly;
    51   CanonicalForm CFirredpoly;
    5262  BuildIrred (NTLirredpoly, i);
    53   CFirredpoly= convertNTLzzpX2CF (NTLirredpoly, x);
     63  CanonicalForm CFirredpoly= convertNTLzzpX2CF (NTLirredpoly, x);
     64  #endif
    5465  return CFirredpoly;
    5566}
  • factory/cf_map_ext.cc

    rb666c7 r03c742  
    306306}
    307307
    308 #ifdef HAVE_NTL
     308#ifdef HAVE_NTL // FindRoot
    309309CanonicalForm
    310310primitiveElement (const Variable& alpha, Variable& beta, bool& fail)
     
    323323  int d= degree (mipo);
    324324  int p= getCharacteristic ();
     325  //#if !defined(HAVE_FLINT) && defined(AHVE_NTL)
    325326  if (fac_NTL_char != p)
    326327  {
     
    329330  }
    330331  zz_pX NTL_mipo;
     332  //#endif
    331333  CanonicalForm mipo2;
    332334  primitive= false;
     
    335337  do
    336338  {
     339    //#ifdef HAVE_FLINT
     340    //nmod_poly_t Irredpoly;
     341    //nmod_poly_init(Irredpoly,p);
     342    //nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, d+1);
     343    //mipo2=convertnmod_poly_t2FacCF(Irredpoly,Variable(1));
     344    //nmod_poly_clear(Irredpoly);
     345    //#elif defined(HAVE_NTL)
    337346    BuildIrred (NTL_mipo, d);
    338347    mipo2= convertNTLzzpX2CF (NTL_mipo, Variable (1));
     348    //#endif
    339349    if (!initialized)
    340350      beta= rootOf (mipo2);
  • factory/facBivar.cc

    rb666c7 r03c742  
    2626#include "cf_primes.h"
    2727
    28 #ifdef HAVE_NTL
    2928TIMING_DEFINE_PRINT(fac_uni_factorizer)
    3029TIMING_DEFINE_PRINT(fac_bi_hensel_lift)
     
    185184}
    186185
     186#ifdef HAVE_NTL // resultatnt(ZZ), discrimeninat
    187187CFList biFactorize (const CanonicalForm& F, const Variable& v)
    188188{
     
    607607  return factors;
    608608}
    609 
    610609#endif
  • factory/facFqBivar.cc

    rb666c7 r03c742  
    3939#ifdef HAVE_NTL
    4040#include "NTLconvert.h"
     41#endif
    4142
    4243#ifdef HAVE_FLINT
     
    7980}
    8081
     82#if defined(HAVE_NTL) || defined(HAVE_FLINT)
    8183CanonicalForm evalPoint (const CanonicalForm& F, CanonicalForm & eval,
    8284                         const Variable& alpha, CFList& list, const bool& GF,
     
    170172    Variable beta= rootOf (mipo.mapinto());
    171173    CanonicalForm buf= GF2FalphaRep (A, beta);
     174#ifdef HAVE_NTL   
    172175    if (getCharacteristic() > 2)
     176#else
     177    if (getCharacteristic() > 0)
     178#endif
    173179    {
    174180#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
     
    215221#endif
    216222    }
     223#ifdef HAVE_NTL   
    217224    else
    218225    {
     
    226233                                                           x, beta);
    227234    }
     235#endif   
    228236    setCharacteristic (getCharacteristic(), k, cGFName);
    229237    for (CFFListIterator i= factorsA; i.hasItem(); i++)
     
    237245  else if (alpha.level() != 1)
    238246  {
     247#ifdef HAVE_NTL 
    239248    if (getCharacteristic() > 2)
     249#else
     250    if (getCharacteristic() > 0)
     251#endif
    240252    {
    241253#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
     
    282294#endif
    283295    }
     296#ifdef HAVE_NTL
    284297    else
    285298    {
     
    293306                                                           x, alpha);
    294307    }
     308#endif   
    295309  }
    296310  else
    297311  {
    298312#ifdef HAVE_FLINT
     313#ifdef HAVE_NTL
    299314    if (degree (A) < 300)
     315#endif   
    300316    {
    301317      nmod_poly_t FLINTA;
     
    310326      nmod_poly_clear (FLINTA);
    311327    }
     328#ifdef HAVE_NTL
    312329    else
    313330#endif
     331#endif /* HAVE_FLINT */
     332#ifdef HAVE_NTL
    314333    if (getCharacteristic() > 2)
    315334    {
     
    334353                                                          x);
    335354    }
     355#endif
    336356  }
    337357  CFList uniFactors;
     
    780800Variable chooseExtension (const Variable & alpha, const Variable& beta, int k)
    781801{
     802  #if 0//#ifdef HAVE_NTL
    782803  if (fac_NTL_char != getCharacteristic())
    783804  {
     
    786807  }
    787808  zz_pX NTLIrredpoly;
     809  #elif defined(HAVE_FLINT)
     810  nmod_poly_t Irredpoly;
     811  nmod_poly_init(Irredpoly,getCharacteristic());
     812  #endif
    788813  int i=1, m= 2;
    789814  // extension of F_p needed
     
    808833    i= degree (getMipo (alpha))/m + 1;
    809834  }
     835  #if 0 //#ifdef HAVE_NTL
    810836  BuildIrred (NTLIrredpoly, i*m);
    811837  CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1));
     838  #elif defined(HAVE_FLINT)
     839  nmod_poly_randtest_monic_irreducible(Irredpoly,FLINTrandom,i*m+1);
     840  CanonicalForm newMipo= convertnmod_poly_t2FacCF(Irredpoly,Variable (1));
     841  #endif
    812842  return rootOf (newMipo);
    813843}
     
    11121142}
    11131143
     1144#ifdef HAVE_NTL // henselLift12
    11141145CFList
    11151146henselLiftAndEarly (CanonicalForm& A, bool& earlySuccess, CFList&
     
    14121443  return bufUniFactors;
    14131444}
    1414 
     1445#endif
     1446
     1447#ifdef HAVE_NTL // henselLiftAndEarly
    14151448CFList
    14161449henselLiftAndEarly (CanonicalForm& A, bool& earlySuccess, CFList&
     
    14241457                             uniFactors, info, eval, dummy, den);
    14251458}
     1459#endif
    14261460
    14271461#ifndef HAVE_FLINT
     
    14621496}
    14631497#endif
    1464 
     1498 
     1499#ifdef HAVE_NTL // mat_zz_pE
    14651500long isReduced (const mat_zz_pE& M)
    14661501{
     
    14791514  return 1;
    14801515}
     1516#endif
    14811517
    14821518#ifndef HAVE_FLINT
     
    15321568#endif
    15331569
     1570#ifdef HAVE_NTL // mat_zz_pE
    15341571int * extractZeroOneVecs (const mat_zz_pE& M)
    15351572{
     
    15551592  return result;
    15561593}
    1557 
     1594#endif
     1595
     1596#ifdef HAVE_NTL // mat_zz_pE
    15581597void
    15591598reconstructionTry (CFList& reconstructedFactors, CanonicalForm& F, const CFList&
     
    16371676    F= bufF (y+eval,y);
    16381677}
     1678#endif
    16391679
    16401680#ifndef HAVE_FLINT
     
    18061846#endif
    18071847
     1848#ifdef HAVE_NTL //mat_zz_pE
    18081849CFList
    18091850reconstruction (CanonicalForm& G, CFList& factors, int* zeroOneVecs, int
     
    18541895  return result;
    18551896}
    1856 
     1897#endif
     1898
     1899#ifdef HAVE_NTL // mat_zz_pE
    18571900CFList
    18581901monicReconstruction (CanonicalForm& G, CFList& factors, int* zeroOneVecs,
     
    19051948  return result;
    19061949}
     1950#endif
    19071951
    19081952#ifndef HAVE_FLINT
     
    24312475
    24322476#ifndef HAVE_FLINT
     2477#ifdef HAVE_NTL // logarithmicDerivative
    24332478//over Fp
    24342479int
     
    25542599}
    25552600#endif
    2556 
    2557 #ifdef HAVE_FLINT
     2601#endif
     2602
     2603#ifdef HAVE_FLINT
     2604#ifdef HAVE_NTL // henselLift12
    25582605int
    25592606liftAndComputeLattice (const CanonicalForm& F, int* bounds, int sizeBounds, int
     
    26912738}
    26922739#endif
     2740#endif
    26932741
    26942742#ifndef HAVE_FLINT
     2743#ifdef HAVE_NTL //logarithmicDerivative
    26952744//over field extension
    26962745int
     
    28892938}
    28902939#endif
    2891 
    2892 #ifdef HAVE_FLINT
     2940#endif
     2941
     2942#ifdef HAVE_FLINT
     2943#ifdef HAVE_NTL // henselLift12
    28932944//over field extension
    28942945int
     
    30973148}
    30983149#endif
     3150#endif
    30993151
    31003152// over Fq
     3153#ifdef HAVE_NTL
    31013154int
    31023155liftAndComputeLattice (const CanonicalForm& F, int* bounds, int sizeBounds,
     
    32303283  return l;
    32313284}
    3232 
     3285#endif
     3286
     3287#ifdef HAVE_NTL // henselLift12
    32333288#ifdef HAVE_FLINT
    32343289int
     
    34123467  return l;
    34133468}
    3414 
     3469#endif
     3470
     3471#ifdef HAVE_NTL // logarithmicDerivative
    34153472CFList
    34163473increasePrecision (CanonicalForm& F, CFList& factors, int factorsFound,
     
    36193676  return CFList();
    36203677}
    3621 
     3678#endif
     3679
     3680#ifdef HAVE_NTL // mat_zz_pE
    36223681CFList
    36233682increasePrecision (CanonicalForm& F, CFList& factors, int factorsFound,
     
    37583817  return CFList();
    37593818}
    3760 
     3819#endif
     3820
     3821#ifdef HAVE_NTL // logarithmicDerivative
    37613822//over field extension
    37623823CFList
     
    40654126  return CFList();
    40664127}
    4067 
     4128#endif
     4129
     4130#ifdef HAVE_NTL // mat_zz_pE
    40684131CFList
    40694132increasePrecision2 (const CanonicalForm& F, CFList& factors,
     
    41964259  return CFList();
    41974260}
    4198 
     4261#endif
     4262
     4263#ifdef HAVE_NTL // logarithmicDerivative
    41994264CFList
    42004265increasePrecisionFq2Fp (CanonicalForm& F, CFList& factors, int factorsFound,
     
    44044469  return CFList();
    44054470}
    4406 
     4471#endif
     4472
     4473#ifdef HAVE_NTL // logarithmicDerivative
    44074474#ifdef HAVE_FLINT
    44084475CFList
     
    45724639  return result;
    45734640}
    4574 
     4641#endif
     4642
     4643#ifdef HAVE_NTL // mat_zz_pE
    45754644CFList
    45764645increasePrecision (CanonicalForm& F, CFList& factors, int oldL, int
     
    46774746  return result;
    46784747}
     4748#endif
    46794749
    46804750//over field extension
     4751#ifdef HAVE_NTL // logarithmicDerivative
    46814752#ifdef HAVE_FLINT
    46824753CFList
     
    49345005  return result;
    49355006}
    4936 
     5007#endif
     5008
     5009#ifdef HAVE_NTL // logarithmicDerivative
    49375010#ifdef HAVE_FLINT
    49385011CFList
     
    50925165  return result;
    50935166}
    5094 
     5167#endif
     5168
     5169#ifdef HAVE_NTL // logarithmicDerivative
    50955170#ifdef HAVE_FLINT
    50965171CFList
     
    53255400  return CFList();
    53265401}
     5402#endif
    53275403
    53285404//Fq
     5405#ifdef HAVE_NTL
    53295406CFList
    53305407furtherLiftingAndIncreasePrecision (CanonicalForm& F, CFList&
     
    54705547  return CFList();
    54715548}
     5549#endif
    54725550
    54735551//over field extension
     5552#ifdef HAVE_NTL // logarithmicDerivative
    54745553#ifdef HAVE_FLINT
    54755554CFList
     
    57855864  return CFList();
    57865865}
    5787 
     5866#endif
     5867
     5868#ifdef HAVE_NTL // logarithmicDerivative
    57885869#ifdef HAVE_FLINT
    57895870CFList
     
    60186099  return CFList();
    60196100}
     6101#endif
    60206102
    60216103#ifndef HAVE_FLINT
     
    60526134
    60536135#ifdef HAVE_FLINT
     6136#ifdef HAVE_NTL // henselLift12
    60546137void
    60556138refineAndRestartLift (const CanonicalForm& F, const nmod_mat_t FLINTN, int
     
    60826165}
    60836166#endif
    6084 
     6167#endif
     6168
     6169#ifdef HAVE_NTL // mat_zz_pE
    60856170void
    60866171refineAndRestartLift (const CanonicalForm& F, const mat_zz_pE& NTLN, int
     
    61126197  henselLift12 (F, factors, l, Pi, diophant, M);
    61136198}
     6199#endif
    61146200
    61156201#ifdef HAVE_FLINT
     
    63276413}
    63286414
     6415#ifdef HAVE_NTL // mat_zz_pE
    63296416CFList
    63306417earlyReconstructionAndLifting (const CanonicalForm& F, const mat_zz_pE& N,
     
    64836570  return result;
    64846571}
     6572#endif
    64856573
    64866574//over field extension
     
    66686756}
    66696757
     6758#ifdef HAVE_NTL // henselLift12
    66706759CFList
    66716760sieveSmallFactors (const CanonicalForm& G, CFList& uniFactors, DegreePattern&
     
    67126801  }
    67136802}
    6714 
     6803#endif
     6804
     6805#ifdef HAVE_NTL // henselLift12
    67156806CFList
    67166807extSieveSmallFactors (const CanonicalForm& G, CFList& uniFactors, DegreePattern&
     
    67606851  }
    67616852}
    6762 
     6853#endif
     6854
     6855#ifdef HAVE_NTL // matrix Fq
    67636856CFList
    67646857henselLiftAndLatticeRecombi (const CanonicalForm& G, const CFList& uniFactors,
     
    75567649  }
    75577650}
    7558 
     7651#endif
     7652
     7653#ifdef HAVE_NTL //primitiveElement
    75597654ExtensionInfo
    75607655init4ext (const ExtensionInfo& info, const CanonicalForm& evaluation,
     
    76097704  return info2;
    76107705}
    7611 
     7706#endif
     7707
     7708#ifdef HAVE_NTL // init4ext
    76127709CFList
    76137710extHenselLiftAndLatticeRecombi(const CanonicalForm& G, const CFList& uniFactors,
     
    81938290  }
    81948291}
    8195 
     8292#endif
     8293
     8294#ifdef HAVE_NTL // henselLiftAndLatticeRecombi
    81968295CFList
    81978296extBiFactorize (const CanonicalForm& F, const ExtensionInfo& info);
     
    88218920  return factors;
    88228921}
    8823 
     8922#endif
     8923
     8924#ifdef HAVE_NTL // primitiveElement
    88248925CFList
    88258926extBiFactorize (const CanonicalForm& F, const ExtensionInfo& info)
     
    89959096  }
    89969097}
    8997 
    8998 #endif
    8999 /* HAVE_NTL */
    9000 
    9001 
     9098#endif
     9099#endif
  • factory/facFqBivar.h

    rb666c7 r03c742  
    2828#include "cfNewtonPolygon.h"
    2929#include "fac_util.h"
     30#include "cf_algorithm.h"
    3031
    3132TIMING_DEFINE_PRINT(fac_fq_bi_sqrf)
     
    3435static const double log2exp= 1.442695041;
    3536
    36 #ifdef HAVE_NTL
     37#if defined(HAVE_NTL) || defined(HAVE_FLINT)
    3738/// Factorization of a squarefree bivariate polynomials over an arbitrary finite
    3839/// field, information on the current field we work over is in @a info. @a info
  • factory/facHensel.cc

    rb666c7 r03c742  
    3636#include <NTL/lzz_pEX.h>
    3737#include "NTLconvert.h"
     38#endif
    3839
    3940#ifdef HAVE_FLINT
     
    4647TIMING_DEFINE_PRINT (hensel23)
    4748TIMING_DEFINE_PRINT (hensel)
     49
     50#if defined (HAVE_NTL) || defined(HAVE_FLINT)
    4851
    4952#if (!(HAVE_FLINT && __FLINT_RELEASE >= 20400))
     
    466469}
    467470
     471#ifdef HAVE_NTL
    468472CFList
    469473diophantine (const CanonicalForm& F, const CFList& factors);
    470 
     474#endif
     475
     476#ifdef HAVE_NTL // diophantine
    471477CFList
    472478diophantineHensel (const CanonicalForm & F, const CFList& factors,
     
    558564  return result;
    559565}
     566#endif
    560567
    561568/// solve \f$ 1=\sum_{i=1}^n{\delta_{i} \prod_{j\neq i}{f_j}} \f$ mod \f$p^k\f$
     
    773780/// over \f$ Q(\alpha) \f$ by first computing mod \f$p\f$ and if no zero divisor
    774781/// occurred compute it mod \f$p^k\f$
     782#ifdef HAVE_NTL // XGCD, zzp_eX
    775783CFList
    776784diophantineQa (const CanonicalForm& F, const CanonicalForm& G,
     
    883891  return result;
    884892}
    885 
     893#endif
     894
     895#ifdef HAVE_NTL // diophantineQa
    886896CFList
    887897diophantine (const CanonicalForm& F, const CanonicalForm& G,
     
    934944  return result;
    935945}
    936 
     946#endif
     947
     948#ifdef HAVE_NTL // diophantineQa
    937949CFList
    938950diophantine (const CanonicalForm& F, const CFList& factors)
     
    941953  return diophantine (F, 1, factors, b);
    942954}
     955#endif
    943956
    944957void
     
    11451158}
    11461159
     1160#ifdef HAVE_NTL // diopantineQa
    11471161void
    11481162henselLift12 (const CanonicalForm& F, CFList& factors, int l, CFArray& Pi,
     
    12021216  factors.removeFirst();
    12031217}
    1204 
     1218#endif
     1219
     1220#ifdef HAVE_NTL //henselLift12
    12051221void
    12061222henselLift12 (const CanonicalForm& F, CFList& factors, int l, CFArray& Pi,
     
    12101226  henselLift12 (F, factors, l, Pi, diophant, M, dummy, sort);
    12111227}
     1228#endif
    12121229
    12131230void
     
    12361253}
    12371254
     1255#ifdef HAVE_NTL // diophantine
    12381256CFList
    12391257biDiophantine (const CanonicalForm& F, const CFList& factors, int d)
     
    13351353  }
    13361354}
     1355#endif
    13371356
    13381357CFList
     
    16501669}
    16511670
     1671#ifdef HAVE_NTL // biDiophantine
    16521672CFList
    16531673henselLift23 (const CFList& eval, const CFList& factors, int* l, CFList&
     
    16901710  return result;
    16911711}
     1712#endif
    16921713
    16931714void
     
    17571778}
    17581779
     1780#ifdef HAVE_NTL // henselLift23
    17591781CFList
    17601782henselLift (const CFList& eval, const CFList& factors, int* l, int lLength,
     
    17911813  return result;
    17921814}
     1815#endif
    17931816
    17941817// nonmonic
     
    20152038}
    20162039
     2040#ifdef HAVE_NTL // diophantine
    20172041void
    20182042nonMonicHenselLift12 (const CanonicalForm& F, CFList& factors, int l,
     
    20912115  return;
    20922116}
    2093 
    2094 
     2117#endif
     2118
     2119#ifdef HAVE_NTL
    20952120/// solve \f$ E=\sum_{i= 1}^r{\sigma_{i}\prod_{j=1, j\neq i}^{r}{f_{j}}} \f$
    20962121/// mod M, @a products contains \f$ \prod_{j=1, j\neq i}^{r}{f_{j}} \f$
     
    21722197  return result;
    21732198}
    2174 
     2199#endif
     2200
     2201#ifdef HAVE_NTL // diophantine
    21752202void
    21762203nonMonicHenselStep (const CanonicalForm& F, const CFList& factors,
     
    24112438  return;
    24122439}
     2440#endif
    24132441
    24142442// wrt. Variable (1)
     
    24262454}
    24272455
     2456#ifdef HAVE_NTL // nonMonicHenselStep
    24282457CFList
    24292458nonMonicHenselLift232(const CFList& eval, const CFList& factors, int* l, CFList&
     
    24872516  return result;
    24882517}
    2489 
    2490 
     2518#endif
     2519
     2520#ifdef HAVE_NTL // nonMonicHenselStep
    24912521CFList
    24922522nonMonicHenselLift2 (const CFList& F, const CFList& factors, const CFList& MOD,
     
    25512581  return result;
    25522582}
    2553 
     2583#endif
     2584
     2585#ifdef HAVE_NTL // nonMonicHenselStep
    25542586CFList
    25552587nonMonicHenselLift2 (const CFList& eval, const CFList& factors, int* l, int
     
    26032635  return result;
    26042636}
    2605 
     2637#endif
     2638
     2639#ifdef HAVE_NTL // diophantine
    26062640CFList
    26072641nonMonicHenselLift23 (const CanonicalForm& F, const CFList& factors, const
     
    27052739  return result;
    27062740}
    2707 
     2741#endif
     2742
     2743#ifdef HAVE_NTL // nonMonicHenselStep
    27082744CFList
    27092745nonMonicHenselLift (const CFList& F, const CFList& factors, const CFList& LCs,
     
    27882824  return result;
    27892825}
    2790 
     2826#endif
     2827
     2828#ifdef HAVE_NTL // nonMonicHenselLift23
    27912829CFList
    27922830nonMonicHenselLift (const CFList& eval, const CFList& factors,
     
    28392877  return result;
    28402878}
    2841 
    2842 #endif
    2843 /* HAVE_NTL */
    2844 
     2879#endif
     2880#endif
  • factory/facHensel.h

    rb666c7 r03c742  
    2727#include "fac_util.h"
    2828
    29 #ifdef HAVE_NTL
    3029/// sort a list of polynomials by their degree in @a x.
    3130///
     
    240239                                           ///< correspondence
    241240                   );
    242 #endif /* HAVE_NTL */
    243241#endif
    244242/* FAC_HENSEL_H */
  • factory/facMul.cc

    rb666c7 r03c742  
    4141
    4242// univariate polys
     43#if defined(HAVE_NTL) || defined(HAVE_FLINT)
    4344
    4445#ifdef HAVE_FLINT
     
    37473748// end division
    37483749
     3750#else
     3751CanonicalForm
     3752mulNTL (const CanonicalForm& F, const CanonicalForm& G, const modpk& b)
     3753{ return F*G; }
     3754#endif
Note: See TracChangeset for help on using the changeset viewer.