@@ -25,23 +25,6 @@ function _change_ring(p::MPolyRingElem, R::MPolyRing)::MPolyRingElem
2525 return _map_exponent_vectors (v -> [i == 0 ? 0 : v[i] for i in indices], p, R)
2626end
2727
28- function _leading_coefficient (f:: QQMPolyRingElem , i:: Int ):: QQMPolyRingElem
29- e_max = 0
30- coeff_max = zero (parent (f))
31- for j in 1 : length (f)
32- e = exponent_vector (f, j)
33- if e[i] > e_max
34- e_max = e[i]
35- e[i] = 0
36- coeff_max = coeff (f, j) * prod (gens (parent (f)) .^ e)
37- elseif e[i] == e_max
38- e[i] = 0
39- coeff_max += coeff (f, j) * prod (gens (parent (f)) .^ e)
40- end
41- end
42- return coeff_max
43- end
44-
4528# TODO : remove this once the next version of Nemo is released
4629function _flint_discriminant (f:: QQMPolyRingElem , i:: Int ):: QQMPolyRingElem
4730 R = parent (f)
@@ -76,7 +59,7 @@ function discriminant(
7659 deg_f = total_degree (f)
7760 # not tight, but should be good enough in practice
7861 d = fill (deg_f * deg_f, length (gens (R′)))
79- lc = _leading_coefficient (f, i)
62+ lc = leading_coefficient (f, i)
8063 res = newton (R′, bb, d, non_vanishing_poly= lc, nr_thrds= nr_thrds, show_progress= show_progress, desc= desc)
8164 @assert total_degree (res) <= deg_f * deg_f - deg_f
8265 res = _change_ring (res, R)
@@ -105,7 +88,7 @@ function resultant(
10588 deg_g = total_degree (g)
10689 # not tight, but should be good enough in practice
10790 d = fill (deg_f * deg_g + 1 , length (gens (R′)))
108- lc = _leading_coefficient (f, i) * _leading_coefficient (g, i)
91+ lc = leading_coefficient (f, i) * leading_coefficient (g, i)
10992 res = newton (R′, bb, d, non_vanishing_poly= lc, nr_thrds= nr_thrds, show_progress= show_progress, desc= desc)
11093 @assert total_degree (res) <= deg_f * deg_g
11194 res = _change_ring (res, R)
0 commit comments