modular gcd over F_p[x]/(M) for not necessarily irreducible M. If a zero divisor is encountered fail is set to true.
373{
374
376 {
378 {
380 return;
381 }
383 {
385 if(fail)
386 return;
388 return;
389 }
390
393 if(fail)
394 return;
397 return;
398 }
400 {
402 {
404 if(fail)
405 return;
407 return;
408 }
409
412 if(fail)
413 return;
416 return;
417 }
418
420 {
422 if(fail)
423 return;
425 return;
426 }
428 {
430 if(fail)
431 return;
433 return;
434 }
438 if (lev == 0)
439 {
441 return;
442 }
446
447
451
453#ifdef HAVE_NTL
457 {
459 zz_p::init (ch);
460 }
462 zz_pE::init (NTLMipo);
463 zz_pEX NTLResult;
464 zz_pEX NTLF;
465 zz_pEX NTLG;
466#endif
467 if(mv == 1)
468 {
470#ifdef HAVE_NTL
474 if (fail)
475 return;
477#else
479 if(fail)
480 return;
481#endif
485 }
487
495#ifdef HAVE_NTL
499 if (fail)
500 return;
502#else
503 tryEuclid(
cf,
cg,
M,c,fail);
504 if(fail)
505 return;
506#endif
507
508 f.tryDiv (
cf,
M, fail);
509 if(fail)
510 return;
511
512 g.tryDiv (
cg,
M, fail);
513 if(fail)
514 return;
516 if(
f.inCoeffDomain())
517 {
519 if(fail)
520 return;
522 return;
523 }
524 if(
g.inCoeffDomain())
525 {
527 if(fail)
528 return;
530 return;
531 }
532 int *L = new int[mv+1];
533 int *
N =
new int[mv+1];
534 for(
int i=2;
i<=mv;
i++)
540#ifdef HAVE_NTL
544 if (fail)
545 return;
547#else
549 if(fail)
550 return;
551#endif
556
557 int *dg_im = new int[mv+1];
565 bool divides= true;
567 {
571 continue;
575 "time for recursive calls in alg gcd mod p: ")
579 if(g_image.inCoeffDomain())
580 {
582 if(fail)
583 return;
585 return;
586 }
587 for(
int i=2;
i<=mv;
i++)
589 dg_im =
leadDeg(g_image, dg_im);
591 {
594 if (fail)
595 return;
596 g_image *= inv;
597 g_image *= gamma_image;
602 "time for Newton interpolation in alg gcd mod p: ")
603
604
605
609 if((
firstLC(gnew) == gamma) || (gnew == gm))
610 {
613 if(fail)
614 return;
615 divides = true;
616 g_image= gnew;
618 if(fail)
619 return;
621 if(fail)
622 return;
623 if(divides)
624 {
626 if(fail)
627 return;
628 if(divides2)
629 {
632 "time for successful termination test in alg gcd mod p: ")
634 }
635 }
638 }
639 gm = gnew;
640 continue;
641 }
642
644 continue;
645
646
648 gm = 0;
651 }
652
653 fail = true;
654}
zz_pEX convertFacCF2NTLzz_pEX(const CanonicalForm &f, const zz_pX &mipo)
CanonicalForm convertNTLzz_pEX2CF(const zz_pEX &f, const Variable &x, const Variable &alpha)
zz_pX convertFacCF2NTLzzpX(const CanonicalForm &f)
static CanonicalForm tryNewtonInterp(const CanonicalForm &alpha, const CanonicalForm &u, const CanonicalForm &newtonPoly, const CanonicalForm &oldInterPoly, const Variable &x, const CanonicalForm &M, bool &fail)
const CanonicalForm CFMap CFMap bool topLevel
static CanonicalForm tryvcontent(const CanonicalForm &f, const Variable &x, const CanonicalForm &M, bool &fail)
CanonicalForm firstLC(const CanonicalForm &f)
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
void tryNTLGCD(zz_pEX &x, const zz_pEX &a, const zz_pEX &b, bool &fail)
compute the GCD x of a and b, fail is set to true if a zero divisor is encountered
bool tryFdivides(const CanonicalForm &f, const CanonicalForm &g, const CanonicalForm &M, bool &fail)
same as fdivides but handles zero divisors in Z_p[t]/(f)[x1,...,xn] for reducible f
generate all elements in F_p starting from 0
const Variable & v
< [in] a sqrfree bivariate poly