41 int M = 0,
i,
k =
f.level();
63 if (!
f.inBaseDomain() )
100 int M = 0,
i,
k =
f.level();
102 for (
i = 1;
i <=
k;
i++ )
130 result.append (
i.getItem().factor());
187#if defined(HAVE_NTL) || defined(HAVE_FLINT)
193 bool extension= (
v.
level() != 1);
204 if (
A.isUnivariate())
212 if (
result.getFirst().inCoeffDomain())
227 A=
A/(contentAx*contentAy);
228 CFFList contentAxFactors, contentAyFactors;
235 if (contentAxFactors.
getFirst().factor().inCoeffDomain())
241 if (contentAyFactors.
getFirst().factor().inCoeffDomain())
249 contentAxFactors=
factorize (contentAx,
true);
250 if (contentAxFactors.
getFirst().factor().inCoeffDomain())
255 contentAyFactors=
factorize (contentAy,
true);
256 if (contentAyFactors.
getFirst().factor().inCoeffDomain())
269 conv (contentAyFactors),
false,
false,
N);
277 if (
A.inCoeffDomain())
284 else if (
A.isUnivariate())
302 conv (contentAyFactors),
false,
false,
N);
315 CFList uniFactors, list, bufUniFactors;
320 CFList bufUniFactors2, list2, uniFactors2;
332 int evaluation, evaluation2=0, bufEvaluation= 0, bufEvaluation2= 0;
333 for (
int i= 0;
i < factorNums;
i++)
344 "time for eval point over Q in y: ");
353 "time for univariate factorization over Q: ");
354 DEBOUTLN (cerr,
"prod (bufUniFactors)== bufAeval " <<
355 (
prod (bufUniFactors) == bufAeval));
360 if (bufUniFactors.
length() == 1)
365 conv (contentAyFactors),
swap, swap2,
N);
378 "time for univariate factorization in y over Q: ");
379 DEBOUTLN (cerr,
"prod (bufuniFactors2)== bufAeval2 " <<
380 (
prod (bufUniFactors2) == bufAeval2));
384 if (bufUniFactors2.
length() == 1)
389 conv (contentAyFactors),
swap, swap2,
N);
402 if (subCheck > 1 && (subCheck1%subCheck == 0))
405 subst (bufA, bufA, subCheck,
x);
409 conv (contentAyFactors),
swap, swap2,
N);
420 if (subCheck > 1 && (subCheck2%subCheck == 0))
423 subst (bufA, bufA, subCheck,
y);
427 conv (contentAyFactors),
swap, swap2,
N);
443 uniFactors= bufUniFactors;
446 evaluation2= bufEvaluation2;
447 uniFactors2= bufUniFactors2;
456 uniFactors2= bufUniFactors2;
458 evaluation2= bufEvaluation2;
462 uniFactors= bufUniFactors;
467 if (bufEvaluation > 0)
470 bufEvaluation= -bufEvaluation + 1;
471 if (bufEvaluation > 0)
474 bufEvaluation2= -bufEvaluation2 + 1;
482 uniFactors= uniFactors2;
493 conv (contentAyFactors),
swap, swap2,
N);
505 bool mipoHasDen=
false;
515 printf (
"out of primes\n");
520 if (bb.
getk() >
b.getk() )
b=bb;
522 if (bb.
getk() >
b.getk() )
b=bb;
531 fmpz_t FLINTf,FLINTD;
534 fmpz_poly_t FLINTmipo;
535 fmpz_poly_t FLINTLcf;
540 fmpz_poly_resultant(FLINTf,FLINTmipo,FLINTLcf);
541 fmpz_poly_discriminant(FLINTD,FLINTmipo);
542 fmpz_mul(FLINTf,FLINTD,FLINTf);
548 fmpz_poly_clear(FLINTLcf);
549 fmpz_poly_clear(FLINTmipo);
550 #elif defined(HAVE_NTL)
554 ZZ NTLD= discriminant (NTLmipo);
575 #elif defined(HAVE_NTL)
587 if (bb.
getk() >
b.getk() )
b=bb;
589 if (bb.
getk() >
b.getk() )
b=bb;
595 bool earlySuccess=
false;
599 (
A, earlySuccess, earlyFactors, degs, liftBound,
602 "time for bivariate hensel lifting over Q: ");
603 DEBOUTLN (cerr,
"lifted factors= " << uniFactors);
626 "time for bivariate factor recombination over Q: ");
631 factors=
Union (earlyFactors, factors);
632 else if (!earlySuccess && degs.
getLength() == 1)
633 factors= earlyFactors;
636 conv (contentAyFactors),
swap, swap2,
N);
CanonicalForm convertFmpz2CF(const fmpz_t coefficient)
conversion of a FLINT integer to CanonicalForm
void convertFacCF2Fmpz_poly_t(fmpz_poly_t result, const CanonicalForm &f)
conversion of a factory univariate polynomial over Z to a fmpz_poly_t
Rational abs(const Rational &a)
CanonicalForm convertZZ2CF(const ZZ &a)
NAME: convertZZ2CF.
ZZX convertFacCF2NTLZZX(const CanonicalForm &f)
const CanonicalForm CFMap CFMap & N
bool irreducibilityTest(const CanonicalForm &F)
computes the Newton polygon of F and checks if it satisfies the irreducibility criterion from S....
CanonicalForm decompress(const CanonicalForm &F, const mpz_t *inverseM, const mpz_t *A)
decompress a bivariate poly
CanonicalForm bCommonDen(const CanonicalForm &f)
CanonicalForm bCommonDen ( const CanonicalForm & f )
CanonicalForm maxNorm(const CanonicalForm &f)
CanonicalForm maxNorm ( const CanonicalForm & f )
declarations of higher level algorithms.
CFFList FACTORY_PUBLIC factorize(const CanonicalForm &f, bool issqrfree=false)
factorization over or
CanonicalForm FACTORY_PUBLIC resultant(const CanonicalForm &f, const CanonicalForm &g, const Variable &x)
CanonicalForm resultant ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x )
static const int SW_RATIONAL
set to 1 for computations over Q
CanonicalForm compress(const CanonicalForm &f, CFMap &m)
CanonicalForm compress ( const CanonicalForm & f, CFMap & m )
int cf_getBigPrime(int i)
VAR void(* factoryError)(const char *s)
class to iterate through CanonicalForm's
DegreePattern provides a functionality to create, intersect and refine degree patterns.
void intersect(const DegreePattern °Pat)
intersect two degree patterns
int getLength() const
getter
ExtensionInfo contains information about extension.
factory's class for variables
class to do operations mod p^k for int's p and k
functions to print debug output
#define DEBOUTLN(stream, objects)
const CanonicalForm int const CFList & evaluation
const CanonicalForm int const CFList const Variable & y
CFFList append(const CFFList &Inputlist, const CFFactor &TheFactor)
CanonicalForm subst(const CanonicalForm &f, const CFList &a, const CFList &b, const CanonicalForm &Rstar, bool isFunctionField)
modpk coeffBound(const CanonicalForm &f, int p, const CanonicalForm &mipo)
compute p^k larger than the bound on the coefficients of a factor of f over Q (mipo)
CanonicalForm evalPoint(const CanonicalForm &F, int &i)
bool testPoint(const CanonicalForm &F, CanonicalForm &G, int i)
CFList conv(const CFFList &L)
convert a CFFList to a CFList by dropping the multiplicity
CFList biFactorize(const CanonicalForm &F, const Variable &v)
void findGoodPrime(const CanonicalForm &f, int &start)
find a big prime p from our tables such that no term of f vanishes mod p
bivariate factorization over Q(a)
const Variable & v
< [in] a sqrfree bivariate poly
CFList *& Aeval
<[in] poly
void appendSwapDecompress(CFList &factors1, const CFList &factors2, const CFList &factors3, const bool swap1, const bool swap2, const CFMap &N)
first swap Variables in factors1 if necessary, then append factors2 and factors3 on factors1 and fina...
CanonicalForm reverseSubst(const CanonicalForm &F, const int d, const Variable &x)
reverse a substitution x^d->x
int substituteCheck(const CanonicalForm &F, const Variable &x)
check if a substitution x^n->x is possible
CFList henselLiftAndEarly(CanonicalForm &A, bool &earlySuccess, CFList &earlyFactors, DegreePattern °s, int &liftBound, const CFList &uniFactors, const ExtensionInfo &info, const CanonicalForm &eval, modpk &b, CanonicalForm &den)
hensel Lifting and early factor detection
CFList factorRecombination(CFList &factors, CanonicalForm &F, const CanonicalForm &N, DegreePattern °s, const CanonicalForm &eval, int s, int thres, const modpk &b, const CanonicalForm &den)
naive factor recombination as decribed in "Factoring multivariate polynomials over a finite field" by...
This file provides functions for factorizing a bivariate polynomial over , or GF.
This file defines functions for Hensel lifting.
This file defines functions for fast multiplication and division with remainder.
template List< Variable > Union(const List< Variable > &, const List< Variable > &)
int status int void * buf
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
#define TIMING_DEFINE_PRINT(t)
#define TIMING_END_AND_PRINT(t, msg)
CanonicalForm getMipo(const Variable &alpha, const Variable &x)