| 3568 | } |
| 3569 | |
| 3570 | CanonicalForm sparseGCDFp (const CanonicalForm& F, const CanonicalForm& G, |
| 3571 | bool& topLevel, CFList& l) |
| 3572 | { |
| 3573 | CanonicalForm A= F; |
| 3574 | CanonicalForm B= G; |
| 3575 | if (F.isZero() && degree(G) > 0) return G/Lc(G); |
| 3576 | else if (G.isZero() && degree (F) > 0) return F/Lc(F); |
| 3577 | else if (F.isZero() && G.isZero()) return F.genOne(); |
| 3578 | if (F.inBaseDomain() || G.inBaseDomain()) return F.genOne(); |
| 3579 | if (F.isUnivariate() && fdivides(F, G)) return F/Lc(F); |
| 3580 | if (G.isUnivariate() && fdivides(G, F)) return G/Lc(G); |
| 3581 | if (F == G) return F/Lc(F); |
| 3582 | |
| 3583 | CFMap M,N; |
| 3584 | int best_level= myCompress (A, B, M, N, topLevel); |
| 3585 | |
| 3586 | if (best_level == 0) return B.genOne(); |
| 3587 | |
| 3588 | A= M(A); |
| 3589 | B= M(B); |
| 3590 | |
| 3591 | Variable x= Variable (1); |
| 3592 | |
| 3593 | //univariate case |
| 3594 | if (A.isUnivariate() && B.isUnivariate()) |
| 3595 | return N (gcd (A, B)); |
| 3596 | |
| 3597 | CanonicalForm cA, cB; // content of A and B |
| 3598 | CanonicalForm ppA, ppB; // primitive part of A and B |
| 3599 | CanonicalForm gcdcAcB; |
| 3600 | |
| 3601 | cA = uni_content (A); |
| 3602 | cB = uni_content (B); |
| 3603 | gcdcAcB= gcd (cA, cB); |
| 3604 | ppA= A/cA; |
| 3605 | ppB= B/cB; |
| 3606 | |
| 3607 | CanonicalForm lcA, lcB; // leading coefficients of A and B |
| 3608 | CanonicalForm gcdlcAlcB; |
| 3609 | lcA= uni_lcoeff (ppA); |
| 3610 | lcB= uni_lcoeff (ppB); |
| 3611 | |
| 3612 | if (fdivides (lcA, lcB)) |
| 3613 | { |
| 3614 | if (fdivides (A, B)) |
| 3615 | return F/Lc(F); |
| 3616 | } |
| 3617 | if (fdivides (lcB, lcA)) |
| 3618 | { |
| 3619 | if (fdivides (B, A)) |
| 3620 | return G/Lc(G); |
| 3621 | } |
| 3622 | |
| 3623 | gcdlcAlcB= gcd (lcA, lcB); |
| 3624 | |
| 3625 | int d= totaldegree (ppA, Variable (2), Variable (ppA.level())); |
| 3626 | int d0; |
| 3627 |
nothing calls this directly
no test coverage detected