40#if defined(HAVE_NTL) || defined(HAVE_FLINT)
52 for (
int i = 0;
i <= n;
i++)
70 for (
int i= 1;
i <= n;
i++)
101 for (
int i= 1;
i <= n;
i++)
128 for (
int i= 1;
i <= n;
i++)
163 while (min_max_deg == 0 &&
i <
m)
171 for (
int j=
i + 1;
j <=
m;
j++)
182 if (
l !=
k &&
l != xlevel &&
k != 1)
199 if (
i !=
k &&
i != xlevel &&
k != 1)
219 for (
int i= 1;
i <= n;
i++)
267 nmod_poly_t FLINTF, FLINTG;
270 mp_limb_t FLINTresult= nmod_poly_resultant (FLINTF, FLINTG);
276#elif defined(HAVE_NTL)
298 zz_pE::init (NTLMipo);
324 if (
degree (FEval, 1) < degF ||
degree (GEval, 1) < degG)
342 interPoly= oldInterPoly+((u - oldInterPoly (
alpha,
x))/newtonPoly (
alpha,
x))
394 bool extOfExt=
false;
398 if (!algExt && (
p < (1 << 28)))
402 int deg= ceil (29.0*((
double)
log (2)/
log (
p)))+1;
406 gen= AlgExtGen.
clone();
407 for (
int i= 0;
i <
p;
i++)
417 int deg= ceil (29.0*((
double)
log (2)/
log (
p)));
421 mpz_init (field_size);
422 mpz_ui_pow_ui (field_size,
p,
426 if (mpz_fits_sint_p (field_size))
432 bool primFail=
false;
435 ASSERT (!primFail,
"failure in integer factorizer");
440 F=
mapUp (F,
alpha,
v, primElemAlpha, imPrimElemAlpha, source, dest);
441 G=
mapUp (
G,
alpha,
v, primElemAlpha, imPrimElemAlpha, source, dest);
446 mpz_ui_pow_ui (field_size,
p, deg);
450 mpz_ui_pow_ui (field_size,
p, deg);
457 bool primFail=
false;
460 ASSERT (!primFail,
"failure in integer factorizer");
465 F=
mapUp (F,
alpha,
v, primElemAlpha, imPrimElemAlpha, source, dest);
466 G=
mapUp (
G,
alpha,
v, primElemAlpha, imPrimElemAlpha, source, dest);
469 mpz_clear (field_size);
472 gen= AlgExtGen.
clone();
473 for (
int i= 0;
i <
p;
i++)
485 H=
newtonInterp ((*gen).item(), recResult, newtonPoly, modResult,
y);
499 if (extOfExt && !
isInExtension (
H, imPrimElemAlpha, 1, primElemAlpha,
502 H=
mapDown (
H, primElemAlpha, imPrimElemAlpha,
alpha, dest, source);
512 newtonPoly *= (
y - (*gen).item());
513 if ((*gen).hasItems())
532 for (
i =
f;
i.hasTerms();
i++ ) {
533 c =
mod(
i.coeff(), q );
547 if (
f.isUnivariate() ||
f.inCoeffDomain())
617 for (
int i= degBx + degAx;
i > 1;
i--)
637 while (
i >= 0 &&
mod(
l,
p ) == 0)
673 if (newQ >
bound || (prob && equalCount == 2))
This file defines functions for conversion to FLINT (www.flintlib.org) and back.
Rational abs(const Rational &a)
zz_pEX convertFacCF2NTLzz_pEX(const CanonicalForm &f, const zz_pX &mipo)
CanonicalForm convertNTLzzpE2CF(const zz_pE &coefficient, const Variable &x)
zz_pX convertFacCF2NTLzzpX(const CanonicalForm &f)
Conversion to and from NTL.
int myCompress(const CanonicalForm &F, const CanonicalForm &G, CFMap &M, CFMap &N, bool topLevel)
compressing two polynomials F and G, M is used for compressing, N to reverse the compression
const CanonicalForm CFMap CFMap & N
static CanonicalForm oneNorm(const CanonicalForm &F)
const CanonicalForm CFMap CFMap const Variable & x
static CanonicalForm symmetricRemainder(const CanonicalForm &f, const CanonicalForm &q)
CanonicalForm resultantFp(const CanonicalForm &A, const CanonicalForm &B, const Variable &x, bool prob)
modular resultant algorihtm over Fp
static CanonicalForm uniResultant(const CanonicalForm &F, const CanonicalForm &G)
static void evalPoint(const CanonicalForm &F, const CanonicalForm &G, CanonicalForm &FEval, CanonicalForm &GEval, CFGenerator &evalPoint)
CanonicalForm resultantZ(const CanonicalForm &A, const CanonicalForm &B, const Variable &x, bool prob)
modular resultant algorihtm over Z
const CanonicalForm CFMap & M
static CanonicalForm newtonInterp(const CanonicalForm &alpha, const CanonicalForm &u, const CanonicalForm &newtonPoly, const CanonicalForm &oldInterPoly, const Variable &x)
static CanonicalForm balanceUni(const CanonicalForm &f, const CanonicalForm &q)
modular resultant algorithm as described by G.
CanonicalForm bCommonDen(const CanonicalForm &f)
CanonicalForm bCommonDen ( const CanonicalForm & f )
declarations of higher level algorithms.
void FACTORY_PUBLIC chineseRemainder(const CanonicalForm &x1, const CanonicalForm &q1, const CanonicalForm &x2, const CanonicalForm &q2, CanonicalForm &xnew, CanonicalForm &qnew)
void chineseRemainder ( const CanonicalForm & x1, const CanonicalForm & q1, const CanonicalForm & x2,...
CanonicalForm FACTORY_PUBLIC resultant(const CanonicalForm &f, const CanonicalForm &g, const Variable &x)
CanonicalForm resultant ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x )
#define STICKYASSERT(expression, message)
#define ASSERT(expression, message)
static const int SW_RATIONAL
set to 1 for computations over Q
generate integers, elements of finite fields
CanonicalForm randomIrredpoly(int i, const Variable &x)
computes a random monic irreducible univariate polynomial in x over Fp of degree i via NTL/FLINT
generate random irreducible univariate polynomials
Iterators for CanonicalForm's.
static CanonicalForm bound(const CFMatrix &M)
CanonicalForm mapPrimElem(const CanonicalForm &primElem, const Variable &alpha, const Variable &beta)
compute the image of a primitive element of in . We assume .
CanonicalForm primitiveElement(const Variable &alpha, Variable &beta, bool &fail)
determine a primitive element of , is a primitive element of a field which is isomorphic to
static CanonicalForm mapDown(const CanonicalForm &F, const Variable &alpha, const CanonicalForm &G, CFList &source, CFList &dest)
the CanonicalForm G is the output of map_up, returns F considered as an element over ,...
static CanonicalForm mapUp(const Variable &alpha, const Variable &beta)
and is a primitive element, returns the image of
This file implements functions to map between extensions of finite fields.
int cf_getBigPrime(int i)
generate random integers, random elements of finite fields
generate all elements in F_p(alpha) starting from 0
CFGenerator * clone() const
virtual class for generators
class to iterate through CanonicalForm's
generate all elements in F_p starting from 0
CFGenerator * clone() const
factory's class for variables
const CanonicalForm int const CFList const Variable & y
const Variable & v
< [in] a sqrfree bivariate poly
bool isInExtension(const CanonicalForm &F, const CanonicalForm &gamma, const int k, const CanonicalForm &delta, CFList &source, CFList &dest)
tests if F is not contained in a subfield defined by gamma (Fq case) or k (GF case)
This file provides utility functions for bivariate factorization.
convertFacCF2nmod_poly_t(FLINTmipo, M)
nmod_poly_clear(FLINTmipo)
some useful template functions.
template CanonicalForm tmax(const CanonicalForm &, const CanonicalForm &)
gmp_float log(const gmp_float &a)
int status int void size_t count
int status int void * buf
#define TIMING_DEFINE_PRINT(t)
#define TIMING_END_AND_PRINT(t, msg)
void prune(Variable &alpha)
CanonicalForm getMipo(const Variable &alpha, const Variable &x)
Variable rootOf(const CanonicalForm &mipo, char name)
returns a symbolic root of polynomial with name name Use it to define algebraic variables