Changeset e2e4be in git
 Timestamp:
 Nov 15, 2012, 2:18:16 PM (10 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
 Children:
 a0adc352c26b5251da621e2cb0af660bff3364a5
 Parents:
 a64b0ebe60fbdf0eb713f74e6e4932492b5058b3
 gitauthor:
 Martin Lee <martinlee84@web.de>20121115 14:18:16+01:00
 gitcommitter:
 Martin Lee <martinlee84@web.de>20121116 13:13:24+01:00
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

factory/cf_gcd.cc
ra64b0e re2e4be 463 463 //}}} 464 464 465 //{{{ static CanonicalForm balance ( const CanonicalForm & f, const CanonicalForm & q )465 //{{{ static CanonicalForm balance_p ( const CanonicalForm & f, const CanonicalForm & q ) 466 466 //{{{ docu 467 467 // 468 // balance ()  map f from positive to symmetric representation468 // balance_p()  map f from positive to symmetric representation 469 469 // mod q. 470 470 // … … 476 476 //}}} 477 477 static CanonicalForm 478 balance_p ( const CanonicalForm & f, const CanonicalForm & q ) 479 { 480 Variable x = f.mvar(); 481 CanonicalForm result = 0, qh = q / 2; 482 CanonicalForm c; 483 CFIterator i; 484 for ( i = f; i.hasTerms(); i++ ) 485 { 486 c = i.coeff(); 487 if ( c.inCoeffDomain()) 488 { 489 if ( c > qh ) 490 result += power( x, i.exp() ) * (c  q); 491 else 492 result += power( x, i.exp() ) * c; 493 } 494 else 495 result += power( x, i.exp() ) * balance_p(c,q); 496 } 497 return result; 498 } 499 500 /*static CanonicalForm 478 501 balance ( const CanonicalForm & f, const CanonicalForm & q ) 479 502 { … … 490 513 } 491 514 return result; 492 } 515 }*/ 493 516 //}}} 494 517 … … 566 589 { 567 590 // now balance D mod q 568 D = pp( balance ( D, q ) );591 D = pp( balance_p( D, q ) ); 569 592 if ( fdivides( D, f ) && fdivides( D, g ) ) 570 593 return D * c; … … 1204 1227 delete [] degsg; 1205 1228 }*/ 1206 1207 1208 static CanonicalForm1209 balance_p ( const CanonicalForm & f, const CanonicalForm & q )1210 {1211 Variable x = f.mvar();1212 CanonicalForm result = 0, qh = q / 2;1213 CanonicalForm c;1214 CFIterator i;1215 for ( i = f; i.hasTerms(); i++ )1216 {1217 c = i.coeff();1218 if ( c.inCoeffDomain())1219 {1220 if ( c > qh )1221 result += power( x, i.exp() ) * (c  q);1222 else1223 result += power( x, i.exp() ) * c;1224 }1225 else1226 result += power( x, i.exp() ) * balance_p(c,q);1227 }1228 return result;1229 }1230 1229 1231 1230 TIMING_DEFINE_PRINT(chinrem_termination)
Note: See TracChangeset
for help on using the changeset viewer.