| 1082 | |
| 1083 | |
| 1084 | BOOLEAN relatively_prime(const binomial& a, const binomial& b) |
| 1085 | { |
| 1086 | |
| 1087 | #ifdef NO_SUPPORT_DRIVEN_METHODS |
| 1088 | |
| 1089 | // look at all variables |
| 1090 | for(short i=0;i<a._number_of_variables;i++) |
| 1091 | if((a.exponent_vector[i]>0) && (b.exponent_vector[i]>0)) |
| 1092 | return FALSE; |
| 1093 | |
| 1094 | return TRUE; |
| 1095 | |
| 1096 | #endif // NO_SUPPORT_DRIVEN_METHODS |
| 1097 | |
| 1098 | |
| 1099 | #ifdef SUPPORT_DRIVEN_METHODS |
| 1100 | |
| 1101 | if((a.head_support & b.head_support)!=0) |
| 1102 | // common support variable in the heads |
| 1103 | return FALSE; |
| 1104 | |
| 1105 | // no common support variable in the heads, look at remaining variables |
| 1106 | short size_of_support_vectors=CHAR_BIT*sizeof(unsigned long); |
| 1107 | |
| 1108 | |
| 1109 | #ifdef SUPPORT_VARIABLES_FIRST |
| 1110 | |
| 1111 | for(short i=size_of_support_vectors;i<a._number_of_variables;i++) |
| 1112 | if((a.exponent_vector[i]>0) && (b.exponent_vector[i]>0)) |
| 1113 | return FALSE; |
| 1114 | |
| 1115 | return TRUE; |
| 1116 | |
| 1117 | #endif // SUPPORT_VARIABLES_FIRST |
| 1118 | |
| 1119 | |
| 1120 | #ifdef SUPPORT_VARIABLES_LAST |
| 1121 | |
| 1122 | for(short i=a._number_of_variables-1-size_of_support_vectors;i>=0;i--) |
| 1123 | if((a.exponent_vector[i]>0) && (b.exponent_vector[i]>0)) |
| 1124 | return FALSE; |
| 1125 | |
| 1126 | return TRUE; |
| 1127 | |
| 1128 | #endif // SUPPORT_VARIABLES_LAST |
| 1129 | |
| 1130 | |
| 1131 | #endif // SUPPORT_DRIVEN_METHODS |
| 1132 | |
| 1133 | } |
| 1134 | |
| 1135 | |
| 1136 | |