multiFactorize
| 3658 | /// multivariate factorization over an extension of the initial field |
| 3659 | #ifdef HAVE_NTL // multiFactorize |
| 3660 | CFList |
| 3661 | extFactorize (const CanonicalForm& F, const ExtensionInfo& info) |
| 3662 | { |
| 3663 | CanonicalForm A= F; |
| 3664 | |
| 3665 | Variable alpha= info.getAlpha(); |
| 3666 | Variable beta= info.getBeta(); |
| 3667 | int k= info.getGFDegree(); |
| 3668 | char cGFName= info.getGFName(); |
| 3669 | CanonicalForm delta= info.getDelta(); |
| 3670 | bool GF= (CFFactory::gettype() == GaloisFieldDomain); |
| 3671 | Variable w= Variable (1); |
| 3672 | |
| 3673 | CFList factors; |
| 3674 | if (!GF && alpha == w) // we are in F_p |
| 3675 | { |
| 3676 | CFList factors; |
| 3677 | bool extension= true; |
| 3678 | int p= getCharacteristic(); |
| 3679 | if (p < 7) |
| 3680 | { |
| 3681 | if (p == 2) |
| 3682 | setCharacteristic (getCharacteristic(), 6, 'Z'); |
| 3683 | else if (p == 3) |
| 3684 | setCharacteristic (getCharacteristic(), 4, 'Z'); |
| 3685 | else if (p == 5) |
| 3686 | setCharacteristic (getCharacteristic(), 3, 'Z'); |
| 3687 | ExtensionInfo info= ExtensionInfo (extension); |
| 3688 | A= A.mapinto(); |
| 3689 | factors= multiFactorize (A, info); |
| 3690 | |
| 3691 | CanonicalForm mipo= gf_mipo; |
| 3692 | setCharacteristic (getCharacteristic()); |
| 3693 | Variable vBuf= rootOf (mipo.mapinto()); |
| 3694 | for (CFListIterator j= factors; j.hasItem(); j++) |
| 3695 | j.getItem()= GF2FalphaRep (j.getItem(), vBuf); |
| 3696 | prune (vBuf); |
| 3697 | } |
| 3698 | else if (p >= 7 && p*p < (1<<16)) // pass to GF if possible |
| 3699 | { |
| 3700 | setCharacteristic (getCharacteristic(), 2, 'Z'); |
| 3701 | ExtensionInfo info= ExtensionInfo (extension); |
| 3702 | A= A.mapinto(); |
| 3703 | factors= multiFactorize (A, info); |
| 3704 | |
| 3705 | CanonicalForm mipo= gf_mipo; |
| 3706 | setCharacteristic (getCharacteristic()); |
| 3707 | Variable vBuf= rootOf (mipo.mapinto()); |
| 3708 | for (CFListIterator j= factors; j.hasItem(); j++) |
| 3709 | j.getItem()= GF2FalphaRep (j.getItem(), vBuf); |
| 3710 | prune (vBuf); |
| 3711 | } |
| 3712 | else // not able to pass to GF, pass to F_p(\alpha) |
| 3713 | { |
| 3714 | CanonicalForm mipo= randomIrredpoly (2, w); |
| 3715 | Variable v= rootOf (mipo); |
| 3716 | ExtensionInfo info= ExtensionInfo (v); |
| 3717 | factors= multiFactorize (A, info); |
no test coverage detected