| 609 | |
| 610 | #if defined(HAVE_NTL) || defined(HAVE_FLINT) |
| 611 | CFList |
| 612 | earlyFactorDetect (CanonicalForm& F, CFList& factors, int& adaptedLiftBound, |
| 613 | bool& success, const int deg, const CFList& MOD, |
| 614 | const int bound) |
| 615 | { |
| 616 | CFList result; |
| 617 | CFList T= factors; |
| 618 | CanonicalForm buf= F; |
| 619 | Variable y= F.mvar(); |
| 620 | Variable x= Variable (1); |
| 621 | CanonicalForm LCBuf= LC (buf, x); |
| 622 | CanonicalForm g, quot; |
| 623 | CFList M= MOD; |
| 624 | M.append (power (y, deg)); |
| 625 | adaptedLiftBound= 0; |
| 626 | int d= bound; |
| 627 | int e= 0; |
| 628 | int nBuf; |
| 629 | for (CFListIterator i= factors; i.hasItem(); i++) |
| 630 | { |
| 631 | g= mulMod (i.getItem(), LCBuf, M); |
| 632 | g /= myContent (g); |
| 633 | if (fdivides (g, buf, quot)) |
| 634 | { |
| 635 | result.append (g); |
| 636 | nBuf= degree (g, y) + degree (LC (g, x), y); |
| 637 | d -= nBuf; |
| 638 | e= tmax (e, nBuf); |
| 639 | buf= quot; |
| 640 | LCBuf= LC (buf, x); |
| 641 | T= Difference (T, CFList (i.getItem())); |
| 642 | } |
| 643 | } |
| 644 | adaptedLiftBound= d; |
| 645 | |
| 646 | if (adaptedLiftBound < deg) |
| 647 | { |
| 648 | if (adaptedLiftBound < degree (F) + 1) |
| 649 | { |
| 650 | if (d == 1) |
| 651 | adaptedLiftBound= tmin (e + 1, deg); |
| 652 | else |
| 653 | adaptedLiftBound= deg; |
| 654 | } |
| 655 | factors= T; |
| 656 | F= buf; |
| 657 | success= true; |
| 658 | } |
| 659 | return result; |
| 660 | } |
| 661 | #endif |
| 662 | |
| 663 | #if defined(HAVE_NTL) || defined(HAVE_FLINT) |
no test coverage detected