Changeset 14e634 in git
- Timestamp:
- Dec 10, 2012, 3:38:49 PM (11 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- b15cf8578937df382dad415dbfdd2229103409bf
- Parents:
- 3e7db4d961b4509d248e12d8e96e2bed08d9cfe8
- git-author:
- Martin Lee <martinlee84@web.de>2012-12-10 15:38:49+01:00
- git-committer:
- Martin Lee <martinlee84@web.de>2012-12-12 15:24:58+01:00
- Location:
- factory
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facBivar.cc
r3e7db4 r14e634 499 499 modpk b= modpk(); 500 500 bool mipoHasDen= false; 501 CanonicalForm den= 1; 501 502 if (!extension) 502 503 { … … 519 520 { 520 521 A /= Lc (Aeval); 522 mipoHasDen= !bCommonDen(mipo).isOne(); 523 mipo *= bCommonDen (mipo); 524 ZZX NTLmipo= convertFacCF2NTLZZX (mipo); 525 ZZX NTLLcf= convertFacCF2NTLZZX (Lc (A*bCommonDen (A))); 526 ZZ NTLf= resultant (NTLmipo, NTLLcf); 527 ZZ NTLD= discriminant (NTLmipo); 528 den= abs (convertZZ2CF (NTLD*NTLf)); 529 521 530 // make factors elements of Z(a)[x] disable for modularDiophant 522 531 CanonicalForm multiplier= 1; … … 529 538 A *= bCommonDen (A); 530 539 531 mipoHasDen= !bCommonDen(mipo).isOne();532 mipo *= bCommonDen (mipo);533 540 Off (SW_RATIONAL); 534 541 int i= 0; 535 ZZX NTLmipo= convertFacCF2NTLZZX (mipo); 536 CanonicalForm discMipo= convertZZ2CF (discriminant (NTLmipo)); 542 CanonicalForm discMipo= convertZZ2CF (NTLD); 537 543 findGoodPrime (F*discMipo,i); 538 544 findGoodPrime (Aeval*discMipo,i); … … 555 561 uniFactors= henselLiftAndEarly 556 562 (A, earlySuccess, earlyFactors, degs, liftBound, 557 uniFactors, dummy, evaluation, b );563 uniFactors, dummy, evaluation, b, den); 558 564 TIMING_END_AND_PRINT (fac_bi_hensel_lift, 559 565 "time for bivariate hensel lifting over Q: "); … … 578 584 TIMING_START (fac_bi_factor_recombination); 579 585 factors= factorRecombination (uniFactors, A, MODl, degs, 1, 580 uniFactors.length()/2, b );586 uniFactors.length()/2, b, den); 581 587 TIMING_END_AND_PRINT (fac_bi_factor_recombination, 582 588 "time for bivariate factor recombination over Q: "); -
factory/facFqBivar.cc
r3e7db4 r14e634 482 482 factorRecombination (CFList& factors, CanonicalForm& F, 483 483 const CanonicalForm& N, DegreePattern& degs, int s, 484 int thres, const modpk& b 484 int thres, const modpk& b, const CanonicalForm& den 485 485 ) 486 486 { … … 515 515 Variable y= Variable (2); 516 516 Variable x= Variable (1); 517 CanonicalForm LCBuf= LC (F, x); 517 CanonicalForm denom= den, denQuot; 518 CanonicalForm LCBuf= LC (F, x)*denom; 518 519 CanonicalForm g, quot, buf= F; 519 520 int * v= new int [T.length()]; … … 598 599 { 599 600 On (SW_RATIONAL); 601 if (!Lc (g).inBaseDomain()) 602 g /= Lc (g); 600 603 g *= bCommonDen (g); 601 604 Off (SW_RATIONAL); … … 605 608 if (fdivides (g, buf, quot)) 606 609 { 610 denom *= abs (lc (g)); 607 611 recombination= true; 608 612 result.append (g); 609 613 if (b.getp() != 0) 610 buf= quot*bCommonDen (quot); 614 { 615 denQuot= bCommonDen (quot); 616 buf= quot*denQuot; 617 Off (SW_RATIONAL); 618 denom /= gcd (denom, denQuot); 619 On (SW_RATIONAL); 620 } 611 621 else 612 622 buf= quot; 613 LCBuf= LC (buf, x) ;623 LCBuf= LC (buf, x)*denom; 614 624 T= Difference (T, S); 615 625 l -= degree (g); … … 726 736 factors, int& adaptedLiftBound, int*& factorsFoundIndex, 727 737 DegreePattern& degs, bool& success, int deg, 728 const modpk& b )738 const modpk& b, CanonicalForm& den) 729 739 { 730 740 DegreePattern bufDegs1= degs; … … 742 752 if (b.getp() != 0) 743 753 buf *= bCommonDen (buf); 744 CanonicalForm LCBuf= LC (buf, x) ;754 CanonicalForm LCBuf= LC (buf, x)*den; 745 755 CanonicalForm buf0= mulNTL (buf (0,x), LCBuf); 746 756 CanonicalForm buf1= mulNTL (buf (1,x), LCBuf); … … 748 758 Off (SW_RATIONAL); 749 759 CanonicalForm test0, test1; 760 CanonicalForm denQuot; 750 761 751 762 for (CFListIterator i= factors; i.hasItem(); i++, l++) … … 777 788 { 778 789 On (SW_RATIONAL); 790 if (!Lc (g).inBaseDomain()) 791 g /= Lc (g); 779 792 g *= bCommonDen (g); 780 793 Off (SW_RATIONAL); … … 784 797 if (fdivides (g, buf, quot)) 785 798 { 799 den *= abs (lc (g)); 786 800 reconstructedFactors.append (g); 787 801 factorsFoundIndex[l]= 1; 788 802 if (b.getp() != 0) 789 buf= quot*bCommonDen(quot); 803 { 804 denQuot= bCommonDen (quot); 805 buf= quot*denQuot; 806 Off (SW_RATIONAL); 807 den /= gcd (den, denQuot); 808 On (SW_RATIONAL); 809 } 790 810 else 791 811 buf= quot; 792 812 d -= degree (g); 793 LCBuf= LC (buf, x) ;813 LCBuf= LC (buf, x)*den; 794 814 buf0= mulNTL (buf (0,x), LCBuf); 795 815 buf1= mulNTL (buf (1,x), LCBuf); … … 827 847 if (bufDegs1.getLength() <= 1) 828 848 degs= bufDegs1; 849 } 850 851 void 852 earlyFactorDetection (CFList& reconstructedFactors, CanonicalForm& F, CFList& 853 factors, int& adaptedLiftBound, int*& factorsFoundIndex, 854 DegreePattern& degs, bool& success, int deg, 855 const modpk& b) 856 { 857 CanonicalForm den= 1; 858 earlyFactorDetection (reconstructedFactors, F, factors, adaptedLiftBound, factorsFoundIndex, degs, success, deg,b, den); 829 859 } 830 860 … … 1002 1032 earlyFactors, DegreePattern& degs, int& liftBound, 1003 1033 const CFList& uniFactors, const ExtensionInfo& info, 1004 const CanonicalForm& eval, modpk& b)1034 const CanonicalForm& eval,modpk& b, CanonicalForm& den) 1005 1035 { 1006 1036 Variable alpha= info.getAlpha(); … … 1018 1048 CFList diophant; 1019 1049 CFList bufUniFactors= uniFactors; 1050 On (SW_RATIONAL); 1020 1051 CanonicalForm bufA= A; 1052 if (!Lc (A).inBaseDomain()) 1053 { 1054 bufA /= Lc (A); 1055 CanonicalForm denBufA= bCommonDen (bufA); 1056 bufA *= denBufA; 1057 Off (SW_RATIONAL); 1058 den /= gcd (den, denBufA); 1059 } 1060 else 1061 { 1062 bufA= A; 1063 Off (SW_RATIONAL); 1064 den /= gcd (den, Lc (A)); 1065 } 1021 1066 CanonicalForm lcA0= 0; 1022 1067 bool mipoHasDen= false; … … 1082 1127 earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, 1083 1128 factorsFoundIndex, degs, earlySuccess, 1084 smallFactorDeg, b );1129 smallFactorDeg, b, den); 1085 1130 else 1086 1131 earlyFactorDetection(earlyFactors, bufA, bufBufUniFactors, newLiftBound, 1087 1132 factorsFoundIndex, degs, earlySuccess, 1088 smallFactorDeg, b );1133 smallFactorDeg, b, den); 1089 1134 } 1090 1135 else … … 1111 1156 earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, 1112 1157 factorsFoundIndex, degs, earlySuccess, 1113 liftPre[sizeOfLiftPre-1] + 1, b );1158 liftPre[sizeOfLiftPre-1] + 1, b, den); 1114 1159 else 1115 1160 earlyFactorDetection (earlyFactors,bufA,bufBufUniFactors,newLiftBound, 1116 1161 factorsFoundIndex, degs, earlySuccess, 1117 liftPre[sizeOfLiftPre-1] + 1, b );1162 liftPre[sizeOfLiftPre-1] + 1, b, den); 1118 1163 } 1119 1164 else … … 1145 1190 earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, 1146 1191 factorsFoundIndex, degs, earlySuccess, 1147 liftPre[i-1] + 1, b );1192 liftPre[i-1] + 1, b, den); 1148 1193 else 1149 1194 earlyFactorDetection (earlyFactors,bufA,bufBufUniFactors,newLiftBound, 1150 1195 factorsFoundIndex, degs, earlySuccess, 1151 liftPre[i-1] + 1, b );1196 liftPre[i-1] + 1, b, den); 1152 1197 } 1153 1198 else … … 1188 1233 earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, 1189 1234 factorsFoundIndex, degs, earlySuccess, 1190 smallFactorDeg, b );1235 smallFactorDeg, b, den); 1191 1236 else 1192 1237 earlyFactorDetection (earlyFactors, bufA, bufBufUniFactors, newLiftBound, 1193 1238 factorsFoundIndex, degs, earlySuccess, 1194 smallFactorDeg, b );1239 smallFactorDeg, b, den); 1195 1240 } 1196 1241 else … … 1217 1262 if (v==alpha) 1218 1263 earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, 1219 factorsFoundIndex, degs, earlySuccess, dummy, b); 1264 factorsFoundIndex, degs, earlySuccess, dummy, b, 1265 den); 1220 1266 else 1221 1267 earlyFactorDetection (earlyFactors, bufA,bufBufUniFactors, newLiftBound, 1222 factorsFoundIndex, degs, earlySuccess, dummy, b); 1268 factorsFoundIndex, degs, earlySuccess, dummy, b, 1269 den); 1223 1270 } 1224 1271 else … … 1245 1292 if (v==alpha) 1246 1293 earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, 1247 factorsFoundIndex, degs, earlySuccess, dummy,b); 1294 factorsFoundIndex, degs, earlySuccess, dummy,b, 1295 den); 1248 1296 else 1249 1297 earlyFactorDetection (earlyFactors,bufA,bufBufUniFactors,newLiftBound, 1250 factorsFoundIndex, degs, earlySuccess, dummy,b); 1298 factorsFoundIndex, degs, earlySuccess, dummy,b, 1299 den); 1251 1300 } 1252 1301 else … … 1287 1336 { 1288 1337 modpk dummy= modpk(); 1338 CanonicalForm den= 1; 1289 1339 return henselLiftAndEarly (A, earlySuccess, earlyFactors, degs, liftBound, 1290 uniFactors, info, eval, dummy );1340 uniFactors, info, eval, dummy, den); 1291 1341 } 1292 1342 -
factory/facFqBivar.h
r3e7db4 r14e634 585 585 CFList 586 586 factorRecombination ( 587 CFList& factors, ///< [in,out] list of lifted factors 588 ///< that are monic wrt Variable (1) 589 CanonicalForm& F, ///< [in,out] poly to be factored 590 const CanonicalForm& M,///< [in] Variable (2)^liftBound 591 DegreePattern& degs, ///< [in] degree pattern 592 int s, ///< [in] algorithm starts checking 593 ///< subsets of size s 594 int thres, ///< [in] threshold for the size of 595 ///< subsets which are checked, for a 596 ///< full factor recombination choose 597 ///< thres= factors.length()/2 598 const modpk& b=modpk() ///< [in] coeff bound 587 CFList& factors, ///< [in,out] list of lifted factors 588 ///< that are monic wrt Variable (1) 589 CanonicalForm& F, ///< [in,out] poly to be factored 590 const CanonicalForm& M, ///< [in] Variable (2)^liftBound 591 DegreePattern& degs, ///< [in] degree pattern 592 int s, ///< [in] algorithm starts checking 593 ///< subsets of size s 594 int thres, ///< [in] threshold for the size of 595 ///< subsets which are checked, for a 596 ///< full factor recombination choose 597 ///< thres= factors.length()/2 598 const modpk& b=modpk(), ///< [in] coeff bound 599 const CanonicalForm& den= 1 ///< [in] bound on the den if over Q (a) 599 600 ); 600 601 … … 690 691 const ExtensionInfo& info, ///< [in] information about extension 691 692 const CanonicalForm& eval, ///< [in] evaluation point 692 modpk& b ///< [in] coeff bound 693 modpk& b, ///< [in] coeff bound 694 CanonicalForm& den ///< [in] bound on the den if over Q(a) 693 695 ); 694 696
Note: See TracChangeset
for help on using the changeset viewer.