Changeset 1a3011e in git
- Timestamp:
- Feb 1, 2012, 4:21:14 PM (11 years ago)
- Branches:
- (u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
- Children:
- 69c8820d335e5e0a8ddcbf89ce82547457c3ec66
- Parents:
- 09609a2f4751f0b3b3d459d710552a967e51d5d6
- git-author:
- Martin Lee <martinlee84@web.de>2012-02-01 16:21:14+01:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-02-10 14:16:44+01:00
- Location:
- factory
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facBivar.cc
r09609a r1a3011e 364 364 A= A (y + evaluation, y); 365 365 366 int liftBound= degree (A, y) + 1 + degree (LC(A, x));366 int liftBound= degree (A, y) + 1; 367 367 368 368 ExtensionInfo dummy= ExtensionInfo (false); -
factory/facFqBivar.cc
r09609a r1a3011e 620 620 } 621 621 622 CFList 623 earlyFactorDetection (CanonicalForm& F, CFList& factors,int& adaptedLiftBound, 622 void 623 earlyFactorDetection (CFList& reconstructedFactors, CanonicalForm& F, CFList& 624 factors, int& adaptedLiftBound, int*& factorsFoundIndex, 624 625 DegreePattern& degs, bool& success, int deg) 625 626 { 626 627 DegreePattern bufDegs1= degs; 627 628 DegreePattern bufDegs2; 628 CFList result;629 629 CFList T= factors; 630 630 CanonicalForm buf= F; … … 634 634 CanonicalForm M= power (F.mvar(), deg); 635 635 adaptedLiftBound= 0; 636 int d= degree (F) ;637 for (CFListIterator i= factors; i.hasItem(); i++ )638 { 639 if (!bufDegs1.find (degree (i.getItem(), 1)) )636 int d= degree (F), l= 0; 637 for (CFListIterator i= factors; i.hasItem(); i++, l++) 638 { 639 if (!bufDegs1.find (degree (i.getItem(), 1)) || factorsFoundIndex[l] == 1) 640 640 continue; 641 641 else … … 645 645 if (fdivides (g, buf, quot)) 646 646 { 647 result.append (g); 647 reconstructedFactors.append (g); 648 factorsFoundIndex[l]= 1; 648 649 buf= quot; 649 650 d -= degree (g); … … 657 658 if (bufDegs1.getLength() <= 1) 658 659 { 659 re sult.append (buf);660 reconstructedFactors.append (buf); 660 661 break; 661 662 } … … 666 667 if (adaptedLiftBound < deg) 667 668 { 669 success= true; 668 670 factors= T; 669 671 degs= bufDegs1; 670 672 F= buf; 671 success= true;672 673 } 673 674 if (bufDegs1.getLength() <= 1) 674 675 degs= bufDegs1; 675 return result;676 676 } 677 677 678 CFList 679 extEarlyFactorDetection (CanonicalForm& F, CFList& factors, 680 int& adaptedLiftBound, DegreePattern& degs, 681 bool& success, const ExtensionInfo& info, 682 const CanonicalForm& eval, int deg) 678 void 679 extEarlyFactorDetection (CFList& reconstructedFactors, CanonicalForm& F, CFList& 680 factors,int& adaptedLiftBound, int*& factorsFoundIndex, 681 DegreePattern& degs, bool& success, const 682 ExtensionInfo& info, const CanonicalForm& eval, int deg 683 ) 683 684 { 684 685 Variable alpha= info.getAlpha(); … … 696 697 adaptedLiftBound= 0; 697 698 bool trueFactor= false; 698 int d= degree (F) ;699 int d= degree (F), l= 0; 699 700 CFList source, dest; 700 701 int degMipoBeta= 1; … … 702 703 degMipoBeta= degree (getMipo (beta)); 703 704 CanonicalForm quot; 704 for (CFListIterator i= factors; i.hasItem(); i++ )705 { 706 if (!bufDegs1.find (degree (i.getItem(), 1)) )705 for (CFListIterator i= factors; i.hasItem(); i++, l++) 706 { 707 if (!bufDegs1.find (degree (i.getItem(), 1)) || factorsFoundIndex[l] == 1) 707 708 continue; 708 709 else … … 719 720 if (degree (buf2, alpha) < degMipoBeta) 720 721 { 721 appendTestMapDown (result, buf2, info, source, dest); 722 appendTestMapDown (reconstructedFactors, buf2, info, source, dest); 723 factorsFoundIndex[l]= 1; 722 724 buf= quot; 723 725 d -= degree (g); … … 730 732 if (!isInExtension (buf2, gamma, k, delta, source, dest)) 731 733 { 732 appendTestMapDown (result, buf2, info, source, dest); 734 appendTestMapDown (reconstructedFactors, buf2, info, source, dest); 735 factorsFoundIndex[l]= 1; 733 736 buf= quot; 734 737 d -= degree (g); … … 750 753 buf= buf (y - eval, y); 751 754 buf /= Lc (buf); 752 appendMapDown (re sult, buf, info, source, dest);755 appendMapDown (reconstructedFactors, buf, info, source, dest); 753 756 break; 754 757 } … … 767 770 if (bufDegs1.getLength() <= 1) 768 771 degs= bufDegs1; 769 770 return result;771 772 } 772 773 … … 826 827 } 827 828 829 void 830 deleteFactors (const CFList& L, CFList& factors, const CanonicalForm& eval, bool 831 extension) 832 { 833 int index; 834 CanonicalForm tmp1, tmp2; 835 CFListIterator j; 836 Variable y= Variable (2); 837 for (CFListIterator i= L; i.hasItem(); i++) 838 { 839 index= 1; 840 if (extension) 841 tmp1= mod (i.getItem(), y-eval); 842 else 843 tmp1= mod (i.getItem(), y); 844 tmp1 /= Lc (tmp1); 845 for (j= factors; j.hasItem(); j++, index++) 846 { 847 tmp2= mod (j.getItem(), y); 848 tmp2 /= Lc (tmp2); 849 if (tmp1 == tmp2) 850 { 851 index++; 852 j.remove(index); 853 break; 854 } 855 } 856 } 857 } 858 828 859 CFList 829 860 henselLiftAndEarly (CanonicalForm& A, bool& earlySuccess, CFList& … … 853 884 int smallFactorDeg= tmin (11, liftPre [sizeOfLiftPre- 1] + 1);//this is a tunable parameter 854 885 int dummy; 886 int * factorsFoundIndex= new int [uniFactors.length()]; 887 for (int i= 0; i < uniFactors.length(); i++) 888 factorsFoundIndex [i]= 0; 889 855 890 if (smallFactorDeg >= liftBound || degree (A,y) <= 4) 856 891 henselLift12 (A, bufUniFactors, liftBound, Pi, diophant, M); … … 859 894 henselLift12 (A, bufUniFactors, smallFactorDeg, Pi, diophant, M); 860 895 if (!extension) 861 earlyFactors= earlyFactorDetection (A, bufUniFactors, newLiftBound, 862 degs, earlySuccess, smallFactorDeg); 896 earlyFactorDetection (earlyFactors, A, bufUniFactors, newLiftBound, 897 factorsFoundIndex, degs, earlySuccess, 898 smallFactorDeg); 863 899 else 864 e arlyFactors= extEarlyFactorDetection (A, bufUniFactors,865 newLiftBound, degs, earlySuccess, info, eval,866 smallFactorDeg);900 extEarlyFactorDetection (earlyFactors, A, bufUniFactors, newLiftBound, 901 factorsFoundIndex, degs, earlySuccess, info, 902 eval, smallFactorDeg); 867 903 if (degs.getLength() > 1 && !earlySuccess && 868 904 smallFactorDeg != liftPre [sizeOfLiftPre-1] + 1) … … 874 910 liftPre[sizeOfLiftPre-1] + 1, Pi, diophant, M); 875 911 if (!extension) 876 earlyFactors= earlyFactorDetection (A, bufUniFactors, newLiftBound, 877 degs, earlySuccess, liftPre[sizeOfLiftPre-1] + 1); 912 earlyFactorDetection (earlyFactors, A, bufUniFactors, newLiftBound, 913 factorsFoundIndex, degs, earlySuccess, 914 liftPre[sizeOfLiftPre-1] + 1); 878 915 else 879 e arlyFactors= extEarlyFactorDetection (A, bufUniFactors,880 newLiftBound, degs, earlySuccess, info, eval,881 liftPre[sizeOfLiftPre-1] + 1);916 extEarlyFactorDetection (earlyFactors, A, bufUniFactors, newLiftBound, 917 factorsFoundIndex, degs, earlySuccess, info, 918 eval, liftPre[sizeOfLiftPre-1] + 1); 882 919 } 883 920 } … … 894 931 liftPre[i-1] + 1, Pi, diophant, M); 895 932 if (!extension) 896 earlyFactors= earlyFactorDetection (A, bufUniFactors, newLiftBound, 897 degs, earlySuccess, liftPre[i-1] + 1); 933 earlyFactorDetection (earlyFactors, A, bufUniFactors, newLiftBound, 934 factorsFoundIndex, degs, earlySuccess, 935 liftPre[i-1] + 1); 898 936 else 899 e arlyFactors= extEarlyFactorDetection (A, bufUniFactors,900 newLiftBound, degs, earlySuccess, info, eval,901 liftPre[i-1] + 1);937 extEarlyFactorDetection (earlyFactors, A, bufUniFactors, newLiftBound, 938 factorsFoundIndex, degs, earlySuccess, info, 939 eval, liftPre[i-1] + 1); 902 940 } 903 941 else … … 916 954 henselLift12 (A, bufUniFactors, smallFactorDeg, Pi, diophant, M); 917 955 if (!extension) 918 earlyFactors= earlyFactorDetection (A, bufUniFactors, newLiftBound, 919 degs, earlySuccess, smallFactorDeg); 956 earlyFactorDetection (earlyFactors, A, bufUniFactors, newLiftBound, 957 factorsFoundIndex, degs, earlySuccess, 958 smallFactorDeg); 920 959 else 921 e arlyFactors= extEarlyFactorDetection (A, bufUniFactors,922 newLiftBound, degs, earlySuccess, info, eval,923 smallFactorDeg);960 extEarlyFactorDetection (earlyFactors, A, bufUniFactors, newLiftBound, 961 factorsFoundIndex, degs, earlySuccess, info, 962 eval, smallFactorDeg); 924 963 int i= 1; 925 964 while ((degree (A,y)/4)*i + 4 <= smallFactorDeg) … … 932 971 dummy, Pi, diophant, M); 933 972 if (!extension) 934 earlyFactor s= earlyFactorDetection (A, bufUniFactors, newLiftBound,935 degs, earlySuccess, dummy);973 earlyFactorDetection (earlyFactors, A, bufUniFactors, newLiftBound, 974 factorsFoundIndex, degs, earlySuccess, dummy); 936 975 else 937 e arlyFactors= extEarlyFactorDetection (A, bufUniFactors,938 newLiftBound, degs, earlySuccess, info, eval,939 dummy);976 extEarlyFactorDetection (earlyFactors, A, bufUniFactors, newLiftBound, 977 factorsFoundIndex, degs, earlySuccess, info, 978 eval, dummy); 940 979 } 941 980 while (degs.getLength() > 1 && !earlySuccess && i < 4) … … 948 987 dummy, Pi, diophant, M); 949 988 if (!extension) 950 earlyFactor s= earlyFactorDetection (A, bufUniFactors, newLiftBound,951 degs, earlySuccess, dummy);989 earlyFactorDetection (earlyFactors, A, bufUniFactors, newLiftBound, 990 factorsFoundIndex, degs, earlySuccess, dummy); 952 991 else 953 e arlyFactors= extEarlyFactorDetection (A, bufUniFactors,954 newLiftBound, degs, earlySuccess, info, eval,955 dummy);992 extEarlyFactorDetection (earlyFactors, A, bufUniFactors, newLiftBound, 993 factorsFoundIndex, degs, earlySuccess, info, 994 eval, dummy); 956 995 } 957 996 else … … 966 1005 } 967 1006 968 if (!earlySuccess) 969 liftBound= degree (A,y) + 1; 970 1007 delete [] factorsFoundIndex; 971 1008 delete [] liftPre; 972 1009 … … 4199 4236 int adaptedLiftBound; 4200 4237 success= false; 4201 CFList earlyFactors= earlyFactorDetection (F, bufUniFactors, adaptedLiftBound, 4202 degs, success, smallFactorDeg 4203 ); 4238 int * factorsFoundIndex= new int [uniFactors.length()]; 4239 for (int i= 0; i < uniFactors.length(); i++) 4240 factorsFoundIndex [i]= 0; 4241 CFList earlyFactors; 4242 earlyFactorDetection (earlyFactors, F, bufUniFactors, adaptedLiftBound, 4243 factorsFoundIndex, degs, success, smallFactorDeg); 4244 delete [] factorsFoundIndex; 4204 4245 if (degs.getLength() == 1) 4205 4246 { … … 4249 4290 int adaptedLiftBound; 4250 4291 success= false; 4251 CFList earlyFactors= extEarlyFactorDetection (F, bufUniFactors, 4252 adaptedLiftBound, degs, success, 4253 info, evaluation, smallFactorDeg 4254 ); 4292 int * factorsFoundIndex= new int [uniFactors.length()]; 4293 for (int i= 0; i < uniFactors.length(); i++) 4294 factorsFoundIndex [i]= 0; 4295 CFList earlyFactors; 4296 extEarlyFactorDetection (earlyFactors, F, bufUniFactors, adaptedLiftBound, 4297 factorsFoundIndex, degs, success, info, evaluation, 4298 smallFactorDeg); 4299 delete [] factorsFoundIndex; 4255 4300 if (degs.getLength() == 1) 4256 4301 { … … 5699 5744 A= A (y + evaluation, y); 5700 5745 5701 int liftBound= degree (A, y) + 1 + degree (LC(A, x));5746 int liftBound= degree (A, y) + 1; 5702 5747 5703 5748 int boundsLength; -
factory/facFqBivar.h
r09609a r1a3011e 678 678 /// degree pattern are updated. 679 679 /// 680 /// @return @a earlyFactorDetection returns a list of factors of F (possibly in-681 /// complete), in case of success. Otherwise an empty list.682 680 /// @sa factorRecombination(), extEarlyFactorDetection() 683 CFList 681 void 684 682 earlyFactorDetection ( 683 CFList& reconstructedFactors, ///< [in,out] list of reconstructed 684 ///< factors 685 685 CanonicalForm& F, ///< [in,out] poly to be factored, returns 686 686 ///< poly divided by detected factors in case … … 690 690 ///< without detected factors 691 691 int& adaptedLiftBound, ///< [in,out] adapted lift bound 692 int*& factorsFoundIndex,///< [in,out] factors already considered 692 693 DegreePattern& degs, ///< [in,out] degree pattern, is updated 693 694 ///< whenever we find a factor … … 700 701 /// degree pattern are updated. 701 702 /// 702 /// @return @a extEarlyFactorDetection returns a list of factors of F (possibly703 /// incomplete), whose shift to zero is reversed, in case of success.704 /// Otherwise an empty list.705 703 /// @sa factorRecombination(), earlyFactorDetection() 706 CFList 704 void 707 705 extEarlyFactorDetection ( 706 CFList& reconstructedFactors, ///< [in,out] list of reconstructed 707 ///< factors 708 708 CanonicalForm& F, ///< [in,out] poly to be factored, returns 709 709 ///< poly divided by detected factors in case … … 713 713 ///< without detected factors 714 714 int& adaptedLiftBound, ///< [in,out] adapted lift bound 715 int*& factorsFoundIndex, ///< [in,out] factors already considered 715 716 DegreePattern& degs, ///< [in,out] degree pattern, is updated 716 717 ///< whenever we find a factor
Note: See TracChangeset
for help on using the changeset viewer.