Skip to content

Commit

Permalink
remove euclidtools mods
Browse files Browse the repository at this point in the history
  • Loading branch information
smichr committed Sep 30, 2024
1 parent d480b40 commit 64a53d3
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions sympy/polys/euclidtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1880,35 +1880,18 @@ def dmp_cancel(f, g, u, K, include=True):

cq, f = dmp_clear_denoms(f, u, K0, K, convert=True)
cp, g = dmp_clear_denoms(g, u, K0, K, convert=True)

else:
cp, cq = K.one, K.one

_, p, q = dmp_inner_gcd(f, g, u, K)

domul = True
if K0 is not None:
_, _cp, _cq = K.cofactors(cp, cq)
_, cp, cq = K.cofactors(cp, cq)

p = dmp_convert(p, u, K, K0)
q = dmp_convert(q, u, K, K0)
if (_cp, _cq) != (1,1) and 1 in (_cp, _cq) and 'QQ' in str(K0) and str(K) == 'ZZ': # XXX what's the better way to test for this situation?
domul=False
def zz(l, c):
from mpmath.libmp import MPZ
rv = []
for i in l:
if type(i) is list:
rv.append(zz(i))
else:
rv.append(MPZ(i*c))
return rv
p = zz(p, _cp)
q = zz(q, _cq)
cp = cq = 1
else:
cp, cq = _cp, _cq
K = K0

K = K0

p_neg = K.is_negative(dmp_ground_LC(p, u, K))
q_neg = K.is_negative(dmp_ground_LC(q, u, K))
Expand All @@ -1923,7 +1906,7 @@ def zz(l, c):
if not include:
return cp, cq, p, q

if domul:
p = dmp_mul_ground(p, cp, u, K)
q = dmp_mul_ground(q, cq, u, K)
p = dmp_mul_ground(p, cp, u, K)
q = dmp_mul_ground(q, cq, u, K)

return p, q

0 comments on commit 64a53d3

Please sign in to comment.