Skip to content

Commit

Permalink
chg: use FLINT in bivariate factorization
Browse files Browse the repository at this point in the history
  • Loading branch information
mmklee committed May 7, 2012
1 parent edd8189 commit 18a6606
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion factory/facFqBivar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
#ifdef HAVE_NTL
#include "NTLconvert.h"

#ifdef HAVE_FLINT
#include "FLINTconvert.h"
#endif

TIMING_DEFINE_PRINT(fac_uni_factorizer)
TIMING_DEFINE_PRINT(fac_hensel_lift12)

Expand Down Expand Up @@ -144,7 +148,9 @@ CFList
uniFactorizer (const CanonicalForm& A, const Variable& alpha, const bool& GF)
{
Variable x= A.mvar();
ASSERT (A.isUnivariate() || A.inCoeffDomain(),
if (A.inCoeffDomain())
return CFList();
ASSERT (A.isUnivariate(),
"univariate polynomial expected or constant expected");
CFFList factorsA;
ZZ p= to_ZZ (getCharacteristic());
Expand Down Expand Up @@ -214,6 +220,18 @@ uniFactorizer (const CanonicalForm& A, const Variable& alpha, const bool& GF)
}
else
{
#ifdef HAVE_FLINT
nmod_poly_t FLINTA;
convertFacCF2nmod_poly_t (FLINTA, A);
nmod_poly_factor_t result;
nmod_poly_factor_init (result);
mp_limb_t leadingCoeff= nmod_poly_factor (result, FLINTA);
factorsA= convertFLINTnmod_poly_factor2FacCFFList (result, leadingCoeff, x);
if (factorsA.getFirst().factor().inCoeffDomain())
factorsA.removeFirst();
nmod_poly_factor_clear (result);
nmod_poly_clear (FLINTA);
#else
if (getCharacteristic() > 2)
{
ZZ_pX NTLA= convertFacCF2NTLZZpX (A);
Expand All @@ -231,6 +249,7 @@ uniFactorizer (const CanonicalForm& A, const Variable& alpha, const bool& GF)
factorsA= convertNTLvec_pair_GF2X_long2FacCFFList (NTLFactorsA, multi,
x);
}
#endif
}
CFList uniFactors;
for (CFFListIterator i= factorsA; i.hasItem(); i++)
Expand Down

0 comments on commit 18a6606

Please sign in to comment.