Changeset 7b4bfe6 in git
- Timestamp:
- Jul 8, 1996, 10:22:02 AM (27 years ago)
- Branches:
- (u'spielwiese', '873fc1222e995d7cb33f79d8f1792ce418c8c72c')
- Children:
- db4770670387300daebce8262e6dddb3e3ba4b7f
- Parents:
- f63dbca24fdad0fc65e8496a781d6830dafded8e
- Location:
- factory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/fac_util.cc
rf63dbca r7b4bfe6 1 1 // emacs edit mode for this file is -*- C++ -*- 2 // $Id: fac_util.cc,v 1. 1 1996-06-27 11:34:24stobbe Exp $2 // $Id: fac_util.cc,v 1.2 1996-07-08 08:22:02 stobbe Exp $ 3 3 4 4 /* 5 5 $Log: not supported by cvs2svn $ 6 Revision 1.1 1996/06/27 11:34:24 stobbe 7 "New function dviremainder. 8 " 9 6 10 Revision 1.0 1996/05/17 10:59:46 stobbe 7 11 Initial revision … … 11 15 #include "assert.h" 12 16 #include "cf_defs.h" 17 #include "canonicalform.h" 18 #include "cf_iter.h" 13 19 #include "fac_util.h" 14 20 … … 144 150 145 151 CanonicalForm 152 maxCoeff( const CanonicalForm & f ) 153 { 154 if ( f.inCoeffDomain() ) 155 return abs( f ); 156 else { 157 CanonicalForm M = 0, m; 158 for ( CFIterator i = f; i.hasTerms(); i++ ) 159 if ( (m = maxCoeff( i.coeff() )) > M ) 160 M = m; 161 return M; 162 } 163 } 164 165 166 CanonicalForm 146 167 mappksymmetric ( const CanonicalForm & f ) 147 168 { … … 158 179 return mod( f, PK ); 159 180 } 181 182 void 183 extgcd ( const CanonicalForm & a, const CanonicalForm & b, CanonicalForm & S, CanonicalForm & T, const modpk & pk ) 184 { 185 int p = pk.getp(), k = pk.getk(), j; 186 CanonicalForm amodp, bmodp, smodp, tmodp, s, t, sigma, tau, e; 187 CanonicalForm modulus = p, sigmat, taut, q; 188 189 setCharacteristic( p ); 190 { 191 amodp = mapinto( a ); bmodp = mapinto( b ); 192 (void)extgcd( amodp, bmodp, smodp, tmodp ); 193 } 194 setCharacteristic( 0 ); 195 s = mapinto( smodp ); t = mapinto( tmodp ); 196 197 for ( j = 1; j < k; j++ ) { 198 e = ( 1 - s * a - t * b ) / modulus; 199 setCharacteristic( p ); 200 { 201 e = mapinto( e ); 202 sigmat = smodp * e; 203 taut = tmodp * e; 204 divrem( sigmat, bmodp, q, sigma ); 205 tau = taut + q * amodp; 206 } 207 setCharacteristic( 0 ); 208 s += mapinto( sigma ) * modulus; 209 t += mapinto( tau ) * modulus; 210 modulus *= p; 211 } 212 S = s; T = t; 213 } 214 -
factory/fac_util.h
rf63dbca r7b4bfe6 1 1 // emacs edit mode for this file is -*- C++ -*- 2 // $Id: fac_util.h,v 1. 1 1996-06-27 11:34:25stobbe Exp $2 // $Id: fac_util.h,v 1.2 1996-07-08 08:22:02 stobbe Exp $ 3 3 4 4 #ifndef INCL_FAC_UTIL_H … … 7 7 /* 8 8 $Log: not supported by cvs2svn $ 9 Revision 1.1 1996/06/27 11:34:25 stobbe 10 "New function dviremainder. 11 " 12 9 13 Revision 1.0 1996/05/17 10:59:40 stobbe 10 14 Initial revision … … 13 17 14 18 #include "canonicalform.h" 19 #include "cf_eval.h" 15 20 16 21 /*BEGINPUBLIC*/ … … 43 48 void divremainder( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & quot, CanonicalForm & rem, const modpk & pk ); 44 49 50 CanonicalForm maxCoeff( const CanonicalForm & f ); 51 52 bool Hensel ( const CanonicalForm & U, CFArray & G, const CFArray & lcG, const Evaluation & A, const modpk & bound, const Variable & x ); 53 45 54 /*ENDPUBLIC*/ 46 55 56 bool gcd_test_one ( const CanonicalForm & f, const CanonicalForm & g, bool swap ); 57 58 CanonicalForm ezgcd ( const CanonicalForm & f, const CanonicalForm & g ); 59 60 void extgcd ( const CanonicalForm & a, const CanonicalForm & b, CanonicalForm & S, CanonicalForm & T, const modpk & pk ); 61 47 62 #endif /* INCL_FAC_UTIL_H */
Note: See TracChangeset
for help on using the changeset viewer.