Changeset 486864 in git
 Timestamp:
 Mar 7, 2014, 3:58:07 PM (10 years ago)
 Branches:
 (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
 Children:
 dbcaa4dc36f3331ba9316e072d2c4c61347c0957
 Parents:
 36914e05c0ccbede3cb5e25cf2aec8fb52db5905
 gitauthor:
 Martin Lee <martinlee84@web.de>20140307 15:58:07+01:00
 gitcommitter:
 Hans Schoenemann <hannes@mathematik.unikl.de>20140317 18:31:54+01:00
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

factory/libfac/charset/alg_factor.cc
r36914e r486864 517 517 numt= t1; 518 518 return pi; 519 } 520 521 CanonicalForm 522 evaluate (const CanonicalForm& f, const CanonicalForm& g, const CanonicalForm& h, const CanonicalForm& powH) 523 { 524 if (f.inCoeffDomain()) 525 return f; 526 CFIterator i= f; 527 int lastExp = i.exp(); 528 CanonicalForm result = i.coeff()*powH; 529 i++; 530 while (i.hasTerms()) 531 { 532 int i_exp= i.exp(); 533 if ((lastExp  i_exp) == 1) 534 { 535 result *= g; 536 result /= h; 537 } 538 else 539 { 540 result *= power (g, lastExp  i_exp); 541 result /= power (h, lastExp  i_exp); 542 } 543 result += i.coeff()*powH; 544 lastExp = i_exp; 545 i++; 546 } 547 if (lastExp != 0) 548 { 549 result *= power (g, lastExp); 550 result /= power (h, lastExp); 551 } 552 return result; 553 } 554 555 556 /// evaluate f at g/h at v such that powH*f is integral i.e. powH is assumed to be h^degree(f,v) 557 CanonicalForm 558 evaluate (const CanonicalForm& f, const CanonicalForm& g, 559 const CanonicalForm& h, const CanonicalForm& powH, 560 const Variable& v) 561 { 562 if (f.inCoeffDomain()) 563 { 564 return f*powH; 565 } 566 567 Variable x = f.mvar(); 568 if ( v > x ) 569 return f*powH; 570 else if ( v == x ) 571 return evaluate (f, g, h, powH); 572 573 // v is less than main variable of f 574 CanonicalForm result= 0; 575 for (CFIterator i= f; i.hasTerms(); i++) 576 result += evaluate (i.coeff(), g, h, powH, v)*power (x, i.exp()); 577 return result; 519 578 } 520 579
Note: See TracChangeset
for help on using the changeset viewer.