Skip to content

Commit

Permalink
fix bug in evaluation of LaurentMPoly (#1150)
Browse files Browse the repository at this point in the history
  • Loading branch information
tthsqe12 authored Apr 22, 2022
1 parent 89755d3 commit b7bd387
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/generic/LaurentMPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ function evaluate(a::LaurentMPolyWrap, b::Vector)
(ap, ad) = _normalize(a)
z = evaluate(ap, b)
for i in 1:nvars(parent(a))
if !iszero(a.mindegs[i])
z *= b[i]^a.mindegs[i]
if !iszero(ad[i])
z *= b[i]^ad[i]
end
end
return z
Expand Down
2 changes: 2 additions & 0 deletions test/generic/LaurentMPoly-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ end
@testset "Generic.LaurentMPoly.euclidean" begin
L, (x, y) = LaurentPolynomialRing(ZZ, ["x", "y"])
@test isone(gcd(x, y))
@test isone(gcd(inv(x), inv(y)))
@test_throws Exception divrem(x, y)
end

Expand All @@ -61,6 +62,7 @@ end
@test divides(a^2, a) == (true, a)

@test evaluate(x^-1 + y, [QQ(2), QQ(3)]) == 1//2 + 3
@test evaluate(inv(x)*x, [QQ(2), QQ(3)]) == 1

a = 2*x^-2*y + 3*x*y^-3
le = leading_exponent_vector(a)
Expand Down

0 comments on commit b7bd387

Please sign in to comment.