Changeset ad0177 in git
- Timestamp:
- Mar 6, 2012, 9:48:34 PM (12 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- 24c6177e872b135f0188fea998eb45a75e3fde6e
- Parents:
- 54af8a51cc8091a4687fb55bf401e31a0478bc1e
- git-author:
- Martin Lee <martinlee84@web.de>2012-03-06 21:48:34+01:00
- git-committer:
- Martin Lee <martinlee84@web.de>2012-04-04 14:42:27+02:00
- Location:
- factory
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facFqBivar.cc
r54af8a5 rad0177 43 43 TIMING_DEFINE_PRINT(fac_hensel_lift12) 44 44 45 CanonicalForm prodMod0 (const CFList& L, const CanonicalForm& M )45 CanonicalForm prodMod0 (const CFList& L, const CanonicalForm& M, const modpk& b) 46 46 { 47 47 if (L.isEmpty()) … … 50 50 return mod (L.getFirst()(0, 1) , M); 51 51 else if (L.length() == 2) 52 return mod (mulNTL (L.getFirst()(0, 1),L.getLast()(0, 1) ), M);52 return mod (mulNTL (L.getFirst()(0, 1),L.getLast()(0, 1), b), M); 53 53 else 54 54 { … … 60 60 tmp1.append (i.getItem()); 61 61 tmp2= Difference (L, tmp1); 62 buf1= prodMod0 (tmp1, M );63 buf2= prodMod0 (tmp2, M );64 return mod (mulNTL (buf1,buf2 ), M);62 buf1= prodMod0 (tmp1, M, b); 63 buf2= prodMod0 (tmp2, M, b); 64 return mod (mulNTL (buf1,buf2, b), M); 65 65 } 66 66 } … … 487 487 bool recombination= false; 488 488 CanonicalForm test; 489 CanonicalForm buf0= buf (0, x)*LCBuf; 489 CanonicalForm buf0= mulNTL (buf (0, x), LCBuf, b); 490 bool isRat= (isOn (SW_RATIONAL) && getCharacteristic() == 0) || getCharacteristic() > 0; 490 491 while (T.length() >= 2*s && s <= thres) 491 492 { … … 521 522 else 522 523 { 523 test= prodMod0 (S, M); 524 test *= LCBuf; 525 test = mod (test, M); 526 if (b.getp() != 0) 527 test= b(test); 528 if (fdivides (test, buf0)) 524 test= prodMod0 (S, M, b); 525 test= mulNTL (test, LCBuf, b); 526 test= mod (test, M); 527 if (uniFdivides (test, buf0)) 529 528 { 530 529 S.insert (LCBuf); … … 534 533 g= b(g); 535 534 g /= content (g, x); 535 if (!isRat) 536 On (SW_RATIONAL); 536 537 if (fdivides (g, buf, quot)) 537 538 { … … 543 544 l -= degree (g); 544 545 M= power (y, l); 545 buf0= buf (0, x)*LCBuf; 546 if (!isRat) 547 Off (SW_RATIONAL); 548 buf0= mulNTL (buf (0, x), LCBuf, b); 546 549 // compute new possible degree pattern 547 550 bufDegs2= DegreePattern (T); … … 569 572 if (nosubset) break; 570 573 } 574 if (!isRat) 575 Off (SW_RATIONAL); 571 576 } 572 577 } … … 661 666 CanonicalForm buf1= mulNTL (buf (1,x), LCBuf, b); 662 667 CanonicalForm test0, test1; 668 bool isRat= (isOn (SW_RATIONAL) && getCharacteristic() == 0) || getCharacteristic() > 0; 663 669 for (CFListIterator i= factors; i.hasItem(); i++, l++) 664 670 { … … 677 683 g= b(g); 678 684 g /= content (g, x); 685 if (!isRat) 686 On (SW_RATIONAL); 679 687 if (fdivides (g, buf, quot)) 680 688 { … … 684 692 d -= degree (g); 685 693 LCBuf= LC (buf, x); 694 if (!isRat) 695 Off (SW_RATIONAL); 686 696 buf0= mulNTL (buf (0,x), LCBuf, b); 687 697 buf1= mulNTL (buf (1,x), LCBuf, b); … … 699 709 } 700 710 } 711 if (!isRat) 712 Off (SW_RATIONAL); 701 713 } 702 714 } -
factory/facFqBivar.h
r54af8a5 rad0177 578 578 CanonicalForm prodMod0 (const CFList& L, ///< [in] a list of compressed, 579 579 ///< bivariate polynomials 580 const CanonicalForm& M ///< [in] a power of Variable (2) 580 const CanonicalForm& M,///< [in] a power of Variable (2) 581 const modpk& b= modpk()///< [in] coeff bound 581 582 ); 582 583 -
factory/facMul.cc
r54af8a5 rad0177 397 397 mulNTL (const CanonicalForm& F, const CanonicalForm& G, const modpk& b) 398 398 { 399 if (CFFactory::gettype() == GaloisFieldDomain) 400 return F*G; 399 401 if (F.inCoeffDomain() || G.inCoeffDomain() || getCharacteristic() == 0) 400 402 { … … 480 482 ASSERT (F.isUnivariate() && G.isUnivariate(), "expected univariate polys"); 481 483 ASSERT (F.level() == G.level(), "expected polys of same level"); 482 if (CFFactory::gettype() == GaloisFieldDomain)483 return F*G;484 484 zz_p::init (getCharacteristic()); 485 485 Variable alpha; … … 517 517 modNTL (const CanonicalForm& F, const CanonicalForm& G, const modpk& b) 518 518 { 519 if (CFFactory::gettype() == GaloisFieldDomain) 520 return mod (F, G); 519 521 if (F.inCoeffDomain() && G.isUnivariate()) 520 522 { … … 593 595 ASSERT (F.isUnivariate() && G.isUnivariate(), "expected univariate polys"); 594 596 ASSERT (F.level() == G.level(), "expected polys of same level"); 595 if (CFFactory::gettype() == GaloisFieldDomain)596 return mod (F, G);597 597 zz_p::init (getCharacteristic()); 598 598 Variable alpha; … … 630 630 divNTL (const CanonicalForm& F, const CanonicalForm& G, const modpk& b) 631 631 { 632 if (CFFactory::gettype() == GaloisFieldDomain) 633 return div (F, G); 632 634 if (F.inCoeffDomain() && G.isUnivariate()) 633 635 { … … 736 738 ASSERT (F.isUnivariate() && G.isUnivariate(), "expected univariate polys"); 737 739 ASSERT (F.level() == G.level(), "expected polys of same level"); 738 if (CFFactory::gettype() == GaloisFieldDomain)739 return div (F, G);740 740 zz_p::init (getCharacteristic()); 741 741 Variable alpha; … … 2799 2799 uniFdivides (const CanonicalForm& A, const CanonicalForm& B) 2800 2800 { 2801 if (B.isZero()) 2802 return true; 2803 if (A.isZero()) 2804 return false; 2805 if (CFFactory::gettype() == GaloisFieldDomain) 2806 return fdivides (A, B); 2801 2807 int p= getCharacteristic(); 2802 2808 if (p > 0) … … 2806 2812 if (hasFirstAlgVar (A, alpha) || hasFirstAlgVar (B, alpha)) 2807 2813 { 2814 if (A.inCoeffDomain() || B.inCoeffDomain()) 2815 { 2816 if (A.inCoeffDomain()) 2817 return true; 2818 else 2819 return false; 2820 } 2808 2821 zz_pX NTLMipo= convertFacCF2NTLzzpX (getMipo (alpha)); 2809 2822 zz_pE::init (NTLMipo); … … 2832 2845 { 2833 2846 fmpq_poly_t FLINTA,FLINTB; 2834 fmpq_poly_init (FLINTA);2835 fmpq_poly_init (FLINTB);2836 2847 convertFacCF2Fmpq_poly_t (FLINTA, A); 2837 2848 convertFacCF2Fmpq_poly_t (FLINTB, B); … … 2853 2864 return R.isZero(); 2854 2865 #else 2855 return fdivides (A, B); //maybe NTL? 2866 bool isRat= isOn (SW_RATIONAL); 2867 if (!isRat) 2868 On (SW_RATIONAL); 2869 bool result= fdivides (A, B); 2870 if (!isRat) 2871 Off (SW_RATIONAL); 2872 return result; //maybe NTL? 2856 2873 #endif 2857 2874 }
Note: See TracChangeset
for help on using the changeset viewer.