Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Jun 12, 2024
1 parent d6c0c44 commit 5bfdfd1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/comp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ end
# Comparison of Term
function (==)(p::Polynomial{V,M}, q::Polynomial{V,M}) where {V,M}
# terms should be sorted and without zeros
if length(p) != length(q)
if MP.nterms(p) != MP.nterms(q)
return false
end
for i in 1:length(p)
for i in eachindex(p.a)
if p.x[i] != q.x[i]
# There should not be zero terms
@assert p.a[i] != 0
Expand Down
2 changes: 1 addition & 1 deletion src/mult.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function _mul(
else
allvars, maps = mergevars([MP.variables(p), MP.variables(q)])
end
N = length(p) * length(q)
N = MP.nterms(p) * MP.nterms(q)
Z = Vector{Vector{Int}}(undef, N)
a = Vector{T}(undef, N)
i = 0
Expand Down
2 changes: 1 addition & 1 deletion src/poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function MP.remove_monomials(p::Polynomial, x::MonomialVector)
# use the fact that monomials are sorted to do this O(n) instead of O(n^2)
j = 1
I = Int[]
for (i, t) in enumerate(p)
for (i, t) in enumerate(MP.terms(p))
while j <= length(x) && x[j] < MP.monomial(t)
j += 1
end
Expand Down

0 comments on commit 5bfdfd1

Please sign in to comment.