Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ function polynomial_merge!(
combine::F6,
keep::F7,
resize::F8,
) where {F1,F2,F3,F4,F5,F6,F7,F8}
::Type{term_type} = n1 > 0 ? typeof(get1(1)) :
n2 > 0 ? typeof(get2(1)) : Nothing,
) where {F1,F2,F3,F4,F5,F6,F7,F8,term_type}
buffer = nothing
i = j = k = 1
# Invariant:
Expand All @@ -109,7 +111,7 @@ function polynomial_merge!(
if k == i
t0 = get1(i)
if buffer === nothing
buffer = DataStructures.Queue{typeof(t0)}()
buffer = DataStructures.Queue{term_type}()
end
push!(buffer, t0)
i += 1
Expand Down
2 changes: 1 addition & 1 deletion test/commutative/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@test !isconj(a)
@test ordinary_variable(a) == a
@test conj(a) == real(a) == a
@test_broken iszero(imag(a)) # no iszero for MA.Zero
@test iszero(imag(a))
@test isreal(a^3 + 5a^2 + 4a)
@test !isreal(a^3 + 5im * a^2 + 4a)

Expand Down
15 changes: 8 additions & 7 deletions test/commutative/gcd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,15 @@ end
end
end
end
@testset "Non-concrete polynomial GCD" begin
Mod.@polyvar p q
p1 = MP.polynomial(p^2 + q^2, Number)
p2 = MP.polynomial(p * q, Number)
g = @inferred gcd(p1, p2)
@test isone(g)
if nameof(Mod) == :DynamicPolynomials
@testset "Non-concrete polynomial GCD" begin
Mod.@polyvar p q
p1 = MP.polynomial(p^2 + q^2, Number)
p2 = MP.polynomial(p * q, Number)
g = @inferred gcd(p1, p2)
@test isone(g)
end
end

@testset "Complex coefficient GCD" begin
Mod.@polyvar p q
p1 = MP.polynomial(p^2 + q^2, ComplexF64)
Expand Down