| 472 | |
| 473 | |
| 474 | Integer binomial::head_reductions_by(const binomial& b) const |
| 475 | // Returns the number of possible reductions of the actual binomial´s head |
| 476 | // by the binomial b. This is the minimum of the quotients |
| 477 | // exponent_vector[i]/b.exponent_vector[i] |
| 478 | // where exponent_vector[i]>0 and b.exponent_vector[i]>0 |
| 479 | // (0 if there are no such quotients). |
| 480 | // A negative return value means b=0 or head(b)=1. |
| 481 | { |
| 482 | |
| 483 | |
| 484 | #ifdef NO_SUPPORT_DRIVEN_METHODS |
| 485 | |
| 486 | Integer result=-1; |
| 487 | Integer new_result=-1; |
| 488 | // -1 stands for infinitely many reductions |
| 489 | |
| 490 | for(short i=0;i<_number_of_variables;i++) |
| 491 | // explicit sign tests for all components |
| 492 | { |
| 493 | Integer actual_b_component=b.exponent_vector[i]; |
| 494 | |
| 495 | if(actual_b_component>0) |
| 496 | // else variable i is not involved in the head of b |
| 497 | { |
| 498 | Integer actual_component=exponent_vector[i]; |
| 499 | |
| 500 | if(actual_component<actual_b_component) |
| 501 | return 0; |
| 502 | |
| 503 | new_result=(Integer) (actual_component/actual_b_component); |
| 504 | |
| 505 | // new_result>=1 |
| 506 | if((new_result<result) || (result==-1)) |
| 507 | // new (or first) minimum |
| 508 | result=new_result; |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | #endif // NO_SUPPORT_DRIVEN_METHODS |
| 513 | |
| 514 | |
| 515 | #ifdef SUPPORT_DRIVEN_METHODS |
| 516 | |
| 517 | if((head_support&b.head_support)!=b.head_support) |
| 518 | // head support of b not contained in head support, no reduction possible |
| 519 | return 0; |
| 520 | |
| 521 | |
| 522 | Integer result=-1; |
| 523 | Integer new_result=-1; |
| 524 | // -1 stands for infinitely many reductions |
| 525 | |
| 526 | |
| 527 | short size_of_support_vectors=CHAR_BIT*sizeof(long); |
| 528 | // number of bits of a long int |
| 529 | if(size_of_support_vectors>_number_of_variables) |
| 530 | size_of_support_vectors=_number_of_variables; |
| 531 | // number of components of the support vectors |