Changeset b53ff6 in git
- Timestamp:
- Aug 26, 2014, 11:19:16 AM (9 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 30e27f8a94644c552a6548c8b0d0b2026ceb2068
- Parents:
- 91695f2af09f5a3a05d6d8c4ee652802f6d85b68
- git-author:
- Martin Lee <martinlee84@web.de>2014-08-26 11:19:16+02:00
- git-committer:
- Martin Lee <martinlee84@web.de>2014-08-26 12:29:12+02:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/cfGcdUtil.cc
r91695f rb53ff6 14 14 #endif 15 15 16 /// coprimality check 16 /// Coprimality Check. f and g are assumed to have the same level. If swap is 17 /// true, the main variables of f and g are swapped with Variable(1). If the 18 /// result is false, d is set to the degree of the gcd of f and g evaluated at a 19 /// random point in K^n-1. This gcd is a gcd of univariate polynomials. 17 20 bool 18 21 gcd_test_one ( const CanonicalForm & f, const CanonicalForm & g, bool swap, int & d ) … … 217 220 } 218 221 222 /** 223 * same as balance_p ( const CanonicalForm & f, const CanonicalForm & q ) 224 * but qh= q/2 is provided, too. 225 **/ 226 CanonicalForm 227 balance_p ( const CanonicalForm & f, const CanonicalForm & q, const CanonicalForm & qh ) 228 { 229 Variable x = f.mvar(); 230 CanonicalForm result = 0; 231 CanonicalForm c; 232 CFIterator i; 233 for ( i = f; i.hasTerms(); i++ ) 234 { 235 c = i.coeff(); 236 if ( c.inCoeffDomain()) 237 { 238 if ( c > qh ) 239 result += power( x, i.exp() ) * (c - q); 240 else 241 result += power( x, i.exp() ) * c; 242 } 243 else 244 result += power( x, i.exp() ) * balance_p(c,q,qh); 245 } 246 return result; 247 } 248 219 249 /** static CanonicalForm balance_p ( const CanonicalForm & f, const CanonicalForm & q ) 220 250 * … … 227 257 **/ 228 258 CanonicalForm 229 balance_p ( const CanonicalForm & f, const CanonicalForm & q, const CanonicalForm & qh )230 {231 Variable x = f.mvar();232 CanonicalForm result = 0;233 CanonicalForm c;234 CFIterator i;235 for ( i = f; i.hasTerms(); i++ )236 {237 c = i.coeff();238 if ( c.inCoeffDomain())239 {240 if ( c > qh )241 result += power( x, i.exp() ) * (c - q);242 else243 result += power( x, i.exp() ) * c;244 }245 else246 result += power( x, i.exp() ) * balance_p(c,q,qh);247 }248 return result;249 }250 251 CanonicalForm252 259 balance_p ( const CanonicalForm & f, const CanonicalForm & q ) 253 260 {
Note: See TracChangeset
for help on using the changeset viewer.