Changeset c6eecb in git for factory/cf_gcd.cc
- Timestamp:
- Apr 26, 2007, 10:22:48 AM (16 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 8251cc1c81aab678de3aec185a8de7969e825393
- Parents:
- cb637fad8051814719a0ea36ed4b65a20f1114cc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/cf_gcd.cc
rcb637f rc6eecb 1 1 /* emacs edit mode for this file is -*- C++ -*- */ 2 /* $Id: cf_gcd.cc,v 1.4 8 2006-09-25 12:33:11Singular Exp $ */2 /* $Id: cf_gcd.cc,v 1.49 2007-04-26 08:22:48 Singular Exp $ */ 3 3 4 4 #include <config.h> … … 125 125 && isPurePoly(f) && isPurePoly(g)) 126 126 { 127 zz_pContext ccc(getCharacteristic()); 128 ccc.restore(); 129 zz_p::init(getCharacteristic()); 127 if (fac_NTL_char!=getCharacteristic()) 128 { 129 fac_NTL_char=getCharacteristic(); 130 #ifdef NTL_ZZ 131 ZZ r; 132 r=getCharacteristic(); 133 ZZ_pContext ccc(r); 134 #else 135 zz_pContext ccc(getCharacteristic()); 136 #endif 137 ccc.restore(); 138 #ifdef NTL_ZZ 139 ZZ_p::init(r); 140 #else 141 zz_p::init(getCharacteristic()); 142 #endif 143 } 144 #ifdef NTL_ZZ 145 ZZ_pX F1=convertFacCF2NTLZZpX(f); 146 ZZ_pX G1=convertFacCF2NTLZZpX(g); 147 ZZ_pX R; 148 ZZ_pX A,B; 149 XGCD(R,A,B,F1,G1); 150 a=convertNTLZZpX2CF(A,f.mvar()); 151 b=convertNTLZZpX2CF(B,f.mvar()); 152 return convertNTLZZpX2CF(R,f.mvar()); 153 #else 130 154 zz_pX F1=convertFacCF2NTLzzpX(f); 131 155 zz_pX G1=convertFacCF2NTLzzpX(g); … … 136 160 b=convertNTLzzpX2CF(B,f.mvar()); 137 161 return convertNTLzzpX2CF(R,f.mvar()); 162 #endif 138 163 } 139 164 #endif … … 144 169 CanonicalForm f0 = 1, f1 = 0, g0 = 0, g1 = 1, q, r; 145 170 146 while ( ! p1.isZero() ) { 171 while ( ! p1.isZero() ) 172 { 147 173 divrem( p0, p1, q, r ); 148 174 p0 = p1; p1 = r; … … 156 182 b = g0 / ( contg * contp0 ); 157 183 p0 /= contp0; 158 if ( p0.sign() < 0 ) { 184 if ( p0.sign() < 0 ) 185 { 159 186 p0 = -p0; 160 187 a = -a; … … 696 723 gcd_univar_ntlp( const CanonicalForm & F, const CanonicalForm & G ) 697 724 { 725 if (fac_NTL_char!=getCharacteristic()) 726 { 727 fac_NTL_char=getCharacteristic(); 728 #ifdef NTL_ZZ 729 ZZ r; 730 r=getCharacteristic(); 731 ZZ_pContext ccc(r); 732 #else 698 733 zz_pContext ccc(getCharacteristic()); 734 #endif 699 735 ccc.restore(); 736 #ifdef NTL_ZZ 737 ZZ_p::init(r); 738 #else 700 739 zz_p::init(getCharacteristic()); 701 zz_pX F1=convertFacCF2NTLzzpX(F); 702 zz_pX G1=convertFacCF2NTLzzpX(G); 703 zz_pX R=GCD(F1,G1); 704 return convertNTLzzpX2CF(R,F.mvar()); 740 #endif 741 } 742 #ifdef NTL_ZZ 743 ZZ_pX F1=convertFacCF2NTLZZpX(F); 744 ZZ_pX G1=convertFacCF2NTLZZpX(G); 745 ZZ_pX R=GCD(F1,G1); 746 return convertNTLZZpX2CF(R,F.mvar()); 747 #else 748 zz_pX F1=convertFacCF2NTLzzpX(F); 749 zz_pX G1=convertFacCF2NTLzzpX(G); 750 zz_pX R=GCD(F1,G1); 751 return convertNTLzzpX2CF(R,F.mvar()); 752 #endif 705 753 } 706 754
Note: See TracChangeset
for help on using the changeset viewer.