Changeset 2156ec in git
- Timestamp:
- May 3, 2012, 12:10:05 PM (11 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 0d56271c672440c06e14ca2528a5185bb37e1e6f
- Parents:
- e2666785b249262bbfdcdc9e4ca1a39a4054e994
- git-author:
- Martin Lee <martinlee84@web.de>2012-05-03 12:10:05+02:00
- git-committer:
- Martin Lee <martinlee84@web.de>2012-05-07 14:17:10+02:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/algext.cc
re26667 r2156ec 24 24 #include "cf_map.h" 25 25 #include "cf_generator.h" 26 27 #ifdef HAVE_NTL 28 #include "NTLconvert.h" 29 #endif 26 30 27 31 /// compressing two polynomials F and G, M is used for compressing, … … 585 589 } 586 590 591 #ifdef HAVE_NTL 592 static CanonicalForm 593 myicontent ( const CanonicalForm & f, const CanonicalForm & c ) 594 { 595 if (f.isOne() || c.isOne()) 596 return 1; 597 if ( f.inBaseDomain() && c.inBaseDomain()) 598 { 599 if (c.isZero()) return abs(f); 600 return bgcd( f, c ); 601 } 602 else if ( (f.inCoeffDomain() && c.inCoeffDomain()) || 603 (f.inCoeffDomain() && c.inBaseDomain()) || 604 (f.inBaseDomain() && c.inCoeffDomain())) 605 { 606 if (c.isZero()) return abs (f); 607 ZZX NTLf= convertFacCF2NTLZZX (f); 608 ZZX NTLc= convertFacCF2NTLZZX (c); 609 NTLc= GCD (NTLc, NTLf); 610 if (f.inCoeffDomain()) 611 return convertNTLZZX2CF(NTLc,f.mvar()); 612 else 613 return convertNTLZZX2CF(NTLc,c.mvar()); 614 } 615 else 616 { 617 CanonicalForm g = c; 618 for ( CFIterator i = f; i.hasTerms() && ! g.isOne(); i++ ) 619 g = myicontent( i.coeff(), g ); 620 return g; 621 } 622 } 623 #endif 624 625 CanonicalForm 626 myicontent ( const CanonicalForm & f ) 627 { 628 #ifdef HAVE_NTL 629 return myicontent( f, 0 ); 630 #else 631 return 1; 632 #endif 633 } 634 587 635 CanonicalForm QGCD( const CanonicalForm & F, const CanonicalForm & G ) 588 636 { // f,g in Q(a)[x1,...,xn] … … 612 660 f = F * bCommonDen(F); 613 661 g = G * bCommonDen(G); 662 CanonicalForm contf= myicontent (f); 663 CanonicalForm contg= myicontent (g); 664 f /= contf; 665 g /= contg; 666 CanonicalForm gcdcfcg= myicontent (contf, contg); 614 667 Variable a, b; 615 668 if(hasFirstAlgVar(f,a)) … … 627 680 Off( SW_RATIONAL ); 628 681 Off( SW_USE_QGCD ); 629 tmp = gcd ( F, G);682 tmp = gcdcfcg*gcd( f, g ); 630 683 On( SW_USE_QGCD ); 631 684 if (off_rational) Off(SW_RATIONAL); … … 682 735 if (off_rational) Off(SW_RATIONAL); else On(SW_RATIONAL); 683 736 setCharacteristic(0); 684 return CanonicalForm(1);737 return gcdcfcg; 685 738 } 686 739 setCharacteristic(0); … … 712 765 setReduce(a,true); 713 766 if (off_rational) Off(SW_RATIONAL); else On(SW_RATIONAL); 714 return tmp ;767 return tmp*gcdcfcg; 715 768 } 716 769 Off( SW_RATIONAL ); … … 729 782 setReduce(a,true); 730 783 Off( SW_USE_QGCD ); 731 D = gcd ( f, g );784 D = gcdcfcg*gcd( f, g ); 732 785 On( SW_USE_QGCD ); 733 786 if (off_rational) Off(SW_RATIONAL); else On(SW_RATIONAL);
Note: See TracChangeset
for help on using the changeset viewer.