Nemocas / Nemo.jl

Julia bindings for various mathematical libraries (including flint2)
http://nemocas.github.io/Nemo.jl/
Other
176 stars 57 forks source link

Implement is_squarefree for QQ/ZZPolyRingElem #1742

Open fingolfin opened 2 months ago

fingolfin commented 2 months ago

Cleaning out old branches; I made this last November, not sure why I never submitted. The new methods replace generic code, so this is purely about making things a bit faster.

Before:

julia> S, y = polynomial_ring(QQ, "y")
(Univariate polynomial ring in y over QQ, y)

julia> @btime is_squarefree(2*y^2)
  522.349 ns (14 allocations: 576 bytes)
false

After:

julia> S, y = polynomial_ring(QQ, "y")
(Univariate polynomial ring in y over QQ, y)

julia> @btime is_squarefree(2*y^2)
  151.743 ns (4 allocations: 176 bytes)
false
fingolfin commented 2 months ago

Aha. I guess the reason I did not submit it back then is that it runs into issue #1311 (which I completely forgot about), at least for ZZPolyRingElem (I am really glad we have these problematic cases covered by our test suite)