Skip to content

Commit

Permalink
fix: simplify for non-monic input (#1492)
Browse files Browse the repository at this point in the history
- simplify(...; canonical = true) relies on
  simplify(...; canonical =  false) returning a nice defining
  polynomial (nice = monic and integral coefficients)
- Closes #1490
  • Loading branch information
thofma authored May 4, 2024
1 parent ff4e058 commit 38b1099
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/NumField/NfAbs/Simplify.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function simplify(K::AbsSimpleNumField; canonical::Bool = false, cached::Bool =
OK.lllO = ZK
end
@vtime :Simplify 3 a = _simplify(ZK)
if a == gen(K)
if a == gen(K) && is_monic(K.pol) # K.pol is minpoly of a
f = K.pol
else
@vtime :Simplify 3 f = Qx(minpoly(representation_matrix(OK(a))))
Expand Down
6 changes: 6 additions & 0 deletions test/NfAbs/Simplify.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,10 @@
K, a = number_field(f, cached = false)
_, g = Hecke.polredabs(K)
@test g == f

f = -x^3 - 14*x^2 - 13*x + 6
K, a = number_field(f, cached = false)
L, _ = simplify(K)
g = defining_polynomial(L)
@test is_monic(g) && is_one(denominator(g))
end

0 comments on commit 38b1099

Please sign in to comment.