Skip to content

Commit 6369317

Browse files
committed
Copy monovec given to polynomial and add polynomial! that does not copy
1 parent d9d43ca commit 6369317

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/poly.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ function polynomialclean_to!(p::Polynomial{C, T}, vars::Vector{PolyVar{C}}, adup
182182
return p
183183
end
184184

185-
MP.polynomial(a::AbstractVector, x::DMonoVec, s::MP.ListState) = Polynomial(collect(a), x)
185+
MP.polynomial!(a::Vector, x::DMonoVec, ::MP.ListState) = Polynomial(a, x)
186+
MP.polynomial(a::AbstractVector, x::DMonoVec, s::MP.ListState) = MP.polynomial!(collect(a), MA.mutable_copy(x), s)
186187

187188
#MP.polynomial(f::Function, x::AbstractVector) = Polynomial(f, x)
188189
#MP.polynomial(ts::AbstractVector{Term{C, T}}) where {C, T} = Polynomial(coefficient.(ts), monomial.(ts)) # FIXME invalid age range update

0 commit comments

Comments
 (0)