Skip to content

Commit b1a1cef

Browse files
committed
Make everything non-iterable in broadcast
1 parent 624c004 commit b1a1cef

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

src/mono.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ end
3434
Monomial::Number) = Monomial{true}(α)
3535
end
3636

37+
Base.broadcastable(m::Monomial) = Ref(m)
3738
Base.copy(m::M) where {M<:Monomial} = M(m.vars, copy(m.z))
3839

3940
# Generate canonical reperesentation by removing variables that are not used

src/poly.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ end
2929

3030
iscomm(::Type{Polynomial{C, T}}) where {C, T} = C
3131

32+
Base.broadcastable(p::Polynomial) = Ref(p)
3233
Base.copy(p::Polynomial{C, T}) where {C, T} = Polynomial{C, T}(copy(p.a), copy(p.x))
3334
Base.zero(::Type{Polynomial{C, T}}) where {C, T} = Polynomial(T[], MonomialVector{C}())
3435
Base.one(::Type{Polynomial{C, T}}) where {C, T} = Polynomial([one(T)], MonomialVector{C}(PolyVar{C}[], [Int[]]))

src/term.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Term(x::PolyVar{C}) where C = Term{C}(x)
2222
Term{C, T}(α) where {C, T} = Term{C}(T(α))
2323
Term{C}::T) where {C, T} = Term{C, T}(α, Monomial{C}())
2424

25+
Base.broadcastable(t::Term) = Ref(t)
2526
#(::Type{TermContainer{C}}){C}(x::PolyVar{C}) = Term(x)
2627
#(::Type{TermContainer{C}}){C}(x::Monomial{C}) = Term(x)
2728
#(::Type{TermContainer{C}}){C}(t::TermContainer{C}) = t

src/var.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ struct PolyVar{C} <: AbstractVariable
4949
end
5050

5151
Base.hash(x::PolyVar, u::UInt) = hash(x.id, u)
52+
Base.broadcastable(x::PolyVar) = Ref(x)
5253

5354
MP.name(v::PolyVar) = v.name
5455
MP.monomial(v::PolyVar) = Monomial(v)

0 commit comments

Comments
 (0)