recombine bivariate factors in case one bivariate factorization yields less factors than the other
| 2111 | //recombine bivariate factors in case one bivariate factorization yields less |
| 2112 | // factors than the other |
| 2113 | CFList |
| 2114 | recombination (const CFList& factors1, const CFList& factors2, int s, int thres, |
| 2115 | const CanonicalForm& evalPoint, const Variable& x) |
| 2116 | { |
| 2117 | CFList T, S; |
| 2118 | |
| 2119 | T= factors1; |
| 2120 | CFList result; |
| 2121 | CanonicalForm buf; |
| 2122 | int * v= new int [T.length()]; |
| 2123 | for (int i= 0; i < T.length(); i++) |
| 2124 | v[i]= 0; |
| 2125 | bool nosubset= false; |
| 2126 | CFArray TT; |
| 2127 | TT= copy (factors1); |
| 2128 | int recombinations= 0; |
| 2129 | while (T.length() >= 2*s && s <= thres) |
| 2130 | { |
| 2131 | while (nosubset == false) |
| 2132 | { |
| 2133 | if (T.length() == s) |
| 2134 | { |
| 2135 | delete [] v; |
| 2136 | if (recombinations == factors2.length() - 1) |
| 2137 | result.append (prod (T)); |
| 2138 | else |
| 2139 | result= Union (result, T); |
| 2140 | return result; |
| 2141 | } |
| 2142 | S= subset (v, s, TT, nosubset); |
| 2143 | if (nosubset) break; |
| 2144 | buf= prodEval (S, evalPoint, x); |
| 2145 | buf /= Lc (buf); |
| 2146 | if (find (factors2, buf)) |
| 2147 | { |
| 2148 | recombinations++; |
| 2149 | T= Difference (T, S); |
| 2150 | result.append (prod (S)); |
| 2151 | TT= copy (T); |
| 2152 | indexUpdate (v, s, T.length(), nosubset); |
| 2153 | if (nosubset) break; |
| 2154 | } |
| 2155 | } |
| 2156 | s++; |
| 2157 | if (T.length() < 2*s || T.length() == s) |
| 2158 | { |
| 2159 | if (recombinations == factors2.length() - 1) |
| 2160 | result.append (prod (T)); |
| 2161 | else |
| 2162 | result= Union (result, T); |
| 2163 | delete [] v; |
| 2164 | return result; |
| 2165 | } |
| 2166 | for (int i= 0; i < T.length(); i++) |
| 2167 | v[i]= 0; |
| 2168 | nosubset= false; |
| 2169 | } |
| 2170 |
no test coverage detected