| 902 | |
| 903 | |
| 904 | int binomial::reduce_tail_by(const binomial& b, const term_ordering& w) |
| 905 | { |
| 906 | Integer reduction_number=tail_reductions_by(b); |
| 907 | if(reduction_number<=0) |
| 908 | return 0; |
| 909 | |
| 910 | for(short i=0;i<_number_of_variables;i++) |
| 911 | exponent_vector[i]+=(reduction_number * b.exponent_vector[i]); |
| 912 | // multiple reduction |
| 913 | // reduction corresponds to addition of vectors |
| 914 | |
| 915 | // a tail reduction does not require a sign check |
| 916 | |
| 917 | |
| 918 | #ifdef SUPPORT_DRIVEN_METHODS |
| 919 | |
| 920 | head_support=0; |
| 921 | tail_support=0; |
| 922 | |
| 923 | short size_of_support_vectors=CHAR_BIT*sizeof(unsigned long); |
| 924 | |
| 925 | |
| 926 | // recompute the support vectors |
| 927 | |
| 928 | #ifdef SUPPORT_VARIABLES_FIRST |
| 929 | |
| 930 | for(short i=0;i<_number_of_variables;i++) |
| 931 | { |
| 932 | |
| 933 | Integer& actual_entry=exponent_vector[i]; |
| 934 | // to avoid unnecessary pointer arithmetic |
| 935 | |
| 936 | if(i<size_of_support_vectors) |
| 937 | { |
| 938 | if(actual_entry>0) |
| 939 | head_support|=(1<<i); |
| 940 | else if(actual_entry<0) |
| 941 | tail_support|=(1<<i); |
| 942 | } |
| 943 | } |
| 944 | |
| 945 | #endif // SUPPORT_VARIABLES_FIRST |
| 946 | |
| 947 | |
| 948 | #ifdef SUPPORT_VARIABLES_LAST |
| 949 | |
| 950 | for(short i=0;i<_number_of_variables;i++) |
| 951 | { |
| 952 | Integer& actual_entry=exponent_vector[_number_of_variables-1-i]; |
| 953 | // to avoid unnecessary pointer arithmetic |
| 954 | |
| 955 | if(i<size_of_support_vectors) |
| 956 | { |
| 957 | if(actual_entry>0) |
| 958 | head_support|=(1<<i); |
| 959 | else if(actual_entry<0) |
| 960 | tail_support|=(1<<i); |
| 961 | } |