| 812 | |
| 813 | |
| 814 | int binomial::reduce_head_by(const binomial& b, const term_ordering& w) |
| 815 | { |
| 816 | Integer reduction_number=head_reductions_by(b); |
| 817 | if(reduction_number<=0) |
| 818 | return 0; |
| 819 | |
| 820 | for(short i=0;i<_number_of_variables;i++) |
| 821 | exponent_vector[i]-=(reduction_number * b.exponent_vector[i]); |
| 822 | // multiple reduction |
| 823 | // reduction corresponds to subtraction of vectors |
| 824 | |
| 825 | short sign=w.compare_to_zero(exponent_vector); |
| 826 | |
| 827 | |
| 828 | #ifdef NO_SUPPORT_DRIVEN_METHODS |
| 829 | |
| 830 | if(sign==0) |
| 831 | // binomial reduced to zero |
| 832 | return 2; |
| 833 | |
| 834 | for(short i=0;i<_number_of_variables;i++) |
| 835 | exponent_vector[i]*=sign; |
| 836 | |
| 837 | #endif // NO_SUPPORT_DRIVEN_METHODS |
| 838 | |
| 839 | |
| 840 | #ifdef SUPPORT_DRIVEN_METHODS |
| 841 | |
| 842 | head_support=0; |
| 843 | tail_support=0; |
| 844 | |
| 845 | if(sign==0) |
| 846 | // binomial reduced to zero |
| 847 | return 2; |
| 848 | |
| 849 | short size_of_support_vectors=CHAR_BIT*sizeof(unsigned long); |
| 850 | |
| 851 | |
| 852 | // recompute the support vectors |
| 853 | |
| 854 | #ifdef SUPPORT_VARIABLES_FIRST |
| 855 | |
| 856 | for(short i=0;i<_number_of_variables;i++) |
| 857 | { |
| 858 | |
| 859 | Integer& actual_entry=exponent_vector[i]; |
| 860 | // to avoid unnecessary pointer arithmetic |
| 861 | |
| 862 | actual_entry*=sign; |
| 863 | |
| 864 | if(i<size_of_support_vectors) |
| 865 | if(actual_entry>0) |
| 866 | head_support|=(1<<i); |
| 867 | else |
| 868 | if(actual_entry<0) |
| 869 | tail_support|=(1<<i); |
| 870 | } |
| 871 |
no test coverage detected