350{
352
354 return 0;
355
362
363 if (degAx == 0)
365 else if (degBx == 0)
367
370
373
376
379
381
385
388
394 bool extOfExt= false;
398 if (!algExt && (
p < (1 << 28)))
399 {
400
401
406 gen= AlgExtGen.
clone();
407 for (
int i= 0;
i <
p;
i++)
409 }
410 else if (!algExt)
411 {
414 }
415 else
416 {
419 {
420 mpz_t field_size;
421 mpz_init (field_size);
422 mpz_ui_pow_ui (field_size,
p,
424
425
426 if (mpz_fits_sint_p (field_size))
427 {
432 bool primFail= false;
433 extOfExt= true;
435 ASSERT (!primFail,
"failure in integer factorizer");
436 if (primFail)
437 ;
438 else
440 F=
mapUp (F,
alpha,
v, primElemAlpha, imPrimElemAlpha, source, dest);
441 G=
mapUp (
G,
alpha,
v, primElemAlpha, imPrimElemAlpha, source, dest);
442 }
443 else
444 {
446 mpz_ui_pow_ui (field_size,
p, deg);
448 {
450 mpz_ui_pow_ui (field_size,
p, deg);
451 }
453 {
457 bool primFail= false;
458 extOfExt= true;
460 ASSERT (!primFail,
"failure in integer factorizer");
461 if (primFail)
462 ;
463 else
465 F=
mapUp (F,
alpha,
v, primElemAlpha, imPrimElemAlpha, source, dest);
466 G=
mapUp (
G,
alpha,
v, primElemAlpha, imPrimElemAlpha, source, dest);
467 }
468 }
469 mpz_clear (field_size);
470 }
472 gen= AlgExtGen.
clone();
473 for (
int i= 0;
i <
p;
i++)
475 }
477 int equalCount= 0;
479 do
480 {
482
484
485 H=
newtonInterp ((*gen).item(), recResult, newtonPoly, modResult,
y);
486
488 equalCount++;
489 else
490 equalCount= 0;
491
494 {
496 break;
497 else if (algExt)
498 {
499 if (extOfExt && !
isInExtension (
H, imPrimElemAlpha, 1, primElemAlpha,
500 dest, source))
501 {
502 H=
mapDown (
H, primElemAlpha, imPrimElemAlpha,
alpha, dest, source);
504 break;
505 }
506 else if (!extOfExt)
507 break;
508 }
509 }
510
512 newtonPoly *= (
y - (*gen).item());
513 if ((*gen).hasItems())
514 (*gen).next();
515 else
517 } while (1);
518
519 delete gen;
520
522}
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
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 CanonicalForm newtonInterp(const CanonicalForm &alpha, const CanonicalForm &u, const CanonicalForm &newtonPoly, const CanonicalForm &oldInterPoly, const Variable &x)
#define STICKYASSERT(expression, message)
#define ASSERT(expression, message)
CanonicalForm randomIrredpoly(int i, const Variable &x)
computes a random monic irreducible univariate polynomial in x over Fp of degree i via NTL/FLINT
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
generate all elements in F_p(alpha) starting from 0
virtual class for generators
virtual CFGenerator * clone() const
generate all elements in F_p starting from 0
CFGenerator * clone() const
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)
template CanonicalForm tmax(const CanonicalForm &, const CanonicalForm &)
gmp_float log(const gmp_float &a)
const signed long ceil(const ampf< Precision > &x)
int status int void size_t count
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