Changeset 7e8c9e in git


Ignore:
Timestamp:
Dec 20, 2011, 1:37:08 AM (11 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', 'f6c3dc58b0df4bd712574325fe76d0626174ad97')
Children:
ae3775b687b92e288f8dd89a3aee50987ac3ca37
Parents:
97a0599a2c91cf3fd4b1b2efcdf9d0a40caf5746
git-author:
Martin Lee <martinlee84@web.de>2011-12-20 00:37:08+00:00
git-committer:
Martin Lee <martinlee84@web.de>2012-04-04 14:42:24+02:00
Message:
chg: use Flint GCD instead of NTL gcd
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_gcd.cc

    r97a059 r7e8c9e  
    2929static CanonicalForm gcd_univar_ntl0( const CanonicalForm &, const CanonicalForm & );
    3030static CanonicalForm gcd_univar_ntlp( const CanonicalForm &, const CanonicalForm & );
     31#endif
     32
     33#ifdef HAVE_FLINT
     34#include "FLINTconvert.h"
     35static CanonicalForm gcd_univar_flint0 (const CanonicalForm &, const CanonicalForm &);
     36static CanonicalForm gcd_univar_flintp (const CanonicalForm &, const CanonicalForm &);
    3137#endif
    3238
     
    545551    {
    546552        bpure = isPurePoly(pi) && isPurePoly(pi1);
    547 #ifdef HAVE_NTL
     553#ifdef HAVE_FLINT
     554        if (bpure && (CFFactory::gettype() != GaloisFieldDomain))
     555          return gcd_univar_flintp(pi,pi1)*C;
     556#else ifdef HAVE_NTL
    548557        if ( isOn(SW_USE_NTL_GCD_P) && bpure && (CFFactory::gettype() != GaloisFieldDomain))
    549558            return gcd_univar_ntlp(pi, pi1 ) * C;
     
    618627    if ( pi.isUnivariate() && pi1.isUnivariate() )
    619628    {
    620 #ifdef HAVE_NTL
     629#ifdef HAVE_FLINT
     630        if (isPurePoly(pi) && isPurePoly(pi1) )
     631            return gcd_univar_flint0(pi, pi1 ) * C;
     632#else ifdef HAVE_NTL
    621633        if ( isOn(SW_USE_NTL_GCD_0) && isPurePoly(pi) && isPurePoly(pi1) )
    622634            return gcd_univar_ntl0(pi, pi1 ) * C;
     
    10441056#endif
    10451057
     1058#ifdef HAVE_FLINT
     1059static CanonicalForm
     1060gcd_univar_flintp (const CanonicalForm& F, const CanonicalForm& G)
     1061{
     1062  nmod_poly_t F1, G1;
     1063  convertFacCF2nmod_poly_t (F1, F);
     1064  convertFacCF2nmod_poly_t (G1, G);
     1065  nmod_poly_gcd (F1, F1, G1);
     1066  CanonicalForm result= convertnmod_poly_t2FacCF (F1, F.mvar());
     1067  nmod_poly_clear (F1);
     1068  nmod_poly_clear (G1);
     1069  return result;
     1070}
     1071
     1072static CanonicalForm
     1073gcd_univar_flint0( const CanonicalForm & F, const CanonicalForm & G )
     1074{
     1075  fmpz_poly_t F1, G1;
     1076  convertFacCF2Fmpz_poly_t(F1, F);
     1077  convertFacCF2Fmpz_poly_t(G1, G);
     1078  fmpz_poly_gcd (F1, F1, G1);
     1079  CanonicalForm result= convertFmpz_poly_t2FacCF (F1, F.mvar());
     1080  fmpz_poly_clear (F1);
     1081  fmpz_poly_clear (G1);
     1082  return result;
     1083}
     1084#endif
     1085
     1086
    10461087/*
    10471088*  compute positions p1 and pe of optimal variables:
Note: See TracChangeset for help on using the changeset viewer.