163{
164 int j=
A.level() - 1;
166
167
169 for (
i= 0;
i <
j;
i++)
171
178 for (
i= 1;
i <
j;
i++)
179 {
182 }
183
184
189 for (
i=
j - 1;
i > 0;
i--)
190 {
192 {
197 );
198 }
200 eval[
i], uniFactors);
201 }
202
204 tmp=
normalize (biFactors, normalizingFactors[0]);
208 for (
i=
j - 1;
i > 0;
i--)
209 {
210 tmp=
normalize (moreBiFactors [
i-1], normalizingFactors [
i]);
214 }
215
216
217 int k,
l,
m, mm,
count, sizeOfUniFactors= 0;
218 int*** seperator=
new int** [
j];
220
221 for (
i= 0;
i <
j;
i++)
224 {
225 for (
i= 0;
i <
j;
i++)
226 {
228 for (
l= 0;
l < storeFactors [
i][0][
k].
size() - 1;
l++)
229 {
233 }
235 sizeOfUniFactors=
count;
236 else if (sizeOfUniFactors !=
count)
237 {
238 for (
m= 0;
m <
j;
m++)
239 {
240 delete [] storeFactors [
m] [0];
241 delete [] storeFactors [
m] [1];
242 delete [] storeFactors [
m];
243 for (mm= 0; mm <
k; mm++)
244 delete [] seperator [
m][mm];
245 delete [] seperator [
m];
246 }
247 delete [] storeFactors;
248 delete [] seperator;
249 delete [] normalizingFactors;
251 }
252 seperator [
i][
k]=
new int [
count + 3];
253 seperator [
i][
k][0]=
count + 1;
254 seperator [
i][
k][1]= 0;
256 for (
l= 0;
l < storeFactors [
i][0][
k].
size() - 1;
l++)
257 {
260 {
263 }
264 }
266 }
267 }
268
272 int maxTerms, n, index1, index2, mmm,
found, columns, oneCount;
273 int ** mat;
274
276 {
278 sizeOfUniFactors= seperator [0][
k][0];
279 for (n= 1; n <= sizeOfUniFactors; n++)
280 {
281 columns= 0;
282 maxTerms= 1;
284 for (
i=
j - 1;
i >= 0;
i--)
285 {
286 if (maxTerms < seperator[
i][
k][n+1]-seperator[
i][
k][n])
287 {
288 maxTerms= seperator[
i][
k][n + 1]-seperator[
i][
k][n];
290 }
291 }
292 for (
i=
j - 1;
i >= 0;
i--)
293 {
295 continue;
296 columns += seperator [
i][
k][n+1]-seperator[
i][
k][n];
297 }
298 mat= new int *[maxTerms];
299 mm= 0;
300 for (
m= seperator[index1][
k][n];
m < seperator[index1][
k][n+1];
m++, mm++)
301 {
302 tmp1= storeFactors [index1][1][
k][
m];
303 mat[mm]= new int [columns];
304 for (
i= 0;
i < columns;
i++)
306 index2= 0;
307 for (
i=
j - 1;
i >= 0;
i--)
308 {
310 continue;
313 seperator[
i][
k][n], seperator[
i][
k][n+1])) >= 0)
314 mat[mm][index2 +
found - seperator [
i][
k][n]]= 1;
315 index2 += seperator [
i][
k][n+1]-seperator[
i][
k][n];
316 }
317 }
318
319 index2= 0;
320 for (
i=
j - 1;
i >= 0;
i--)
321 {
323 continue;
324 oneCount= 0;
325 for (mm= 0; mm < seperator [
i][
k][n + 1] - seperator [
i][
k][n]; mm++)
326 {
327 for (
m= 0;
m < maxTerms;
m++)
328 {
329 if (mat[
m][mm+index2] == 1)
330 oneCount++;
331 }
332 }
333 if (oneCount == seperator [
i][
k][n+1]-seperator[
i][
k][n] - 1)
334 {
335 for (mm= 0; mm < seperator [
i][
k][n+1]-seperator[
i][
k][n]; mm++)
336 {
337 oneCount= 0;
338 for (
m= 0;
m < maxTerms;
m++)
339 if (mat[
m][mm+index2] == 1)
340 oneCount++;
341 if (oneCount > 0)
342 continue;
343 for (
m= 0;
m < maxTerms;
m++)
344 {
345 oneCount= 0;
346 for (mmm= 0; mmm < seperator[
i][
k][n+1]-seperator[
i][
k][n]; mmm++)
347 {
348 if (mat[
m][mmm+index2] == 1)
349 oneCount++;
350 }
351 if (oneCount > 0)
352 continue;
353 mat[
m][mm+index2]= 1;
354 }
355 }
356 }
357 index2 += seperator [
i][
k][n+1] - seperator [
i][
k][n];
358 }
359
360
361 mm= 0;
362 for (
m= seperator[index1][
k][n];
m < seperator[index1][
k][n+1];
m++, mm++)
363 {
364 tmp1= storeFactors [index1][0][
k][
m];
365 index2= 0;
366 for (
i=
j - 1;
i > -1;
i--)
367 {
369 continue;
370 for (mmm= 0; mmm < seperator [
i][
k][n+1]-seperator[
i][
k][n]; mmm++)
371 if (mat[mm][mmm+index2] == 1)
374 index2 += seperator [
i][
k][n+1]-seperator[
i][
k][n];
375 }
377 }
378
379 for (
m= 0;
m < maxTerms;
m++)
381 delete [] mat;
382 }
383
385 {
389 {
391 break;
392 }
393 }
394 }
395
396
397 for (
i= 0;
i <
j;
i++)
398 {
399 delete [] storeFactors [
i] [0];
400 delete [] storeFactors [
i] [1];
401 delete [] storeFactors [
i];
403 delete [] seperator [
i][
k];
404 delete [] seperator [
i];
405 }
406 delete [] seperator;
407 delete [] storeFactors;
408 delete [] normalizingFactors;
409
410
412}
bool fdivides(const CanonicalForm &f, const CanonicalForm &g)
bool fdivides ( const CanonicalForm & f, const CanonicalForm & g )
const CanonicalForm int const CFList & evaluation
CFList int & minFactorsLength
[in,out] minimal length of bivariate factors
CFList recombination(const CFList &factors1, const CFList &factors2, int s, int thres, const CanonicalForm &evalPoint, const Variable &x)
recombination of bivariate factors factors1 s. t. the result evaluated at evalPoint coincides with fa...
CFArray getTerms2(const CanonicalForm &F)
get terms of F wrt. Variable (1)
CFList findNormalizingFactor1(const CFList &biFactors, const CanonicalForm &evalPoint, CFList &uniFactors)
find normalizing factors for biFactors and build monic univariate factors from biFactors
CFList findNormalizingFactor2(CFList &biFactors, const CanonicalForm &evalPoint, const CFList &uniFactors)
find normalizing factors for biFactors and sort biFactors s.t. the returned biFactors evaluated at ev...
int search(const CFArray &A, const CanonicalForm &F, int i, int j)
search for F in A between index i and j
CanonicalForm patch(const CanonicalForm &F1, const CanonicalForm &F2, const CanonicalForm &eval)
patch together F1 and F2 and normalize by a power of eval F1 and F2 are assumed to be bivariate with ...
static BOOLEAN length(leftv result, leftv arg)
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)